summaryrefslogtreecommitdiffstats
path: root/stdlib
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-10-26 07:46:17 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-10-26 07:46:17 -0700
commitf32a5ba6ac37703987772560b57aa0dcace0c598 (patch)
treed960eca68c0793c1443f62d4cd7b49d6a9cee164 /stdlib
parent30638a91a2c47acd08cf67735eac31e5adcf4eba (diff)
downloadtxr-f32a5ba6ac37703987772560b57aa0dcace0c598.tar.gz
txr-f32a5ba6ac37703987772560b57aa0dcace0c598.tar.bz2
txr-f32a5ba6ac37703987772560b57aa0dcace0c598.zip
ifa: take advantage of read-once.
* stdlib/ifa.tl (ifa): When the form bound to the it anaphoric variable is a place, such that we use placelet, wrap the place in (read-once ...) so that multiple evaluations of it don't cause multiple accesses of the place. * txr.1: Documented.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/ifa.tl2
1 files changed, 1 insertions, 1 deletions
diff --git a/stdlib/ifa.tl b/stdlib/ifa.tl
index eaab6f3a..317ef9e7 100644
--- a/stdlib/ifa.tl
+++ b/stdlib/ifa.tl
@@ -54,7 +54,7 @@
(let* ((btemps (mapcar (ret (gensym)) before-it))
(atemps (mapcar (ret (gensym)) after-it)))
^(let (,*(zip btemps before-it))
- (placelet ((it ,it-form))
+ (placelet ((it (read-once ,it-form)))
(let (,*(zip atemps after-it))
(if (,sym ,*(if (eq 'dwim sym) ^(,(second test)))
,*btemps it ,*atemps)