Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Small examples of string eval

by ikegami (Pope)
on May 14, 2006 at 04:24 UTC ( #549290=note: print w/ replies, xml ) Need Help??


in reply to Re: Small examples of string eval
in thread Small examples of string eval

Check out NestedLoops in Algorithm::Loops. In this case,

use Algorithm::Loops qw( NestedLoops ); use List::Util qw( reduce sum ); sub mul { return reduce { $a * $b } @_; } NestedLoops( [ map { [ 0..$n_ra->[$_] ] } 0..$#$n_ra ], sub { $prob_ra[sum @_] += mul map { $f_raa->[$_]->[$_[$_]] } 0..$#_; } );

I suspect that
$n_ra->[X]
is equal to
$#{$f_raa->[X]}
in which case
map { [ 0..$n_ra->[$_] ] } 0..$#$n_ra
can be replaced with
map { [ 0..$#$_ ] } @$f_raa


Comment on Re^2: Small examples of string eval
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2015-07-05 05:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls