From f4eb0c2e7c11c6ec77304dc2c798c15bc2971cfd Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 29 Aug 2012 21:44:09 -0700 Subject: * 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. --- lib.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib.c') 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; -- cgit v1.2.3