Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Transform Sequence Problem

by Anonymous Monk
on Jun 19, 2013 at 19:46 UTC ( #1039834=note: print w/ replies, xml ) Need Help??

in reply to Transform Sequence Problem

dominus's Higher-Order Perl, the chapter about iterators?

use Iterator_Utils qw/:all/; my @data = (1, 2, 3); my $data_iter = list_iterator(@data); $f1 = sub { $_ + 1 }; $f2 = sub { log($_) }; $f3 = sub { $_ * 3 }; my $iter = $data_iter; for my $func ($f1, $f2, $f3) { $iter = imap($func, $iter); } while (my $item = NEXTVAL($iter)) { print $item, "\n"; }
( available at his web site)
# output 2.07944154167984 3.29583686600433 4.15888308335967

Comment on Re: Transform Sequence Problem
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2015-11-30 22:54 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (788 votes), past polls