summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-12-29 00:26:21 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-12-29 00:26:21 -0800
commit4b772db7b36abc597d17d2c994227b5c032323ae (patch)
treeb5a9dd0346c859a3fe675fea31a4db28599d9bf2 /eval.c
parent9dae5ba49c7595355ddcf336032c2e12aa84be5f (diff)
downloadtxr-4b772db7b36abc597d17d2c994227b5c032323ae.tar.gz
txr-4b772db7b36abc597d17d2c994227b5c032323ae.tar.bz2
txr-4b772db7b36abc597d17d2c994227b5c032323ae.zip
shuffle/nshuffle: take optional random state argument.
* eval.c (eval_init): Register shuffle and nshuffle as two-argument functions with optional argument. * lib.c (nshuffle): Take random-state argument, defaulting to value of random_state special variable. (shuffle): Take random-state argument, pass down to nshuffle. * lib.h (shuffle, nshuffle): Declarations updated. * txr.1: Updated.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index aaf34aaf..a19524a6 100644
--- a/eval.c
+++ b/eval.c
@@ -6927,9 +6927,9 @@ void eval_init(void)
reg_fun(intern(lit("nsort"), user_package), func_n3o(nsort, 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("nshuffle"), user_package), func_n2o(nshuffle, 1));
reg_fun(intern(lit("shuffle"), user_package),
- func_n1(if3(opt_compat && opt_compat <= 237, nshuffle, shuffle)));
+ func_n2o(if3(opt_compat && opt_compat <= 237, nshuffle, shuffle), 1));
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));