in reply to Re: reduce like iterators
in thread reduce like iterators
push ( @soln, $val ) if ( $soln[-1] ne $val );
The brackets around the arguments to push are unnecessary, even in the full-blown if-block you used. With postfix-if you can lose the other brackets too:
push @soln, $val if $soln[-1] ne $val;
I know some folks like the extra brackets but I find removing them aids clarity.
🦛
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: reduce like iterators
by talexb (Chancellor) on Jan 11, 2024 at 23:28 UTC | |
by tybalt89 (Monsignor) on Jan 12, 2024 at 00:32 UTC |