summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--lib.c10
2 files changed, 11 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index bdea0b40..07704dd2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/lib.c b/lib.c
index 7c15a864..69de8369 100644
--- a/lib.c
+++ b/lib.c
@@ -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;