This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Combinations­Cowan

cowan
2017-06-16 01:58:11
1history
source
make-permutation-generator vector

Returns a generator that yields random permutations of vector.

 
(generator->list (make-permutation-generator '(1 2 3)) 3)
 ⇒ ((1 2 3) (2 3 1) (3 2 1))

(generator->list (make-permutation-generator "abc") 3)
 ⇒ ("cba" "cba" "cab")
make-combination-generator size vector

Returns a generator that yields vectors of size elements randomly picked from vector.

 
(generator->list (make-combination-generatorh 2 #(a b c)) 5)
 ⇒ (#(a c) #(a b) #(a c) #(b a) #(a c))

(generator->list (make-combination-generator 2 '#(a b c)) 5)
 ⇒ (#(a c) #(b c) #(c b) #(b a) #(b c))