Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: (Golf) Ordered Combinations

by sachmet (Scribe)
on Apr 25, 2001 at 01:42 UTC ( #75279=note: print w/ replies, xml ) Need Help??


in reply to (Golf) Ordered Combinations

51 :-)

#!/usr/bin/perl sub c {my$n=-1+shift;$n?map{my$c=$_;map$c.$_,c($n,@_)}@_:@_}; sub d {my$n=shift;--$n?map{my$d=$_;map$d.$_,d($n,@_)}@_:@_}; print join " ", c qw(2 a b c); print "\n"; print join " ", d qw(2 a b c); print "\n"; print join " ", c qw(4 0 1); print "\n"; print join " ", d qw(4 0 1); print "\n";


Comment on Re: (Golf) Ordered Combinations
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-07-14 00:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (253 votes), past polls