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

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$_" } @_; } +@_; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://50738]
help
Chatterbox?
[marto]: good morning all, snow day here, won't make it to the office
[Corion]: marto: Oof - that means taking a day off or can you work from home?
[marto]: Corion, I can do some non-technical things, but there's no way for me to connect to the clients network.
[marto]: which is a shame, I had a really productive day yesterday
[Corion]: marto: Meh, so it'll be a day of cleaning out email...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2018-01-16 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (175 votes). Check out past polls.

    Notices?