chickadee » combinatorics » ordered-subset-map

ordered-subset-map f listprocedure
ordered-subset-map f list kprocedure

Map every k-permutation (partial ordered subset) of list using f.

f
The mapping function
list
The list to map
k
k distinct elements (default: n)
(define ordered-subset-map
  (case-lambda
    ((f list) (ordered-subset-map f list (length list)))
    ((f list k)
     (ordered-subset-fold (lambda (v a) (cons (f v) a)) '() list k))))