diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-11-29 11:55:22 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-11-29 11:55:22 -0800 |
commit | 9f599ce440d50fcb14ddde4fbf100d753a73e761 (patch) | |
tree | 9491b451818ddf97684c992d03c91cb699eec870 | |
parent | 25e4dce91bd88e97ba1620ad604fb98abff8a009 (diff) | |
download | txr-9f599ce440d50fcb14ddde4fbf100d753a73e761.tar.gz txr-9f599ce440d50fcb14ddde4fbf100d753a73e761.tar.bz2 txr-9f599ce440d50fcb14ddde4fbf100d753a73e761.zip |
Bugfix: split and partition again.
* lib.c (partition_split_common): nullify indices after
calling function, because function can put out an empty
sequence of non-list type. Use "not sequence" test
rather than "atom" on final index list, so that
vectors and strings can specify indices, as documented.
-rw-r--r-- | lib.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1932,7 +1932,6 @@ static val split_func(val env, val lcons) static val partition_split_common(val seq, val indices, val partition_p) { seq = nullify(seq); - indices = nullify(indices); if (!seq) return nil; @@ -1940,10 +1939,12 @@ static val partition_split_common(val seq, val indices, val partition_p) if (functionp(indices)) indices = funcall1(indices, seq); + indices = nullify(indices); + if (!indices) return cons(seq, nil); - if (atom(indices)) + if (!seqp(indices)) indices = cons(indices, nil); return make_lazy_cons(func_f1(cons(seq, cons(indices, zero)), |