From c4313b5b2df139dcee040b3b83333f9099a8e4c1 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 26 Oct 2021 07:48:38 -0700 Subject: 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. --- stdlib/pic.tl | 4 ++-- 1 file 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) -- cgit v1.2.3