EntropySink

Technical & Scientific => Programming => Topic started by: Rob on July 11, 2013, 04:30:58 PM

Title: If Kerouac wrote JavaScript (and Dr Johnson wrote CoffeeScript)...
Post by: Rob on July 11, 2013, 04:30:58 PM
http://blog.anguscroll.com/if-kerouac-wrote-javascript

Code: [Select]
# In which various NUMBERS are summon'd by
# means of ELECTRONICK CONJURY
factorial = (n) ->
   # All argument is against it; yet all belief is for it
   return 1 unless n

   # Ingenious sophistry to prove the palp'bly OBVIOUS
   return 1 if n is 1

   # Recursion (n.)
   # a program that calls 'pon itself in the manner of
   # a dog returning unto its VOMIT
   return n * factorial n - 1