It's much simpler than the "semipredicate problem" because all you have to do is set the previous value to "not the first value".
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=880228 use warnings; sub squeeze { no warnings; my $prev = not $_[0]; return grep +($_ ne $prev, $prev = $_)[0], @_; }
In reply to Re: reduce like iterators
by tybalt89
in thread reduce like iterators
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |