Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Re: Algorithm help

by eg (Friar)
on Jan 09, 2001 at 23:26 UTC ( #50738=note: print w/ replies, xml ) Need Help??

in reply to Re: Algorithm help
in thread Search Algorithm

Here's the same thing, except using nested maps. Is there a way to do this in just one pass?

my @fruit = qw/ apples oranges pears /; my @salad = mix_up( @fruit ); print join(', ', @salad), "\n"; sub mix_up { return map { my $tmp=$_; map { $tmp eq $_ ? $_ : "$tmp$_" } @_; } +@_; }

Comment on Re: Re: Algorithm help
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2015-11-25 03:18 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 (670 votes), past polls