Of course, if you actually use this you can smash the stack -- Python doesn't currently have any kind of tail call optimization. (That factorial function isn't tail-recursive anyway, though.)
It doesn't look like Ruby has tail-call optimization, either. Lua does...what other primarily-scripting (i.e., not Scheme or Haskell) languages do?
6 comments
[ 2.6 ms ] story [ 24.1 ms ] threadmy $factorial = sub (Int $x) { $x < 2 ?? 1 !! $x * &?ROUTINE($x - 1); }
It doesn't look like Ruby has tail-call optimization, either. Lua does...what other primarily-scripting (i.e., not Scheme or Haskell) languages do?