summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-10-26 07:48:38 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-10-26 07:48:38 -0700
commitcb8bde8655411c0bf3c9e4196f4a44b671022cd8 (patch)
tree52bd4731de10a2454c319e10812e6539cdc94634
parentbf96924d0781b62ea447a01e9bc7a395f0bf609d (diff)
downloadtxr-cb8bde8655411c0bf3c9e4196f4a44b671022cd8.tar.gz
txr-cb8bde8655411c0bf3c9e4196f4a44b671022cd8.tar.bz2
txr-cb8bde8655411c0bf3c9e4196f4a44b671022cd8.zip
pic: use ifa to remove repeated array access.
* stdlib/pic.tl (insert-commas): Use ifa to bind the anaphoric variable it to [num (pred i)]. With the new ifa behavior involving read-place, this now prevents two accesses to the array.
-rw-r--r--stdlib/pic.tl4
1 files changed, 2 insertions, 2 deletions
diff --git a/stdlib/pic.tl b/stdlib/pic.tl
index 7ca898a7..e66ecdfd 100644
--- a/stdlib/pic.tl
+++ b/stdlib/pic.tl
@@ -78,8 +78,8 @@
(string-extend out [num i])))
(when (plusp i)
(when (< j pn)
- (if (meq [num (pred i)] #\space #\- #\+)
- (set comma [num (pred i)]))
+ (ifa (meq [num (pred i)] #\space #\- #\+)
+ (set comma it))
(let ((pj [positions j]))
(cond
((eql pj p)