diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-10-09 22:10:35 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-10-09 22:10:35 -0700 |
commit | 35c830aa764e6e456530ed9d18ff5a686d10d96c (patch) | |
tree | f7825de25f8c7a365c4a22ff2bdabc8b9fed2e13 /eval.c | |
parent | 29ccb2c2b33dd4b8d628d0499fa46799f6762ddb (diff) | |
download | txr-35c830aa764e6e456530ed9d18ff5a686d10d96c.tar.gz txr-35c830aa764e6e456530ed9d18ff5a686d10d96c.tar.bz2 txr-35c830aa764e6e456530ed9d18ff5a686d10d96c.zip |
Improve progn expansion.
* eval.c (do_expand): Reduce (progn) to nil,
and (progn single) to single.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -3176,11 +3176,20 @@ tail: goto tail; } else if (sym == progn_s) { val args = rest(form); - val args_ex = expand_progn(args, menv); - if (args == args_ex) - return form; - return rlcp(cons(sym, args_ex), form); + if (cdr(args)) { + val args_ex = expand_progn(args, menv); + + if (args == args_ex) + return form; + + if (cdr(args_ex)) + return rlcp(cons(sym, args_ex), form); + + return car(args_ex); + } + form = first(args); + goto tail; } else if (sym == sys_lisp1_value_s) { return expand_lisp1_value(form, menv); } else { |