(html (head (title "sph-lib (sph selection)") (link (@ (rel "stylesheet") (type "text/css") (href "/css/sph.css"))) (meta (@ (name "viewport") (content "width=device-width,initial-scale=1"))) #f) (body () (div (@ (class top)) (nav (a (@ (href "/")) "start") ", " (a (@ (href "/feed.xml")) "feed")) "") (div (@ (class "middle")) (div (@ (class mtime) (title "last modification time of the current page")) "2023-04-05") (section (h1 "(sph selection)") (div (p "create and analyse set selections: permutations, combinations and similar") (p "part of " (a (@ (href "../../sph-lib.html")) "sph-lib")) (#f (section (@ (class "library-name")) (h1 "module name") (p "(sph selection)")) (section (@ (class "library-exports")) (h1 "exported bindings") (div (div (@ (class "doc-bindings")) (div (@ (id "doc-b-" "divisions") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "divisions") " " (span (@ (class "first-sig")) "count ->")) (div (@ (class "rest-sig")) (div "integer -> ((integer ...) ...)")) (div (@ (class "description")) (("returns the compositions." (br) "return all integer selections that sum to count." (br) "distinctness is defined by length, order and value." (br) "example for count 3: ((1 1 1) (1 2) (2 1) (3))" (br) "algorithm:" (br) " collect all possible values and associate a rest value that following values have to sum to." (br) " for each of those associations, reduce the rest value and the list of possible values while producing possible tails." (br) " the rest values are removed after all combinations have been found")))) (div (@ (id "doc-b-" "number-divisions") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "number-divisions") " " (span (@ (class "first-sig")) "b count ->")) (div (@ (class "rest-sig")) (div "number integer -> ((number ...) ...)")) (div (@ (class "description")) (("return all selections of multiples of b divided by count that sum to b." (br) "distinctness is defined by length, order and value." (br) "example" (br) " b: 60, count: 3" (br) " result: ((20 20 20) (20 40) (40 20) (60))")))) (div (@ (id "doc-b-" "sph-selection-description") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "sph-selection-description")) "" "") (div (@ (id "doc-b-" "vector-distinct-count") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "vector-distinct-count") " " (span (@ (class "first-sig")) "a [min-width max-width] ->")) (div (@ (class "rest-sig")) (div "vector integer integer -> integer")) (div (@ (class "description")) (("count all distinct sub-vectors in a vector with lengths from min-width to max-width." (br) "distinctness is defined by length, order and value." (br) "how sub-vectors are counted:" (br) "#([1 2 3] 4)" (br) "#(1 [2 3 4])" (br) "#([1 2] 3 4)" (br) "#(1 [2 3] 4)" (br) "#(1 2 [3 4])")))) (div (@ (id "doc-b-" "vector-distinct-maximum") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "vector-distinct-maximum") " " (span (@ (class "first-sig")) "width [min-width] ->")) (div (@ (class "rest-sig")) (div "integer integer -> integer")) (div (@ (class "description")) (("calculate the maximum number of possible distinct tuples in a tuple up to width, optionally ignoring widths smaller than min-width")))) (div (@ (id "doc-b-" "vector-distinct-stream") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "vector-distinct-stream") " " (span (@ (class "first-sig")) "a [min-width max-width] ->")) "" "") (div (@ (id "doc-b-" "vector-numeric-increment-be") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "vector-numeric-increment-be") " " (span (@ (class "first-sig")) "a base ->")) (div (@ (class "rest-sig")) (div "vector integer -> vector")) (div (@ (class "description")) (("treat integers in a vector as digits of a number to \\\"base\\\" and increment it." (br) "the least significant digit is the last element of the vector." (br) "returns false if the maximum value has been reached")))) (div (@ (id "doc-b-" "vector-numeric-increment-be!") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "vector-numeric-increment-be!") " " (span (@ (class "first-sig")) "a base ->")) (div (@ (class "rest-sig")) (div "vector integer -> true/false")) (div (@ (class "description")) (("like \\\"vector-numeric-increment-be\\\" but modifies the input vector")))) (div (@ (id "doc-b-" "vector-numeric-increment-le") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "vector-numeric-increment-le") " " (span (@ (class "first-sig")) "a base ->")) (div (@ (class "rest-sig")) (div "vector integer -> vector")) (div (@ (class "description")) (("treat integers in a vector as digits of a number to \\\"base\\\" and increment it." (br) "the least significant digit is the first element of the vector." (br) "return false if the maximum value has been reached")))) (div (@ (id "doc-b-" "vector-numeric-increment-le!") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "vector-numeric-increment-le!") " " (span (@ (class "first-sig")) "a base ->")) (div (@ (class "rest-sig")) (div "vector integer -> true/false")) (div (@ (class "description")) (("like \\\"vector-numeric-increment-le\\\" but modifies the input vector")))) (div (@ (id "doc-b-" "vector-selection") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "vector-selection") " " (span (@ (class "first-sig")) "set-indices set ->")) (div (@ (class "rest-sig")) (div "vector:#(integer ...) vector -> vector")) (div (@ (class "description")) (("return a new vector of values at indices in set")))) (div (@ (id "doc-b-" "vector-selection-maximum") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "vector-selection-maximum") " " (span (@ (class "first-sig")) "set-length [selection-width] ->")) (div (@ (class "rest-sig")) (div "integer integer -> integer")) (div (@ (class "description")) (("calculate the maximum number of possible distinct selections from a set with length \\\"set-length\\\" and" (br) "optional \\\"selection-width\\\" which defaults to \\\"set-length\\\"")))) (div (@ (id "doc-b-" "vector-selections") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "vector-selections") " " (span (@ (class "first-sig")) "set [width] ->")) (div (@ (class "rest-sig")) (div "vector integer -> (vector ...)")) (div (@ (class "description")) (("return a list of all distinct selections of values from \\\"set\\\" with duplicate elements allowed. set can contain any datatype." (br) "the optional parameter \\\"width\\\" specifies the length of selections." (br) "for example, a width of two creates all possible two element selections of set." (br) "the default for \\\"width\\\" is the length of the set")))) (div (@ (id "doc-b-" "vector-selections-stream") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "vector-selections-stream") " " (span (@ (class "first-sig")) "selection [width] ->")) (div (@ (class "rest-sig")) (div "vector width -> stream")) (div (@ (class "description")) (("like vector-selections but returns an srfi-41-stream and calculates next results on demand"))))))))))) ()))