summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-24 06:37:19 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-24 06:37:19 -0700
commit4e3e4e1ccc60331ff8ff4c1c139e9da3c95e2272 (patch)
tree05869854697db857750edeb23b091c39983a4e1e /txr.1
parent87af2fde6249070addbed571482ddae251d90161 (diff)
downloadtxr-4e3e4e1ccc60331ff8ff4c1c139e9da3c95e2272.tar.gz
txr-4e3e4e1ccc60331ff8ff4c1c139e9da3c95e2272.tar.bz2
txr-4e3e4e1ccc60331ff8ff4c1c139e9da3c95e2272.zip
New function: shuffle.
* eval.c (eval_init): Register shuffle as intrinsic. * lib.c (shuffle): New function. * lib.h (shuffle): Declared.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.121
1 files changed, 21 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 33fe9c35..374e1f31 100644
--- a/txr.1
+++ b/txr.1
@@ -19544,6 +19544,27 @@ For strings and vectors,
.code sort
is not stable.
+.coNP Function @ shuffle
+.synb
+.mets (shuffle << sequence )
+.syne
+.desc
+The
+.code shuffle
+function pseudo-randomly rearranges the elements of
+.metn sequence .
+This is performed in place:
+.meta sequence
+object is modified.
+
+The return value is
+.meta sequence
+itself.
+
+The rearrangement depends on pseudo-random numbers obtained from the
+.code rand
+function.
+
.coNP Function @ sort-group
.synb
.mets (sort-group < sequence >> [ keyfun <> [ lessfun ]])