You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inspired by recent advances in the R language, I went ahead and implemented a form of tail call recursion. However, it necessarily executes in a "non-standard" way, greedily evaluating arguments to recursive calls.
This means that expectations of R would apply to most calls, but might be unexpected for tail-recursive calls.
This is because result is necessarily greedily evaluated. Recursive calls will not work with promises dependent on the parent frame or non-standard evaluation. The "right" approach here is a bit unclear, so I'm going to wait to see how the R version feels with all of R's non-standard eval tricks to see if I can learn something from the design.
The text was updated successfully, but these errors were encountered:
Was mulling over this today and I think there happy middle ground where tail call optimization only happens if all arguments are evaluated (equivalent to forceed in R).
Inspired by recent advances in the R language, I went ahead and implemented a form of tail call recursion. However, it necessarily executes in a "non-standard" way, greedily evaluating arguments to recursive calls.
This means that expectations of R would apply to most calls, but might be unexpected for tail-recursive calls.
Typical Evaluation
Tail-Recursive Evaluation
This is because
result
is necessarily greedily evaluated. Recursive calls will not work with promises dependent on the parent frame or non-standard evaluation. The "right" approach here is a bit unclear, so I'm going to wait to see how the R version feels with all of R's non-standard eval tricks to see if I can learn something from the design.The text was updated successfully, but these errors were encountered: