From eaa457213d49600c5e1fd34dcbeb17d4716aea41 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 24 Nov 2015 20:14:13 -0800 Subject: 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. --- lib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib.c') diff --git a/lib.c b/lib.c index 30636c66..751d8a3b 100644 --- a/lib.c +++ b/lib.c @@ -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); -- cgit v1.2.3