diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-02-14 02:26:50 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-02-14 02:26:50 -0800 |
commit | 05e2a6ded3024718a62e367d28d6fca200faf3d0 (patch) | |
tree | 2b7e58395e246435393cb316606b446799eba6ae /eval.c | |
parent | 0724ed01b5190fcebf0249f81cf79064c472ee91 (diff) | |
download | txr-05e2a6ded3024718a62e367d28d6fca200faf3d0.tar.gz txr-05e2a6ded3024718a62e367d28d6fca200faf3d0.tar.bz2 txr-05e2a6ded3024718a62e367d28d6fca200faf3d0.zip |
* eval.c (rangev_func, rangev, range_star_v_func,
range_star_v): Regression: handle the case where the range is
open-ended (to is nil).
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1673,8 +1673,9 @@ static val rangev_func(val env, val lcons) rplaca(lcons, from); if (eql(from, to) || - (lt(from, to) && gt(next, to)) || - (gt(from, to) && lt(next, to))) + (to && + ((lt(from, to) && gt(next, to)) || + (gt(from, to) && lt(next, to))))) { rplacd(lcons, nil); return nil; @@ -1690,7 +1691,7 @@ static val rangev(val args) uses_or2; val from = or2(first(args), zero); val to = second(args); - val step = or2(third(args), if3(le(from, to), one, negone)); + val step = or2(third(args), if3(to && gt(from, to), negone, one)); val env = cons(from, cons(to, step)); return make_lazy_cons(func_f1(env, rangev_func)); @@ -1707,8 +1708,9 @@ static val range_star_v_func(val env, val lcons) rplaca(lcons, from); if (eql(next, to) || - (lt(from, to) && gt(next, to)) || - (gt(from, to) && lt(next, to))) + (to && + ((lt(from, to) && gt(next, to)) || + (gt(from, to) && lt(next, to))))) { rplacd(lcons, nil); return nil; @@ -1728,7 +1730,7 @@ static val range_star_v(val args) if (eql(from, to)) { return nil; } else { - val step = or2(third(args), if3(le(from, to), one, negone)); + val step = or2(third(args), if3(to && gt(from, to), negone, one)); val env = cons(from, cons(to, step)); return make_lazy_cons(func_f1(env, range_star_v_func)); |