Re: Multi constraints and specificity

2008-12-25 Thread Patrick R. Michaud
On Wed, Dec 24, 2008 at 06:38:18PM -0800, Larry Wall wrote: > On Wed, Dec 24, 2008 at 06:57:39PM -0500, Mark J. Reed wrote: > : Ok, it works with a $^var in place of $x in the where block.Should > : the parameter be visible there under its declared name? If not, then > : this is clearly just p

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

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: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
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 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 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 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