in reply to Re^5: reduce like iterators
in thread reduce like iterators
"Did you?"
I did.
Syntax error without "+":
$ perl -MO=Deparse -e 'my @b = @{ reduce { push @$a, $b if !@$a || $b +ne $a->[-1]; $a } [], @a };' syntax error at -e line 1, near "$b if" -e had compilation errors.
Syntax OK with "+":
$ perl -MO=Deparse -e 'my @b = @{ +reduce { push @$a, $b if !@$a || $b + ne $a->[-1]; $a } [], @a };' my(@b) = @{do { push @$a, $b if not @$a or $b ne $a->[-1]; $a }->reduce([], @a);}; -e syntax OK
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: reduce like iterators
by ikegami (Patriarch) on Jan 10, 2024 at 15:45 UTC | |
|
Re^7: reduce like iterators
by jdporter (Paladin) on Jan 09, 2024 at 16:27 UTC | |
by kcott (Archbishop) on Jan 10, 2024 at 01:01 UTC | |
by jdporter (Paladin) on Jan 10, 2024 at 15:21 UTC |