On Fri, Jul 11, 2008 at 03:27:26PM +0200, TSa wrote:
HaloO,
Patrick R. Michaud wrote:
S29 doesn't show a 'sort' method defined on block/closure
invocants... should there be?
I doubt that. And to my eyes it looks funny. Only real block
methods should be useful and since the class is
On Fri, Jul 11, 2008 at 09:01:09AM -0500, Patrick R. Michaud wrote:
: I'm not entirely certain if any of the following
: examples with adverbial blocks would also work. I'm guessing
: they do, but could use confirmation.
:
: sort @a, :{ $^a = $^b };
: sort @a :{ $^a = $^b };
: sort
t/spec/S29-list/sort.t has the following test:
my @a = (2, 45, 6, 1, 3);
my @e = (1, 2, 3, 6, 45);
my @s = { $^a = $^b }.sort: @a;
is(@s, @e, '... with closure as direct invocant');
S29 doesn't show a 'sort' method defined on block/closure
invocants... should there be?
Note
HaloO,
Patrick R. Michaud wrote:
S29 doesn't show a 'sort' method defined on block/closure
invocants... should there be?
I doubt that. And to my eyes it looks funny. Only real block
methods should be useful and since the class is mostly known
at parse time unapplicable methods should be a
On Fri, Jul 11, 2008 at 03:27:26PM +0200, TSa wrote:
Note that we already have:
my @s = sort { $^a = $^b }, @a;
my @s = @a.sort { $^a = $^b };
Is that the adverbial block syntax? If not how
would it look?
The adverbial block syntax would be:
@a.sort:{ $^a = $^b };