summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-12-23 09:17:27 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-12-23 09:17:27 -0800
commitcbdbb602b8b821e2d353ad29e7d91796e87ef556 (patch)
tree31c4c981276e350af2e5c498e71542ab5d0a0e3b /txr.1
parente68f3828d79d16d2afc929c83d499e8e2e0dd38a (diff)
downloadtxr-cbdbb602b8b821e2d353ad29e7d91796e87ef556.tar.gz
txr-cbdbb602b8b821e2d353ad29e7d91796e87ef556.tar.bz2
txr-cbdbb602b8b821e2d353ad29e7d91796e87ef556.zip
* eval.c (ap_s, ret_s, aret_s): New symbol variables.
(me_ret): Static function renamed to me_ret_aret. Handles ret and aret macro expansion. (eval_init): Initialize ap_s, ret_s and aret_s. Re-register ret macro using ret_s and bind to me_ret_aret. Register aret macro. * txr.1: Documented aret. * tl.vim, txr.vim: Regenerated.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.142
1 files changed, 42 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 70db9229..ac35cf22 100644
--- a/txr.1
+++ b/txr.1
@@ -20880,6 +20880,48 @@ and the expression
returns a function similar to
.codn (lambda (. rest) 42) .
+.coNP Macro @ aret
+.synb
+.mets (aret << form )
+.syne
+.desc
+The
+.code ret
+macro's
+.meta form
+argument is treated similarly to the second and subsequent arguments of the
+.code op
+operator.
+
+The
+.code aret
+macro produces a function which takes any number of arguments,
+and returns the value specified by
+.metn form .
+
+.meta form
+can contain
+.code ap
+meta syntax like
+.meta @n
+and
+.codn @rest .
+
+The following equivalence holds:
+
+.cblk
+ (aret x) <--> (ap identity x))
+.cble
+
+Thus the expression
+.code (aret @2)
+returns a function similar to
+.codn (lambda (. rest) (second rest)) ,
+and the expression
+.code (aret 42)
+returns a function similar to
+.codn (lambda (. rest) 42) .
+
.coNP Functions @ chain and @ chand
.synb
.mets (chain << func *)