summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-01-25 08:39:15 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-01-25 08:39:15 -0800
commit4ec024cdc9544c244cbd8b630e8f631fc05c6075 (patch)
tree734ab15e190ec426499c25cc00a79045b92d2fc2 /lib.c
parent6c9893d4790f1a27c900b2d84a3532ae7c402463 (diff)
downloadtxr-4ec024cdc9544c244cbd8b630e8f631fc05c6075.tar.gz
txr-4ec024cdc9544c244cbd8b630e8f631fc05c6075.tar.bz2
txr-4ec024cdc9544c244cbd8b630e8f631fc05c6075.zip
* eval.c (eval_init): Register dupl and swap_12_21 as
the dup and flip intrinsics. * lib.c (do_dup): New static function. (dupl): New function. * lib.h (dupl): Declared. * txr.1: Documented dup and flip.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 41a9c29f..7c857423 100644
--- a/lib.c
+++ b/lib.c
@@ -4756,6 +4756,16 @@ val iffi(val condfun, val thenfun, val elsefun)
return func_f0v(cons(condfun, cons(thenfun, elsefun)), do_iff);
}
+static val do_dup(val fun, val arg)
+{
+ return funcall2(fun, arg, arg);
+}
+
+val dupl(val fun)
+{
+ return func_f1(fun, do_dup);
+}
+
val vector(val length, val initval)
{
int i;