diff options
-rw-r--r-- | eval.c | 6 | ||||
-rw-r--r-- | share/txr/stdlib/getopts.tl | 6 | ||||
-rw-r--r-- | txr.1 | 20 |
3 files changed, 27 insertions, 5 deletions
@@ -6893,9 +6893,11 @@ void eval_init(void) reg_fun(intern(lit("improper-plist-to-alist"), user_package), func_n2(improper_plist_to_alist)); reg_fun(intern(lit("merge"), user_package), func_n4o(merge_wrap, 2)); reg_fun(intern(lit("nsort"), user_package), func_n3o(nsort, 1)); - reg_fun(intern(lit("sort"), user_package), func_n3o(sort, 1)); + reg_fun(intern(lit("sort"), user_package), + func_n3o(if3(opt_compat && opt_compat <= 237, nsort, sort), 1)); reg_fun(intern(lit("nshuffle"), user_package), func_n1(nshuffle)); - reg_fun(intern(lit("shuffle"), user_package), func_n1(shuffle)); + reg_fun(intern(lit("shuffle"), user_package), + func_n1(if3(opt_compat && opt_compat <= 237, nshuffle, shuffle))); reg_fun(intern(lit("find"), user_package), func_n4o(find, 2)); reg_fun(intern(lit("rfind"), user_package), func_n4o(rfind, 2)); reg_fun(intern(lit("find-if"), user_package), func_n3o(find_if, 2)); diff --git a/share/txr/stdlib/getopts.tl b/share/txr/stdlib/getopts.tl index db8f793f..5a937f84 100644 --- a/share/txr/stdlib/getopts.tl +++ b/share/txr/stdlib/getopts.tl @@ -269,9 +269,9 @@ opr.(parse-opts args))) (defun opthelp (opt-desc-list : (stream *stdout*)) - (let ((sorted [sort (remove-if (op null @1.helptext) - opt-desc-list) : - (do if @1.long @1.long @1.short)]) + (let ((sorted [nsort (copy-list (remove-if (op null @1.helptext) + opt-desc-list)) : + (do if @1.long @1.long @1.short)]) (undocumented (keep-if (op null @1.helptext) opt-desc-list))) (put-line "\nOptions:\n") (each ((od sorted)) @@ -32632,6 +32632,13 @@ The behavior of .code sort is not specified for hashes whose contents do not conform to this convention. +Note: +.code nsort +was introduced in \*(TX 238. Prior to that version, +.code sort +behaved like +.codn nsort . + .coNP Function @ grade .synb .mets (grade < sequence >> [ lessfun <> [ keyfun ]]) @@ -32719,6 +32726,13 @@ were made using .code copy and then that copy were shuffled in-place and returned. +Note: +.code nshuffle +was introduced in \*(TX 238. Prior to that version, +.code shuffle +behaved like +.codn nshuffle . + .coNP Function @ sort-group .synb .mets (sort-group < sequence >> [ keyfun <> [ lessfun ]]) @@ -73404,6 +73418,12 @@ of these version values, the described behaviors are provided if is given an argument which is equal or lower. For instance .code "-C 103" selects the behaviors described below for version 105, but not those for 102. +.IP 237 +Compatibility values of 237 or lower restore the destructive behavior of the +.code sort +and +.code shuffle +functions. .IP 234 In \*(TX 234 and older versions, the exception throwing functions .code throw |