diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-08-29 21:50:42 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-08-29 21:50:42 -0700 |
commit | 81482a2540aeecb1a7cfa56b5f7fb64e841c77c6 (patch) | |
tree | 1c26d6e8cd953786e18f5cf519b2cc74b3a9b0fd | |
parent | f4eb0c2e7c11c6ec77304dc2c798c15bc2971cfd (diff) | |
download | txr-81482a2540aeecb1a7cfa56b5f7fb64e841c77c6.tar.gz txr-81482a2540aeecb1a7cfa56b5f7fb64e841c77c6.tar.bz2 txr-81482a2540aeecb1a7cfa56b5f7fb64e841c77c6.zip |
* lib.c (multi_sort_less): Fixing semantics of return value. Individual
sorted lists are returned, rather than a list of zipped tuples.
-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) |