Anonymous recursion: Difference between revisions

(→‎{{header|Common Lisp}}: Solution to the stated problem, no hand-waving.)
(→‎{{header|Common Lisp}}: New exercise. :))
Line 202:
# In the original <code>fib</code>, the recursive local function can obtain a reference to itself using <code>#'fib</code>. This would allow it to, for instance, <code>(apply #'fib list-of-args)</code>. Add a way for RECURSIVE blocks to obtain a reference to themselves.
# Add support for &optional and &rest parameters. Optional: also &key and &aux.
# Add LOOPBACK operator whose syntax resembles RECURSE, but which simply assigns the variables and performs a branch back to the top rather than a recursive call.
# Tail recursion optimization is compiler-dependent in Lisp. Modify RECURSIVE so that it walks the expressions and identifies tail-recursive RECURSE calls, rewriting these to use looping code. Be careful that unevaluated literal lists which resemble RECURSE calls are not rewritten, and that RECURSE calls belonging to any nested RECURSIVE invocation are not accidentally treated.
 
Anonymous user