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

Re: Generating all possible combinations from an AoA

by JavaFan (Canon)
on Apr 13, 2011 at 10:24 UTC ( [id://899151]=note: print w/replies, xml ) Need Help??


in reply to Generating all possible combinations from an AoA

use 5.010; sub mix {@_ ? map {my $x = $_; map "$x$_", mix(@_[1..$#_])} @{$_[0]} : + ""} say for mix @array;

Replies are listed 'Best First'.
Re^2: Generating all possible combinations from an AoA
by thargas (Deacon) on Apr 13, 2011 at 12:08 UTC

    I like this one best. A nice simple recursive function using map.

      Just don't use it on a problem of interesting size, as it requires the entire list to be in memory at once.

      - tye        

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-19 08:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found