summaryrefslogtreecommitdiffstats
path: root/tree.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-10-03 20:06:49 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-10-03 20:06:49 -0700
commita7f158174e41155a119f8762f2bb36def24cb828 (patch)
tree55fd301b41af600d8834b8ba9b58a861c16ede7a /tree.h
parentb83615f69af7f971d440b0d02db85f24afe9e39c (diff)
downloadtxr-a7f158174e41155a119f8762f2bb36def24cb828.tar.gz
txr-a7f158174e41155a119f8762f2bb36def24cb828.tar.bz2
txr-a7f158174e41155a119f8762f2bb36def24cb828.zip
op: new features for anonymous recursion.
Within the op syntax, the new implicit variable @rec now refers to the function itself. There is also @(rec ...) for calling the function through a function binding. For instance, here is Fibonacci: (do if (> @1 1) (+ @(rec (pred @1)) @(rec (ppred @1))) 1) * share/txr/stdlib/op.tl (sys:op-ctx): New slots rec and recvar. (sys:op-rec-p, sys:op-ensure-rec): New functions. (sys:op-alpha-rename): Check for the new syntaxes and translate to appropriate gensymed expressions, while updating the context structure, so the expander is informed about the @rec or @(rec ...) activity in the expression. (sys:op-expand): Check whether @rec or @(rec ...) has been used in the expression, and generate the necessary variants to support it. We need to bind the lambda to a recursive binding using the same mechanism that labels uses, and possibly to bind the gensym underneat @rec to the value of that function binding. * txr.1: op documentation extended to cover the new feature, plus some wording improvements.
Diffstat (limited to 'tree.h')
0 files changed, 0 insertions, 0 deletions