Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: integer partition golf

by liverpole (Monsignor)
on Oct 18, 2006 at 20:55 UTC ( [id://579208]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #  1.  Convert "shift" to "pop" to save 2 chars
    #  2.  Convert leading "if" to trailing "&&" to
    ...
    #  Savings = 4 chars (86 total chars)
    
    sub p{my($n,@e,$o)=@_;$_{$_=join$",sort@_,$/}++||print;p(++$o,--$n,@e)
    +while$n-1}p(pop)
    
  2. or download this
    #  4.  Remove parens from subroutine for 1 char
    #
    #  Total:  85 chars
    
    sub p{my($n,@e,$o)=@_;$_{$_=join$",sort@_,$/}++||print;p(++$o,--$n,@e)
    +while$n-1}p pop
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-16 07:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found