diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-25 07:18:34 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-25 07:18:34 -0700 |
commit | 1adad3382e607bd91a47d6411d6f23095c4c7234 (patch) | |
tree | 4e2aa039335079171506039eab82e19d102d671d | |
parent | 7f4a45366c57d0e381dde8d7639b0eee31749b70 (diff) | |
download | txr-1adad3382e607bd91a47d6411d6f23095c4c7234.tar.gz txr-1adad3382e607bd91a47d6411d6f23095c4c7234.tar.bz2 txr-1adad3382e607bd91a47d6411d6f23095c4c7234.zip |
Fix two bugs in ifa macro.
* share/txr/stdlib/ifa.tl (ifa): Misplaced parentheses
in mapcar call were causing the lists of before and after
temporary variables to come up empty, resulting in a
misexpansion (in the case when the it-argument is a place).
Also, before and after temporaries swapped in the
expansion: afters were inserted before the it-argument
and vice-versa.
-rw-r--r-- | share/txr/stdlib/ifa.tl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/share/txr/stdlib/ifa.tl b/share/txr/stdlib/ifa.tl index c6a9abd2..aa406bbd 100644 --- a/share/txr/stdlib/ifa.tl +++ b/share/txr/stdlib/ifa.tl @@ -50,12 +50,12 @@ (is-place (place-form-p it-form e))) (let ((before-it [args 0..pos-candidate]) (after-it [args (succ pos-candidate)..:])) - (let* ((btemps (mapcar (ret (gensym) before-it))) - (atemps (mapcar (ret (gensym) after-it)))) + (let* ((btemps (mapcar (ret (gensym)) before-it)) + (atemps (mapcar (ret (gensym)) after-it))) ^(let (,*(zip btemps before-it)) (placelet ((it ,it-form)) (let (,*(zip atemps after-it)) - (if (,sym ,*atemps it ,*btemps) + (if (,sym ,*btemps it ,*atemps) ,then ,else)))))) (let* ((temps (mapcar (ret (gensym)) args)) (it-temp [temps pos-candidate])) |