Skip to main content
1 of 5
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

I'll add a non-cheat version tomorrow, but this will do for now. Oh, and I'll explain tomorrow, too.

Conor O'Brien
  • 40.2k
  • 3
  • 91
  • 180