From 2484f339278a684bab095d5c21d85b21d18b3d06 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 12 Feb 2012 19:03:21 -0800 Subject: * lib.c (lazy_flatten): Bugfix: function was assuming that the input is a list, and not handling the case atom -> (atom) like its non-lazy counterpart. This broke @(next :list expr). --- ChangeLog | 7 +++++++ lib.c | 18 +++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67ad8f13..39f38b2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-02-12 Kaz Kylheku + + * lib.c (lazy_flatten): Bugfix: function was assuming that + the input is a list, and not handling the case + atom -> (atom) like its non-lazy counterpart. + This broke @(next :list expr). + 2012-02-12 Kaz Kylheku * lib.c (obj_print): Print control characters in string and diff --git a/lib.c b/lib.c index 1e39f77d..94cb19d3 100644 --- a/lib.c +++ b/lib.c @@ -729,13 +729,17 @@ static val lazy_flatten_func(val env, val lcons) val lazy_flatten(val list) { - val escape = nil; - val next = lazy_flatten_scan(list, &escape); + if (atom(list)) { + return cons(list, nil); + } else { + val escape = nil; + val next = lazy_flatten_scan(list, &escape); - if (!next) - return nil; + if (!next) + return nil; - return make_lazy_cons(func_f1(cons(next, escape), lazy_flatten_func)); + return make_lazy_cons(func_f1(cons(next, escape), lazy_flatten_func)); + } } cnum c_num(val num); @@ -3875,7 +3879,7 @@ val obj_print(val obj, val out) } return obj; case LSTR: - format(out, lit("#"), obj->ls.prefix); + format(out, lit("#"), obj->ls.prefix, nao); return obj; case COBJ: obj->co.ops->print(obj, out); @@ -3970,7 +3974,7 @@ val obj_pprint(val obj, val out) } return obj; case LSTR: - format(out, lit("#"), obj->ls.prefix); + format(out, lit("#"), obj->ls.prefix, nao); return obj; case COBJ: obj->co.ops->print(obj, out); -- cgit v1.2.3