Re: How to write this "properly" in Perl 6?

2009-05-28 Thread Cosimo Streppone
In data 27 mai 2009 alle ore 23:46:40, John M. Dlugosz <2nb81l...@sneakemail.com> ha scritto: Anything in the existing implementation that's hostile to Perl 6? Just port it over by lightly editing the text or using a p5 module importer. Yes, right, but that wouldn't use Perl 6 features. T

Re: How to write this "properly" in Perl 6?

2009-05-28 Thread Carl Mäsak
Mark (>): > but I think an idiomatic Perl 6 solution would have a proper lazy > Iterator.  How do we write one of those? Like this, I think: $ perl6 -e '.say for gather { my $n = 1; loop { take ; take "bon" for ^$n; take "digi" for ^$n; ++$n } }' That currently parses in Rakudo, but hangs since

Re: How to write this "properly" in Perl 6?

2009-05-28 Thread Cosimo Streppone
In data 28 mai 2009 alle ore 00:13:19, Mark J. Reed ha scritto: You can write a sub to return the next step: sub bondigi { state $n=1; return (, xx $n, xx $n++); } Nahh. That's too easy... It's not fun :-) but I think an idiomatic Perl 6 solution would have a proper lazy Iterator. Ye

Re: How to write this "properly" in Perl 6?

2009-05-27 Thread Mark J. Reed
You can write a sub to return the next step: sub bondigi { state $n=1; return (, xx $n, xx $n++); } but I think an idiomatic Perl 6 solution would have a proper lazy Iterator. How do we write one of those?

Re: How to write this "properly" in Perl 6?

2009-05-27 Thread Daniel Ruoso
Em Qua, 2009-05-27 às 23:46 +0200, Carl Mäsak escreveu: > Not sure if I grokked the whole set of rules, but here's a one-liner > that does it: > $ perl6 -e 'say (, "bon" xx ++$*n, "digi" xx > $*n).join(", ") while *' It does, but it would be prettier if it was lazy... for 2..* -> $n { (, "bon" xx

Re: How to write this "properly" in Perl 6?

2009-05-27 Thread John M. Dlugosz
Cosimo Streppone cosimo-at-streppone.it |Perl 6| wrote: Hi cool people, the "Amazing Perl 6" thread was amazing. It reminded me how Perl 6 looks interesting and fun. So... how can I write "properly", for some meaning of properly, the Perl 6 equivalent of this: http://search.cpan.org/dist/Gam

Re: How to write this "properly" in Perl 6?

2009-05-27 Thread Carl Mäsak
Cosimo (>): > the "Amazing Perl 6" thread was amazing. > It reminded me how Perl 6 looks interesting and fun. > So... > > how can I write "properly", for some meaning of properly, > the Perl 6 equivalent of this: > >  http://search.cpan.org/dist/Games-BonDigi/ > > ? Not sure if I grokked the whole

How to write this "properly" in Perl 6?

2009-05-27 Thread Cosimo Streppone
Hi cool people, the "Amazing Perl 6" thread was amazing. It reminded me how Perl 6 looks interesting and fun. So... how can I write "properly", for some meaning of properly, the Perl 6 equivalent of this: http://search.cpan.org/dist/Games-BonDigi/ ? ( if it's not clear, you can run the ex