On Tue, Sep 15, 2015 at 11:28:59AM -0500, andy_b...@wiwb.uscourts.gov wrote:
> [1 1 1 1]
> next
> [1 1 1 1 1 1]
> next
> [1 1 1 1 1 1 1 1]
> 
> vs
> 
> [1 2 3]
> next
> [1 2 3 3]
> next
> [1 2 3 3 3]
> 
> I think the latter is clearer, though perhaps the problem is the original 
> code is a bit overly-contrived (I'm thinking ;-). It shows better the 
> variation after each call, maybe. my 2.000000e-02 dollars worth.

So, how about this

perl6 -e 'sub a {state @x; @x.push(++$)}; say a for 1..6;'

[1]
[1 2]
[1 2 3]
[1 2 3 4]
[1 2 3 4 5]
[1 2 3 4 5 6]

?

dha

-- 
David H. Adler - <d...@pobox.com> - http://www.panix.com/~dha/
Pancakes is the better part of valor    - Toothgnip

Reply via email to