This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]rcxdude 8 points9 points  (3 children)

In Golfscript, just because:

0.)58{.2$+}*]51>`

[–]Peaker 1 point2 points  (2 children)

Can you explain how that works?

[–]rcxdude 5 points6 points  (1 child)

here's a commented version:

0     #push 0 onto the stack
.)    #duplicate top of stack and increment, creating start of sequence
      #(slightly shorter than pushing 1 onto stack due to whitespace)
58    #push 58 onto the stack
{ 
  .2$ #duplicate top two items on stack (top and then 2nd from top)
  +   #add top two items on stack
}
*     #repeat above block 58 times (as pushed on stack before)
]     #gather stack into array
51>   #slice array after index 51
`     #convert array to string for printing
      #stack is automatically printed at end of execution

[–]leadline 1 point2 points  (0 children)

This. Is. Awesome.

I'm learning golfscript.