Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^5: reduce like iterators

by ikegami (Patriarch)
on Jan 03, 2011 at 23:17 UTC ( [id://880277]=note: print w/replies, xml ) Need Help??


in reply to Re^4: reduce like iterators
in thread reduce like iterators

As already stated in the OP the need to appropiately name a whole new family of reduce-like iterators is an extra problem.

Your always free to not give it a name, leaving it as

my @b; for (@a) { push @b, $_ if !@b || $_ ne $b[-1]; }
or
my @b = list_reduce { 0, $a || $b ne $_->[-1] ? $b : () } 1, @a;

But they're not very readable.

But I'd prefer to have a solution where map is still named map and grep ist still grep

You complain that there's "a lack of iterators allowing to compare successive elements", yet you wouldn't want to use them if they existed?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://880277]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-19 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found