Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

take: bug or feature?

4 views
Skip to first unread message

Ovid

unread,
Dec 18, 2006, 4:28:03 PM12/18/06
to perl6-c...@perl.org
A few days ago, Larry posted this on Perlmonks
(http://perlmonks.org/?node_id=590147):

sub group (*@array is copy) {
gather {
while @array {
take [ # line 112
gather {
my $h = shift @array;
take $h;
while @array and $h eq @array[0] {
take shift @array;
}
}
];
}
}
}

I added that to my "99 Problems" code because it worked just fine (I
would swear it did. I'd be embarrassed if I am misremembering). Now
I've upgraded Pugs and it fails with:

Unexpected "["
expecting bare or pointy block construct, ":", identifier, operator
or "}"
at 99.pugs line 112, column 18

Line 112 is the first take. Did something break? If so, I'll add a
test. Otherwise, what's wrong with this code? Also, I've been
searching the docs for the exact syntax of 'gather/take' and I can't
find it. Pointers would be great.

Pugs Version: 6.2.13 (r14911)

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

Sean O'Rourke

unread,
Dec 18, 2006, 4:40:19 PM12/18/06
to publiustemp-p...@yahoo.com, perl6-c...@perl.org
Ovid <publiustemp-p...@yahoo.com> writes:
> Did something break? If so, I'll add a test. Otherwise, what's
> wrong with this code?

I noticed this as well, and believe it's a bug -- pugs accepts
the code if you remove all the newlines. Then again, I'm not
sure this is the desired behavior:

pugs> group(1..10)
((1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,))

/s

Ovid

unread,
Dec 18, 2006, 5:57:52 PM12/18/06
to perl6-c...@perl.org
--- Sean O'Rourke <soro...@cs.ucsd.edu> wrote:

> I noticed this as well, and believe it's a bug -- pugs accepts
> the code if you remove all the newlines. Then again, I'm not
> sure this is the desired behavior:
>
> pugs> group(1..10)
> ((1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,))
>
> /s

It looks like there's a bug in gather/take and luqui is working on it
now (from #perl6).

0 new messages