diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib.c | 10 |
2 files changed, 11 insertions, 5 deletions
@@ -1,5 +1,11 @@ 2012-08-29 Kaz Kylheku <kaz@kylheku.com> + * lib.c (multi_sort_less): Change the semantics so that when the + list of the functions is empty, the left item is considered less + than the right, thereby preserving the order. + +2012-08-29 Kaz Kylheku <kaz@kylheku.com> + * eval.c (mapcarv): Changed to external linkage. * eval.h (mapcarv): Declaration added. @@ -3996,20 +3996,20 @@ val sort(val seq, val lessfun, val keyfun) static val multi_sort_less(val funcs, val llist, val rlist) { - val less = nil; + val less = t; while (funcs) { val func = pop(&funcs); val left = pop(&llist); val right = pop(&rlist); - if (funcall2(func, left, right)) { - less = t; + if (funcall2(func, left, right)) break; - } - if (funcall2(func, right, left)) + if (funcall2(func, right, left)) { + less = nil; break; + } } return less; |