Skip to main content
2 of 5
added 8 characters in body
Conor O'Brien
  • 40.2k
  • 3
  • 91
  • 180

Yup, 43 + 7 = 50 bytes (noncompeting)

0~--=+;|~|+e=x;0e=1;*{{:0e-}-0]~{~x~}+#\}1#

+7 bytes for the -cheat flag. I wasn't going to make this easy! Here's the github. Invoke like this:

node yup.js -cheat <location>.yup -n <input>

Or

node yup.js -cheat -l "0~--=+;|~|+e=x;0e=1;*{{:0e-}-0]~{~x~}+#\}1#" -n <input>

Examples:

λ node yup.js -cheat -l "0~--=+;|~|+e=x;0e=1;*{{:0e-}-0]~{~x~}+#\}1#" -n 5
120
λ node yup.js -cheat examples\factorial.yup -n 0
1

Explanation

Ungolfed.

0~--  = +;
|~|+e = x;
0e    = 1;
*{{:0e-}-0]~{~x~}+#\}1#
Conor O'Brien
  • 40.2k
  • 3
  • 91
  • 180