diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib.c | 6 |
2 files changed, 9 insertions, 2 deletions
@@ -1,5 +1,10 @@ 2012-08-29 Kaz Kylheku <kaz@kylheku.com> + * lib.c (multi_sort_less): Fixing semantics of return value. Individual + sorted lists are returned, rather than a list of zipped tuples. + +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. @@ -4017,12 +4017,14 @@ static val multi_sort_less(val funcs, val llist, val rlist) val multi_sort(val funcs, val lists) { - val lol = mapcarv(func_n0v(identity), lists); + val tuples = mapcarv(func_n0v(identity), lists); if (functionp(funcs)) funcs = cons(funcs, nil); - return sort_list(lol, func_f2(funcs, multi_sort_less), identity_f); + tuples = sort_list(tuples, func_f2(funcs, multi_sort_less), identity_f); + + return mapcarv(func_n0v(identity), tuples); } val find(val item, val list, val testfun, val keyfun) |