Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: RE: Permutations and combinations

by I0 (Priest)
on Apr 19, 2002 at 04:17 UTC ( #160432=note: print w/replies, xml ) Need Help??


in reply to RE: Permutations and combinations
in thread Permutations and combinations

your sub swap can be written without $t:
sub swap { my ($i,$j) = @_; @a[$i,$j] = @a[$j,$i]; }

Replies are listed 'Best First'.
Re: Re: RE: Permutations and combinations
by AltBlue (Chaplain) on Apr 19, 2002 at 15:21 UTC
    lol, you bother to look upon this old piece of code :))

    heh, of course that your snippet is good, but a swap routine could be written even simpler:

    sub swap { reverse @_ }
    ... heh, it's not the case for that code thou, as the array is a global one :) cheers.

    --
    AltBlue.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://160432]
help
Chatterbox?
[talexb]: Used all my votes during that meeting .. been a while since I've done that. Now, back to work. Good localtime, monks!
[Corion]: talexb: You enjoyed the All Hands meeting in the pool?!
[Corion]: I understand "surfing" in the pool ;)
[talexb]: Corion I admired the pool .. I wasn't .. soaking in it. ;)
[talexb]: Plus, I've been awy from PM for about three weeks .. needed a bit of catch-up time.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (14)
As of 2017-07-20 15:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (304 votes). Check out past polls.