Re: 12 hackers hacking...

2008-12-27 Thread Mark J. Reed
On Fri, Dec 26, 2008 at 1:45 PM, Stephen Weeks wrote: > Looks like you found a regression. This has been fixed since r34393. Confirmed fixed in r34454. Thanks! -- Mark J. Reed

Re: 12 hackers hacking...

2008-12-26 Thread Stephen Weeks
Not long ago, Mark J. Reed proclaimed... > On Thu, Dec 25, 2008 at 1:55 AM, Stephen Weeks wrote: > > This currently works in rakudo: > >for (1..$n).reverse { ... } > > No, it doesn't (r34384) > > for (1..10).reverse { say $^i } > 01 9 8 7 6 5 4 3 2 1 > > The list is flattened into a string

Re: 12 hackers hacking...

2008-12-26 Thread Mark J. Reed
On Thu, Dec 25, 2008 at 1:55 AM, Stephen Weeks wrote: > Not long ago, Mark J. Reed proclaimed... >> What's the consensus on how to do an idiomatic countdown loop? I used >> for [1..$n].reverse... > > This: will work eventually: >for $n..1:by(-1) { ... } Cool. > This currently works in rakud

Re: 12 hackers hacking...

2008-12-26 Thread Stephen Weeks
Not long ago, Mark J. Reed proclaimed... > What's the consensus on how to do an idiomatic countdown loop? I used > for [1..$n].reverse... This: will work eventually: for $n..1:by(-1) { ... } This currently works in rakudo: for (1..$n).reverse { ... }

Re: 12 hackers hacking...

2008-12-25 Thread Patrick R. Michaud
On Thu, Dec 25, 2008 at 12:49:03PM -0600, Patrick R. Michaud wrote: > There's always: > > for @gifts[$^day].pairs.reverse { my ($n,$g) = .kv; ... } Typo (reversed order of $ and ^ in ^$day): for @gifts[^$day].pairs.reverse { my ($n,$g) = .kv; ... } Pm

Re: 12 hackers hacking...

2008-12-25 Thread Patrick R. Michaud
On Thu, Dec 25, 2008 at 01:38:54PM -0500, Mark J. Reed wrote: > Yeah, I tried a couple zip-based variants, but thought the flattening > was a little confusing when combined with the reversal (so keys and > values get swapped when the list is reversed). I'd forgotten about > the ^max shorthand, th

Re: 12 hackers hacking...

2008-12-25 Thread Ashley Winters
On Thu, Dec 25, 2008 at 9:39 AM, Mark J. Reed wrote: > On Thu, Dec 25, 2008 at 12:00 PM, Patrick R. Michaud > wrote: >> On Thu, Dec 25, 2008 at 12:53:06AM -0500, Mark J. Reed wrote: >>> I also tried this, but it caused Rakudo to throw a StopIteration and >>> then segfault: >>> >>> for [...@gifts

Re: 12 hackers hacking...

2008-12-25 Thread Mark J. Reed
Yeah, I tried a couple zip-based variants, but thought the flattening was a little confusing when combined with the reversal (so keys and values get swapped when the list is reversed). I'd forgotten about the ^max shorthand, though. Thanks for the reminder. So how to loop over a list of sublist

Re: 12 hackers hacking...

2008-12-25 Thread Patrick R. Michaud
On Thu, Dec 25, 2008 at 12:39:24PM -0500, Mark J. Reed wrote: > On Thu, Dec 25, 2008 at 12:00 PM, Patrick R. Michaud > wrote: > > On Thu, Dec 25, 2008 at 12:53:06AM -0500, Mark J. Reed wrote: > >> I also tried this, but it caused Rakudo to throw a StopIteration and > >> then segfault: > >> > >> f

Re: 12 hackers hacking...

2008-12-25 Thread Mark J. Reed
On Thu, Dec 25, 2008 at 12:00 PM, Patrick R. Michaud wrote: > On Thu, Dec 25, 2008 at 12:53:06AM -0500, Mark J. Reed wrote: >> I also tried this, but it caused Rakudo to throw a StopIteration and >> then segfault: >> >> for [...@gifts[0..$day-1]].pairs.reverse -> $n, $g > > The StopIteration occur

Re: 12 hackers hacking...

2008-12-25 Thread Patrick R. Michaud
On Thu, Dec 25, 2008 at 12:53:06AM -0500, Mark J. Reed wrote: > I also tried this, but it caused Rakudo to throw a StopIteration and > then segfault: > > for [...@gifts[0..$day-1]].pairs.reverse -> $n, $g The StopIteration occurs when there aren't enough elements in the list to supply to the para

12 hackers hacking...

2008-12-24 Thread Mark J. Reed
Inspired by a message over on the Applescript users list, I thought I'd try to whip up a silly little P6 script to print out the 12 days of Christmas. I tried to use as many P6isms as I could squeeze in, but wanted it to work in Rakudo, which doesn't yet parse closure traits or multimethods, so ha