(html (head (title "sph-lib (sph alist)") (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 alist)") (div (p "association list processing") (p "part of " (a (@ (href "../../sph-lib.html")) "sph-lib")) (#f (section (@ (class "library-name")) (h1 "module name") (p "(sph alist)")) (section (@ (class "library-exports")) (h1 "exported bindings") (div (div (@ (class "doc-bindings")) (div (@ (id "doc-b-" "alist") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist") " " (span (@ (class "first-sig")) "key/value ... ->")) (div (@ (class "rest-sig")) (div "key/value ... -> alist")) (div (@ (class "description")) (("create an association list from the given arguments," (br) "mapping each argument alternatingly to key and value." (br) "(alist (quote a) 1 \\\"b\\\" 2 (quote c) 3)")))) (div (@ (id "doc-b-" "alist->list") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist->list") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "list -> list")) (div (@ (class "description")) (("convert an alist to a list that contains every alist key and value alternatingly." (br) "the inverse of list->alist." (br) "example: ((a . 1) (b . 2)) -> (a 1 b 2)")))) (div (@ (id "doc-b-" "alist-bind") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alist-bind") " " (span (@ (class "first-sig")) "alist (key ...) body ...")) "" (div (@ (class "description")) (("could allow for custom variable names for key values as an extension")))) (div (@ (id "doc-b-" "alist-bind-and*") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alist-bind-and*") " " (span (@ (class "first-sig")) "alist (key ...) body ...")) "" (div (@ (class "description")) (("alist values are bound in order of keys, and false is returned if any key value is false")))) (div (@ (id "doc-b-" "alist-cond") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-cond") " " (span (@ (class "first-sig")) "a alist ->")) (div (@ (class "rest-sig")) (div "any ((procedure:{any -> any/false} alist-tail ...) ...) -> alist-tail/false")) (div (@ (class "description")) (("like a cond expression but with an alist for the test conditions where the tail of the alist is returned for which the test suceeds.")))) (div (@ (id "doc-b-" "alist-contains") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-contains") " " (span (@ (class "first-sig")) "a key ->")) "" "") (div (@ (id "doc-b-" "alist-containsq") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-containsq") " " (span (@ (class "first-sig")) "a key ->")) "" "") (div (@ (id "doc-b-" "alist-containsv") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-containsv") " " (span (@ (class "first-sig")) "a key ->")) "" "") (div (@ (id "doc-b-" "alist-delete") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-delete") " " (span (@ (class "first-sig")) "key alist [k=] ->")) "" "") (div (@ (id "doc-b-" "alist-delete-multiple") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-delete-multiple") " " (span (@ (class "first-sig")) "a keys ... ->")) "" "") (div (@ (id "doc-b-" "alist-keys") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alist-keys") " " (span (@ (class "first-sig")) "alist")) "" (div (@ (class "description")) (("get all keys of an alist as a list")))) (div (@ (id "doc-b-" "alist-keys-map") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-keys-map") " " (span (@ (class "first-sig")) "proc a ->")) "" "") (div (@ (id "doc-b-" "alist-map") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-map") " " (span (@ (class "first-sig")) "proc a ->")) (div (@ (class "rest-sig")) (div "procedure:{key value -> any} list -> list")) "") (div (@ (id "doc-b-" "alist-merge") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-merge") " " (span (@ (class "first-sig")) "a b ->")) (div (@ (class "rest-sig")) (div "list list -> list")) (div (@ (class "description")) (("create a new alist with the associations of both alists, preferring entries of ")))) (div (@ (id "doc-b-" "alist-prepend") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-prepend") " " (span (@ (class "first-sig")) "a b c ->")) "" "") (div (@ (id "doc-b-" "alist-q") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alist-q") " " (span (@ (class "first-sig")) "key/value ...")) "" (div (@ (class "description")) (("only the keys are quoted")))) (div (@ (id "doc-b-" "alist-ref") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alist-ref") " " (span (@ (class "first-sig")) "a k d")) "" "") (div (@ (id "doc-b-" "alist-ref-q") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alist-ref-q") " " (span (@ (class "first-sig")) "a k d")) "" "") (div (@ (id "doc-b-" "alist-select") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-select") " " (span (@ (class "first-sig")) "alist keys ->")) (div (@ (class "rest-sig")) (div "list list -> list")) "") (div (@ (id "doc-b-" "alist-select-apply") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-select-apply") " " (span (@ (class "first-sig")) "a keys proc ->")) "" (div (@ (class "description")) (("list list procedure:{any:key-value ...} -> any" (br) "applies proc with all alist values for keys in order")))) (div (@ (id "doc-b-" "alist-select-q") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alist-select-q") " " (span (@ (class "first-sig")) "a key ...")) "" "") (div (@ (id "doc-b-" "alist-select-q-apply") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alist-select-q-apply") " " (span (@ (class "first-sig")) "a (key ...) proc")) "" "") (div (@ (id "doc-b-" "alist-set") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-set") " " (span (@ (class "first-sig")) "a key value ->")) (div (@ (class "rest-sig")) (div "list any any -> list")) (div (@ (class "description")) (("add or update an entry in an association list")))) (div (@ (id "doc-b-" "alist-set!") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-set!") " " (span (@ (class "first-sig")) "a b c ->")) "" "") (div (@ (id "doc-b-" "alist-set-multiple") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-set-multiple") " " (span (@ (class "first-sig")) "a key/value ... ->")) "" (div (@ (class "description")) (("list [any:key any:value] ..." (br) "update or add values in alist for specific keys." (br) "key and value are specified alternatingly")))) (div (@ (id "doc-b-" "alist-set-multiple-q") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alist-set-multiple-q") " " (span (@ (class "first-sig")) "a key/value ...")) "" (div (@ (class "description")) (("list [any:unquoted-key any:value] ...")))) (div (@ (id "doc-b-" "alist-update") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-update") " " (span (@ (class "first-sig")) "a b ->")) (div (@ (class "rest-sig")) (div "list list -> list")) (div (@ (class "description")) (("update existing entries of a with corresponding entries of b")))) (div (@ (id "doc-b-" "alist-update-multiple") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist-update-multiple") " " (span (@ (class "first-sig")) "a key/value ... ->")) "" (div (@ (class "description")) (("list [any:key any:value] ..." (br) "update values in alist for specific keys." (br) "key and value are specified alternatingly")))) (div (@ (id "doc-b-" "alist-update-multiple-q") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alist-update-multiple-q") " " (span (@ (class "first-sig")) "a key/value ...")) "" (div (@ (class "description")) (("list [any:unquoted-key any:value] ...")))) (div (@ (id "doc-b-" "alist-values") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alist-values") " " (span (@ (class "first-sig")) "alist")) "" "") (div (@ (id "doc-b-" "alist?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alist?") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "any -> boolean")) "") (div (@ (id "doc-b-" "alistq-ref") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alistq-ref") " " (span (@ (class "first-sig")) "a b ->")) "" "") (div (@ (id "doc-b-" "alistq-select") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alistq-select") " " (span (@ (class "first-sig")) "alist keys ->")) "" "") (div (@ (id "doc-b-" "alists-ref") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alists-ref") " " (span (@ (class "first-sig")) "a k")) "" "") (div (@ (id "doc-b-" "alists-ref-p") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alists-ref-p") " " (span (@ (class "first-sig")) "a keys ->")) "" (div (@ (class "description")) (("like alists-ref but as a procedure that accepts a list for keys")))) (div (@ (id "doc-b-" "alists-ref-q") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alists-ref-q") " " (span (@ (class "first-sig")) "a k")) "" "") (div (@ (id "doc-b-" "alists-set!") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "alists-set!") " " (span (@ (class "first-sig")) "a k v")) "" "") (div (@ (id "doc-b-" "alistv-ref") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alistv-ref") " " (span (@ (class "first-sig")) "a b ->")) "" "") (div (@ (id "doc-b-" "alistv-select") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "alistv-select") " " (span (@ (class "first-sig")) "alist keys ->")) "" "") (div (@ (id "doc-b-" "bindings->alist") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "bindings->alist") " " (span (@ (class "first-sig")) "identifier ...")) "" (div (@ (class "description")) (("create an alist with keys named like the identifiers and values from identified variables" (br) "example: (let ((a 1) (b 2)) (bindings->alist a b)) -> (((quote a) . 1) ((quote b) . 2))")))) (div (@ (id "doc-b-" "keyword-list->alist+keyless") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "keyword-list->alist+keyless") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "list -> (list:alist any ...)")) (div (@ (class "description")) (("parses a list with arguments similar to lambda* arguments. it creates alist entries for keywords (#: notation, #:example) and subsequently following values (#:example 3 other ...)." (br) "if no value follows: (#:example . #t)." (br) "all values that do not directly follow a keyword are collected in the tail of the result")))) (div (@ (id "doc-b-" "list->alist") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list->alist") " " (span (@ (class "first-sig")) "lis ->")) (div (@ (class "rest-sig")) (div "-> alist")) (div (@ (class "description")) (("create an association list from the given arguments," (br) "mapping each list element alternating to a key and value.")))) (div (@ (id "doc-b-" "list->group-alist") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list->group-alist") " " (span (@ (class "first-sig")) "lis [accessor] ->")) "" (div (@ (class "description")) (("group elements in list by an attribute of its elements." (br) "this is the equality of (accessor list-element) between elements and stored under (accessor list-element) as keys." (br) "example" (br) " (list->group-alist (1 2 2 3) identity) -> ((1 . (1)) (2 . (2 2)) (3 . (3)))" (br) " (list->group-alist ((1 3) (2 5) (2 6)) first) -> ((1 . 3) (2 . (5 6)))")))) (div (@ (id "doc-b-" "list-alist?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-alist?") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "list -> boolean")) (div (@ (class "description")) (("return #t if list is an association list, #f otherwise. works only on lists")))) (div (@ (id "doc-b-" "set-alist-bindings!") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "set-alist-bindings!") " " (span (@ (class "first-sig")) "alist ->")) "" (div (@ (class "description")) (("for each alist part, set a variable named like alist-part-key to alist-part-value")))) (div (@ (id "doc-b-" "sph-alist-description") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "sph-alist-description")) "" "")))))))) ()))