summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-12-14 19:33:55 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-12-14 19:33:55 -0800
commit89baf71c475f494c139df7c7f29a593b5a0f7d61 (patch)
tree58aa92761daf62600ec53d3dc147476eca511d98 /lib.c
parent93e4c50d09dcc20d7b244b66987f869143d45dd0 (diff)
downloadtxr-89baf71c475f494c139df7c7f29a593b5a0f7d61.tar.gz
txr-89baf71c475f494c139df7c7f29a593b5a0f7d61.tar.bz2
txr-89baf71c475f494c139df7c7f29a593b5a0f7d61.zip
* lib.c (car, cdr): Set the lazy cons function to nil
after calling it. (rplacd): Do not set the lazy cons function to nil in. * txr.1: Documented a bunch of functions.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index ac21e04d..8e1652e7 100644
--- a/lib.c
+++ b/lib.c
@@ -184,6 +184,7 @@ val car(val cons)
return cons->lc.car;
} else {
funcall1(cons->lc.func, cons);
+ cons->lc.func = nil;
return cons->lc.car;
}
default:
@@ -203,6 +204,7 @@ val cdr(val cons)
return cons->lc.cdr;
} else {
funcall1(cons->lc.func, cons);
+ cons->lc.func = nil;
return cons->lc.cdr;
}
default:
@@ -229,7 +231,6 @@ val rplacd(val cons, val new_cdr)
case CONS:
return cons->c.cdr = new_cdr;
case LCONS:
- cons->lc.func = nil;
return cons->lc.cdr = new_cdr;
default:
type_mismatch(lit("~s is not a cons"), cons, nao);