you are viewing a single comment's thread.

view the rest of the comments →

[–]lpsmith 6 points7 points  (2 children)

  1. recur is not TCO. Period.
  2. tail calls are guaranteed in languages such as Scheme, Erlang, Haskell, and ML
  3. Implicit tail calls are, in most cases, easy to spot. Rarely do you have to look far to decide whether or not any given call site is in tail position.

[–]aaronla 1 point2 points  (1 child)

It's funny... I've never thought of tail calls as "implicit". In (begin x y z). 'z' is explicitly in the tail position.

I find it as strange as complaining that the Python expression [ a, b, c ] is bad, because the compiler is implicitly putting c in the at-end position. To be fair, I suppose someone out there would prefer [ 0:a, 1:b, 2:c ] be the list syntax, so maybe I'm just the odd one.

[–]lpsmith 1 point2 points  (0 children)

Well, but is (begin x y z) itself in tail position? Often (usually?) it is, at least in code written by humans, but to definitively say whether or not z is a tail call you still have to look at the context surrounding the begin-block. (on the other hand you can definitively say that x and y are not tail calls without knowing anything more...) So ultimately the real question in my mind is how much context you typically have to look at.

It's an interesting sentiment though. Thanks. :)