develooper Front page | perl.perl6.language | Postings from March 2012

Re: How to make a new operator.

Thread Previous | Thread Next
From:
Damian Conway
Date:
March 21, 2012 14:10
Subject:
Re: How to make a new operator.
Message ID:
CAATtAp7W-HojAKf4rGXDmKUdThH6-HYvXTWczt5YuiGH6EjZzw@mail.gmail.com
> Is it possible to create a new range operator ':' such that:

Do you need to?


> a:b:c is a range from 'a' to 'b' by steps of 'c'.

Perl 6 already has: $a,*+$c...* >=$b

E.g. 2, 5 ...^ *>=15  ----> 2,5,8,11,14


> :b is the same as 0..b

Perl 6 already has ^$b

e,g, ^100 ----> 0..99


> a: is the same as a..Inf

Perl 6 already has $a..* or $a...*

e.g. 3..* ----> 3,4,5,6,....


> ::c is the same as 0:Inf:c

Perl 6 already has:  0,$c...*

e.g. 0,3...* ----> 0, 3, 6, 9, 12....


> : is the same as 0..Inf

Perl 6 already has: ^Inf ----> 0,1,2,3,4,5,....


Damian

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About