summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-02-12 19:03:21 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-02-12 19:03:21 -0800
commit2484f339278a684bab095d5c21d85b21d18b3d06 (patch)
tree3ee2df00cf1977775e58b0e65ebc982b00ecab46 /lib.c
parentc056272954ddc5af1c61bb7c174bdccaf208f1a1 (diff)
downloadtxr-2484f339278a684bab095d5c21d85b21d18b3d06.tar.gz
txr-2484f339278a684bab095d5c21d85b21d18b3d06.tar.bz2
txr-2484f339278a684bab095d5c21d85b21d18b3d06.zip
* 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).
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c18
1 files changed, 11 insertions, 7 deletions
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("#<lazy-string: ~s>"), obj->ls.prefix);
+ format(out, lit("#<lazy-string: ~s>"), 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("#<lazy-string: ~a>"), obj->ls.prefix);
+ format(out, lit("#<lazy-string: ~a>"), obj->ls.prefix, nao);
return obj;
case COBJ:
obj->co.ops->print(obj, out);