(html (head (title "sph-lib (sph list other)") (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 list other)") (div (p "additional list processing bindings that depend on libraries that depend on (sph list). to avoid circular dependencies") (p "part of " (a (@ (href "../../sph-lib.html")) "sph-lib")) (#f (section (@ (class "library-name")) (h1 "module name") (p "(sph list other)")) (section (@ (class "library-exports")) (h1 "exported bindings") (div (div (@ (class "doc-bindings")) (div (@ (id "doc-b-" "group") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "group") " " (span (@ (class "first-sig")) "a [accessor] ->")) (div (@ (class "rest-sig")) (div "list [procedure:{any -> any}] -> ((any:group-key any:group-value ...):group ...)")) (div (@ (class "description")) (("groups entries by unique result values of accessor." (br) "by default accessor is identity and groups equal elements." (br) "returns an association list with one entry for each group with the value as key and related values as value")))) (div (@ (id "doc-b-" "group-recursively") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "group-recursively") " " (span (@ (class "first-sig")) "a [accessor] ->")) (div (@ (class "rest-sig")) (div "((any ...) ...) [procedure] -> list")) (div (@ (class "description")) (("group lists and the elements of groups until no further sub-groups are possible." (br) "the default accessor is \\\"first\\\"." (br) "# example" (br) " (group-recursively (list (list 1 2 3) (list 1 2 6) (list 1 4 7) (list 8 9)) first)" (br) " -> ((1 (2 3 6) (4 7)) (8 9))" (br) "note in the example input how the entries after 1 2 have been grouped into (2 3 6)" (br) "# example use case" (br) "converting a list of filesystem paths split at slashes to a nested list where prefixes are directories")))) (div (@ (id "doc-b-" "list-ref-random") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-ref-random") " " (span (@ (class "first-sig")) "a [random-state] ->")) (div (@ (class "rest-sig")) (div "list -> any")) (div (@ (class "description")) (("retrieve a random element of a list")))) (div (@ (id "doc-b-" "list-ref-randomise-cycle") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-ref-randomise-cycle") " " (span (@ (class "first-sig")) "a [random-state] ->")) (div (@ (class "rest-sig")) (div "list -> procedure:{ -> any}")) (div (@ (class "description")) (("gives a procedure that when called gives the next element from a randomised version of \\\"a\\\"" (br) "when the end of the list has been reached, the list is reset to a newly randomised version of \\\"a\\\"")))) (div (@ (id "doc-b-" "list-replace-from-hashtable") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-replace-from-hashtable") " " (span (@ (class "first-sig")) "a ht ->")) (div (@ (class "rest-sig")) (div "list rnrs-hashtable -> list")) (div (@ (class "description")) (("replaces elements in list that exist as key in a hashtable with the associated value." (br) "if the value is a list, the element is either removed (empty list) or replaced with multiple elements")))) (div (@ (id "doc-b-" "randomise") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "randomise") " " (span (@ (class "first-sig")) "a [random-state] ->")) (div (@ (class "rest-sig")) (div "list -> list")) (div (@ (class "description")) (("return a new list with the elements of list in random order." (br) "algorithm: connect a random number to each element, re-sort list corresponding to the random numbers.")))) (div (@ (id "doc-b-" "sph-list-other-description") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "sph-list-other-description")) "" "")))))))) ()))