Recursive lazy lists?

2011-07-30 Thread Mark J. Reed
Sorry if this has come up before and I missed it, but I just came across this Haskell function to convert from Gray code back to normal binary (as lists of 1s and 0s; full code at http://rosettacode.org/mw/index.php/Gray_code#Haskell): gray2bin [] = [] gray2bin (x:xs) = bin where bin = x : zipWi

[perl #95970] [BUG] Code.callwith introduces an official CALLER frame in Rakudo

2011-07-30 Thread Carl Mäsak
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #95970] # in the subject line of all future correspondence about this issue. # https://rt.perl.org:443/rt3/Ticket/Display.html?id=95970 > is there a method for invoking a Routine? besides postcircumfix:<( )>, I mean? ra

Re: Recursive lazy lists?

2011-07-30 Thread Bruce Gray
On Jul 30, 2011, at 8:30 AM, Mark J. Reed wrote: --snip-- Does Perl6's variety of laziness support this sort of definition? It's not an infinite list; zipWith stops zipping as soon as either list is empty. But the self-reference in the definition means it still has to be computed lazily.

Re: Recursive lazy lists?

2011-07-30 Thread Mark J. Reed
On Sat, Jul 30, 2011 at 6:02 PM, Bruce Gray wrote: > > Yes, Perl 6 does support laziness in this sort of definition, via "run-time > binding". > Very cool. Thanks! > Here is a quick conversion of the Haskell solution into Perl 6; its output > (when run in Rakudo) exactly matches the output of

Re: Recursive lazy lists?

2011-07-30 Thread Bruce Gray
On Jul 30, 2011, at 6:40 PM, Mark J. Reed wrote: On Sat, Jul 30, 2011 at 6:02 PM, Bruce Gray wrote: --snip-- our multi sub infix: ( $x, $y ) { ( $x + $y ) % 2 }; Why did you need to define this yourself instead of just using +^ ? Umm, because that is what was done in the Haskell code I