in reply to Golfing a fibonacci number generator
die map{int((($;=((1+($^=5**.5))/2)**$_)-((-1**$_)/$;))/$^).$/}0..9
By changing the map to use the coderef syntax, you eliminate the need for the comma between the operation and the operands. You can also get rid of that last semicolon in the map block, as it is uneeded.
My personal fibonacci generator is:
@@=(1,1);push(@@,$@[0]+$@[1]),print(shift@@)for(1..20)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Golfing a fibonacci number generator
by ikegami (Patriarch) on Nov 03, 2006 at 23:16 UTC | |
by cLive ;-) (Prior) on Nov 03, 2006 at 23:50 UTC | |
by ikegami (Patriarch) on Nov 04, 2006 at 00:03 UTC | |
|
Re^2: Golfing a fibonacci number generator
by Anonymous Monk on Nov 03, 2006 at 21:40 UTC | |
by jdalbec (Deacon) on Nov 04, 2006 at 00:36 UTC |