On 21 March 2012 22:09, Damian Conway <dam...@conway.org> wrote: >> Is it possible to create a new range operator ':' such that: > > Do you need to?
Hmm... maybe not... >> 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 That looks really scary. I'll try to figure out what it means later. > Perl 6 already has ^$b > Perl 6 already has $a..* or $a...* > Perl 6 already has: ^Inf ----> 0,1,2,3,4,5,.... Ok... I think can use that. I want to write a simple class for numerical computation. Mostly because I don't like NumPy, PDL or Octave/Matlab. When I wrote my email I was thinking of slices: @matrix[2..5][3..7] @matrix[2..5][*] @matrix[5..*][^3] I guess that's alright. It doesn't seem to be worth the effort in adding new syntax. I'm having trouble getting this to work with Rakudo Star (2012.02) though... > my @a = \[1,2,3,4,5], \[6,7,8,9,0] 1 2 3 4 5 6 7 8 9 0 > > @a[0] 1 2 3 4 5 > > @a[0].WHAT Capture() > > @a[0][2] Any() :-( > Perl 6 already has: 0,$c...* > > e.g. 0,3...* ----> 0, 3, 6, 9, 12.... Interesting... but it doesn't seem to work in Rakudo Star (2012.02): > @(2,5..10) 2 5 6 7 8 9 10 :-( Cheers, Daniel. -- I'm not overweight, I'm undertall.