Skip to content

Instantly share code, notes, and snippets.

@kckennylau
Last active May 22, 2016 06:23
Show Gist options
  • Save kckennylau/69a9df005c4d6dc9bafa9d40a6cb4ff2 to your computer and use it in GitHub Desktop.
Save kckennylau/69a9df005c4d6dc9bafa9d40a6cb4ff2 to your computer and use it in GitHub Desktop.
repeated factorial, leaderboard
Jelly: !¡
05AB1E: F! (swaps order)
J: !^: (swaps order)
Actually: `!`n
MATL: :":p
CJam: q~{m!}*
Pyth: u.!GEQ
Pyth: Mem=.!GH
Jolf: e+*j"!Y (swaps order)
Mathematica: #!&~Nest~##&
J: 4 :'(!^:y)x'
J: 4 :0\n(!^:y)x\n)
J: ".@($&'!'@[,":@])
UGL: iilRc%l$d:_l*%:%rd:_o
Julia: f(x,y)=y>0?prod(1:f(x,y-1)):x
Haskell: f 0 y=y\nf x y=product[1..f(x-1)y] (swaps order)
Julia: x->y->"$x"*repeat("|>factorial",y) (without evaluation)
Ruby: ->a,b{eval'a=(1..a).inject:*;'*b}
Javascript: f=(a,b,k=1)=>b&&(a&&f(a-1,b,k*a)||f(k,b-1))||a
Julia: x->y->eval(parse("$x"*repeat("|>factorial",y)))
Javascript: g=_=>_-1?_*g(_-1):1;f=a=>b=>--b?f(g(a))(b):g(a)
Python: f=lambda a,b,k=1:b and(a and f(a-1,b,k*a)or f(k,b-1))or a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment