diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-11-24 20:14:13 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-11-24 20:14:13 -0800 |
commit | eaa457213d49600c5e1fd34dcbeb17d4716aea41 (patch) | |
tree | a72e8ea4b6e6cb456e91078c65f947eaf3fee2e8 | |
parent | e9ac435a6c1904ce8f000b13087ebc179f3e430e (diff) | |
download | txr-eaa457213d49600c5e1fd34dcbeb17d4716aea41.tar.gz txr-eaa457213d49600c5e1fd34dcbeb17d4716aea41.tar.bz2 txr-eaa457213d49600c5e1fd34dcbeb17d4716aea41.zip |
Bugfix: split and partition functions.
When the index argument is a function and it returns
an empty list, the functions behave incorrectly.
* lib.c (partition_split_common): Exchange order
of two operations. The handling of an empty indices list must
be done after testing for and calling the function which can
potentially produce that value.
-rw-r--r-- | lib.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1936,12 +1936,12 @@ static val partition_split_common(val seq, val indices, val partition_p) if (!seq) return nil; - if (!indices) - return cons(seq, nil); - if (functionp(indices)) indices = funcall1(indices, seq); + if (!indices) + return cons(seq, nil); + if (atom(indices)) indices = cons(indices, nil); |