Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Binomial Golf

by chipmunk (Parson)
on May 30, 2001 at 18:19 UTC ( #84264=note: print w/replies, xml ) Need Help??


in reply to Re: Binomial Golf
in thread Binomial Golf

My best was 59 characters:
sub p { map{$_[$_]+=$_[$_+1]for 0..$#_;@_=(1,@_);print"@_\n"}1..pop }
However, I can reduce japhy's solution from 56 to 45 characters:
sub p { @_=(1,map$_[-2]+pop,@_),print"@_\n"for 1..pop }
BTW, I find it amusing that monks are giving their golf subroutines one-letter names, when the subroutine name isn't counted in the length of the solution. :)

I was considering sub pascal's_triangle {} for this one. ;)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://84264]
help
Chatterbox?
[M4ver1k]: I feel like being able to toggle a running script on the fly by updating variables from a config file using Config::Simple. But in the while loop, it seems like it doesn't update the variable after the first past. Is this generally just a bad idea?

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2017-11-20 03:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (283 votes). Check out past polls.

    Notices?