From 31d83dd218952bf03b3f8131d88e375cd63a4e00 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 15 Jun 2014 19:35:38 -0700 Subject: Bugfix: range and range* broken when "to" argument is omitted. This was broken in version 89, by the 2014-04-08 commit. * eval.c (rangev_func, range_star_v_func): Only perform numeric tests between from and to if to is not nil. --- ChangeLog | 9 +++++++++ eval.c | 10 +++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d0d803d0..8c706c2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2014-06-15 Kaz Kylheku + + Bugfix: range and range* broken when "to" argument is + omitted. This was broken in version 89, by the + 2014-04-08 commit. + + * eval.c (rangev_func, range_star_v_func): Only perform + numeric tests between from and to if to is not nil. + 2014-06-12 Kaz Kylheku * Makefile: Install share/txr/stdlib/*.txr material. diff --git a/eval.c b/eval.c index bbae73a6..3fcad2d9 100644 --- a/eval.c +++ b/eval.c @@ -2789,8 +2789,8 @@ static val rangev_func(val env, val lcons) rplaca(lcons, from); - if (numeq(from, to) || - (to && + if (to && + (numeq(from, to) || ((lt(from, to) && gt(next, to)) || (gt(from, to) && lt(next, to))))) { @@ -2823,10 +2823,10 @@ static val range_star_v_func(val env, val lcons) rplaca(lcons, from); - if (numeq(next, to) || - (to && + if (to && + (numeq(next, to) || ((lt(from, to) && gt(next, to)) || - (gt(from, to) && lt(next, to))))) + (gt(from, to) && lt(next, to))))) { rplacd(lcons, nil); return nil; -- cgit v1.2.3