diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-02-07 23:29:29 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-02-07 23:29:29 -0800 |
commit | a2423f718441993e2a6a010fb13e1b84298424a2 (patch) | |
tree | 2a5b1946dcc30c9e76ddf17d8e7bce921f5dbc43 /txr.1 | |
parent | 0b61d9479935eef88ca2ebc2fad6a83a11f3e48e (diff) | |
download | txr-a2423f718441993e2a6a010fb13e1b84298424a2.tar.gz txr-a2423f718441993e2a6a010fb13e1b84298424a2.tar.bz2 txr-a2423f718441993e2a6a010fb13e1b84298424a2.zip |
* eval.c (nperm_while_fun, nperm_gen_fun, nperm_list,
nperm_vec_gen_fun, nperm_vec, nperm_str_gen_fun, nperm_str, nperm): New
static functions.
(eval_init): nperm registered as intrinsic.
* txr.1: Documented nperm function.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -7869,6 +7869,42 @@ cached inside <promise> and returned, becoming the return value of the force function call. If the force function is invoked additional times on the same promise, the cached value is retrieved. +.SS Function perm + +.TP +Syntax: + + (rperm <seq> <len>) + +.TP +Description: + +The rperm function returns a lazy list which consists of all the repeating +permutations of length <len> formed by items taken from <seq>. +"Repeating" means that the items from <seq> can appear more than +once in the permutations. + +Argument <len> must be a positive integer, and <seq> must be a sequence. + +If <seq> is empty, or if <len> is zero, then the empty list is returned. + +Otherwise permutations are returned which are sequences of the same kind as +<seq>. + +The first permutation consists of <len> repetitions of the first element of +<seq>. The next repetition, if there is one, differs from the first +repetition in that its last element is the second element of <seq>. + +.TP +Examples: + + (rperm "01" 4) -> ("000" "001" "010" "011" "100" "101" "110" "111") + + (rperm #(1) 3) -> (#(1 1 1)) + + (rperm '(0 1 2) 2) -> ((0 0) (0 1) (0 2) (1 0) (1 1) (1 2) (2 0) (2 1) (2 2)) + + .SH CHARACTERS AND STRINGS .SS Function mkstring |