From cea64abd457aa9907320806d7fefadfb421f1ef4 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 21 Sep 2016 06:42:10 -0700 Subject: Use rlet in a few place macros for better code. * share/txr/stdlib/place.tl (pset, push, pushnew): Use rlet for binding the assigned or pushed value to a temporary, so the temporary can disappear if the value is a constant. --- share/txr/stdlib/place.tl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl index 61654509..49da5653 100644 --- a/share/txr/stdlib/place.tl +++ b/share/txr/stdlib/place.tl @@ -225,7 +225,7 @@ pvtgs '(nil nil))) (lets (first ls)) (stores (second ls)) - (body-form ^(let (,*lets) ,*stores))) + (body-form ^(rlet (,*lets) ,*stores))) (reduce-left (tb (accum-form (place value temp getter setter)) (call-update-expander getter setter place env accum-form)) @@ -287,7 +287,7 @@ (defmacro push (new-item place :env env) (with-gensyms (new-sym) - ^(let ((,new-sym ,new-item)) + ^(rlet ((,new-sym ,new-item)) ,(with-update-expander (getter setter) place env ^(,setter (cons ,new-sym (,getter))))))) @@ -302,7 +302,7 @@ (keyfun :)) (with-update-expander (getter setter) place env (with-gensyms (new-item-sym old-list-sym) - ^(let ((,new-item-sym ,new-item)) + ^(rlet ((,new-item-sym ,new-item)) ,(with-update-expander (getter setter) place env ^(let ((,old-list-sym (,getter))) (if (member ,new-item-sym ,old-list-sym ,testfun ,keyfun) -- cgit v1.2.3