On Thu, Mar 22, 2012 at 11:07:08AM -0500, Bruce Gray wrote: > Well, it works in Niecza. It does not (yet) work in Rakudo: > 15:25 <Util> perl6: my @squares := 0, (-> *@a { @a.elems ** 2 }) > ... *; say ~@squares[^11]; > 15:25 <p6eval> ..niecza v15-4-g1f35f89: OUTPUT<<0 1 4 9 16 25 36 49 > 64 81 100NL>> > 15:25 <p6eval> ..rakudo 1a468d: OUTPUT<<0 0 0 0 0 0 0 0 0 0 0NL>>
It now works in Rakudo, as of 2012.03-5-g69920db: > my @squares = 0, (-> *@a { @a.elems ** 2 }) ... *; say @squares[^11]; 0 1 4 9 16 25 36 49 64 81 100 Also @_ now DTRT again: > my @squares = { @_ ** 2 } ... *; say @squares[^11]; 0 1 4 9 16 25 36 49 64 81 100 > my @triangle = 1, { @_[*-1] + @_ + 1 } ... *; say @triangle[^11] 1 3 6 10 15 21 28 36 45 55 66 Note that Rakudo also doesn't require a binding operation for the array... assignment of detectably infinite lists (indicated here by the final Whatever term) is supported. Pm