Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Transform Sequence Problem

by BillKSmith (Vicar)
on Jun 22, 2013 at 15:32 UTC ( #1040276=note: print w/replies, xml ) Need Help??


in reply to Re: Transform Sequence Problem
in thread Transform Sequence Problem

The recursion was harder than I expected (but just as short)!
use strict; use warnings; my @data = (1, 2, 3); $, = "\n"; print trans1(\@data,2); BEGIN{ my $seq =[ sub {map {$_ + 1} @_}, sub {map {log($_)} @_}, sub {map {$_ * 3} @_}, ]; sub trans1 { my ($x, $n) = @_; return $seq->[ 0]->(@$x) if $n == 0; return $seq->[$n]->( trans1($x, $n-1, $seq) ); } }
Bill

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040276]
help
Chatterbox?
[LanX]: POD and DATA don't interfere in any way, you can mix freely
[LanX]: you can even read pod from <DATA> if that's your question
[LanX]: or maybe that's your problem ? :)

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (13)
As of 2017-10-18 20:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (250 votes). Check out past polls.

    Notices?