(html (head (title "sph-lib (sph list)") (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)") (div (p "list helpers.") (p "part of " (a (@ (href "../../sph-lib.html")) "sph-lib")) ((section (@ (class "library-description")) (h1 "library description") (div (p "currently also contains bindings for non-list pairs.") (p "# syntax") (p "## let*-list") (p "like let*, but variable names enclosed in round brackets bind list elements.") (p "binding is done like lambda and apply.") (p "examples") (p (((*ENTITY* "nbsp") (*ENTITY* "nbsp")) "(let*-list ((a 1) ((b c) (list 2 3))) (and (= 1 a) (= 2 b) (= 3 c)))")) (p (((*ENTITY* "nbsp") (*ENTITY* "nbsp")) "(let*-list (((a b . c) (list 1 2 3 4))) #t)")))) (section (@ (class "library-name")) (h1 "module name") (p "(sph list)")) (section (@ (class "library-exports")) (h1 "exported bindings") (div (div (@ (class "doc-bindings")) (div (@ (id "doc-b-" "any->list") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "any->list") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "any -> list")) (div (@ (class "description")) (("wraps a non-list argument in a list")))) (div (@ (id "doc-b-" "compact") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "compact") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "list -> list")) (div (@ (class "description")) (("keep only true elements in list. removes all boolean false values")))) (div (@ (id "doc-b-" "complement") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "complement") " " (span (@ (class "first-sig")) "lists ... ->")) (div (@ (class "rest-sig")) (div "list ... -> list")) (div (@ (class "description")) (("delete elements from the first list that are included in the other lists")))) (div (@ (id "doc-b-" "complement-both") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "complement-both") " " (span (@ (class "first-sig")) "a b ->")) (div (@ (class "rest-sig")) (div "list list -> (list list)")) (div (@ (class "description")) (("delete elements in both lists that are included in both lists")))) (div (@ (id "doc-b-" "consecutive") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "consecutive") " " (span (@ (class "first-sig")) "f a [c] ->")) (div (@ (class "rest-sig")) (div "procedure:{any -> any/boolean} list [procedure] -> (list:matches list:rest)")) (div (@ (class "description")) (("splits the list into two lists, the first being a list of all beginning elements of \\\"a\\\" that consecutively matched" (br) "\\\"f\\\", the second being the rest." (br) "like srfi-1 span but the result is a list and not multiple return values")))) (div (@ (id "doc-b-" "contains-all?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "contains-all?") " " (span (@ (class "first-sig")) "a values ->")) (div (@ (class "rest-sig")) (div "list ... -> boolean")) (div (@ (class "description")) (("test if argument \\\"a\\\" contains all of the given values")))) (div (@ (id "doc-b-" "contains-some?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "contains-some?") " " (span (@ (class "first-sig")) "a values ->")) (div (@ (class "rest-sig")) (div "list ... -> boolean")) (div (@ (class "description")) (("test if argument \\\"a\\\" contains any of the given values")))) (div (@ (id "doc-b-" "contains?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "contains?") " " (span (@ (class "first-sig")) "a value [member] ->")) (div (@ (class "rest-sig")) (div "list any [procedure:{any list -> boolean/any}] -> boolean")) (div (@ (class "description")) (("return a boolean indicating if list \\\"a\\\" contains \\\"value\\\"")))) (div (@ (id "doc-b-" "containsq?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "containsq?") " " (span (@ (class "first-sig")) "a value ->")) "" (div (@ (class "description")) (("true if list contains value." (br) "comparison with eq?")))) (div (@ (id "doc-b-" "containsv-some?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "containsv-some?") " " (span (@ (class "first-sig")) "a values ->")) (div (@ (class "rest-sig")) (div "list list -> boolean")) (div (@ (class "description")) (("test if argument \\\"a\\\" contains any of the given values")))) (div (@ (id "doc-b-" "containsv?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "containsv?") " " (span (@ (class "first-sig")) "a value ->")) "" (div (@ (class "description")) (("true if list contains value." (br) "comparison with eqv?")))) (div (@ (id "doc-b-" "convolve") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "convolve") " " (span (@ (class "first-sig")) "a b ->")) "" "") (div (@ (id "doc-b-" "count-value") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "count-value") " " (span (@ (class "first-sig")) "value a [equal?] ->")) (div (@ (class "rest-sig")) (div "any list -> integer")) (div (@ (class "description")) (("count occurences of \\\"value\\\" in list")))) (div (@ (id "doc-b-" "count-value-with-limit") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "count-value-with-limit") " " (span (@ (class "first-sig")) "value a [count-limit member] ->")) (div (@ (class "rest-sig")) (div "any list [integer procedure:{any list -> boolean/any}] -> integer")) (div (@ (class "description")) (("like count-value but with an optional parameter for a count at which to stop counting")))) (div (@ (id "doc-b-" "count-with-limit") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "count-with-limit") " " (span (@ (class "first-sig")) "pred limit a ... ->")) (div (@ (class "rest-sig")) (div "procedure integer list ... -> integer")) (div (@ (class "description")) (("like \\\"count\\\" but with an optional parameter for a count at which to stop counting")))) (div (@ (id "doc-b-" "define-list") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "define-list") " " (span (@ (class "first-sig")) "name a ...")) "" "") (div (@ (id "doc-b-" "delete-duplicates-sorted") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "delete-duplicates-sorted") " " (span (@ (class "first-sig")) "a [equal-f preserve-order] ->")) (div (@ (class "rest-sig")) (div "list [procedure:{any any -> boolean} boolean] -> list")) (div (@ (class "description")) (("delete duplicates from a sorted list using a more efficient algorithm than for unsorted lists")))) (div (@ (id "doc-b-" "difference") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "difference") " " (span (@ (class "first-sig")) "lists ... ->")) (div (@ (class "rest-sig")) (div "list ... -> list")) (div (@ (class "description")) (("result in a list of elements not included in all given lists")))) (div (@ (id "doc-b-" "difference-and-intersection") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "difference-and-intersection") " " (span (@ (class "first-sig")) "lists ... ->")) (div (@ (class "rest-sig")) (div "list ... -> (list list)")) (div (@ (class "description")) (("results in a list with two elements, one being the symmetric-difference between the given lists and one being the intersection." (br) "that means one list of all elements that are included in all lists, and one list of elements that are not included in all lists." (br) "it does both calculations in one step saving resources compared to making them in separate steps.")))) (div (@ (id "doc-b-" "difference-and-intersection-p") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "difference-and-intersection-p") " " (span (@ (class "first-sig")) "equal-f lists ... ->")) (div (@ (class "rest-sig")) (div "{any any -> boolean} list ... -> (list:difference list:intersection)")) (div (@ (class "description")) (("like difference+intersection but the predicate for comparing list elements can be specified")))) (div (@ (id "doc-b-" "difference-p") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "difference-p") " " (span (@ (class "first-sig")) "equal-f lists ... ->")) (div (@ (class "rest-sig")) (div "{any any -> boolean} list ... -> list")) (div (@ (class "description")) (("like")))) (div (@ (id "doc-b-" "drop*") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "drop*") " " (span (@ (class "first-sig")) "count a ->")) "" (div (@ (class "description")) (("like srfi-1 drop but with reversed argument order (like stream-drop from srfi-41) and" (br) "returns null if list contains less elements than count instead of raising an exception")))) (div (@ (id "doc-b-" "duplicates") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "duplicates") " " (span (@ (class "first-sig")) "a ->")) "" (div (@ (class "description")) (("get a list of distinct values that occur more than once in the same list")))) (div (@ (id "doc-b-" "each-first-middle-last") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "each-first-middle-last") " " (span (@ (class "first-sig")) "first-f middle-f last-f a ... ->")) (div (@ (class "rest-sig")) (div "procedure procedure procedure list ... ->")) (div (@ (class "description")) (("untested." (br) "call \\\"first-f\\\" for the first element," (br) "call \\\"last-f\\\" for the last element," (br) "call \\\"middle-f\\\" for a list of all elements inbetween")))) (div (@ (id "doc-b-" "each-in-index-range") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "each-in-index-range") " " (span (@ (class "first-sig")) "f start end a ... ->")) (div (@ (class "rest-sig")) (div "procedure integer integer list ... ->")) (div (@ (class "description")) (("untested." (br) "call f only for elements in index range between \\\"start\\\" and \\\"end\\\" inclusively")))) (div (@ (id "doc-b-" "each-slice") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "each-slice") " " (span (@ (class "first-sig")) "f slice-length a ->")) (div (@ (class "rest-sig")) (div "procedure:{list ->} integer list ->")) (div (@ (class "description")) (("apply f to each slice of slice-length elements from list.")))) (div (@ (id "doc-b-" "each-with-index") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "each-with-index") " " (span (@ (class "first-sig")) "f a ... ->")) (div (@ (class "rest-sig")) (div "procedure:{index element ... ->} list ... ->")) (div (@ (class "description")) (("apply f to each element and its index in list a")))) (div (@ (id "doc-b-" "every-fold") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "every-fold") " " (span (@ (class "first-sig")) "f state a ... ->")) (div (@ (class "rest-sig")) (div "procedure:{any:state any:element ... -> any:next-state} list:elements ... -> any:state/false")) (div (@ (class "description")) (("like fold but results in false if any result of f is not a true value")))) (div (@ (id "doc-b-" "every-map") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "every-map") " " (span (@ (class "first-sig")) "f a ... ->")) (div (@ (class "rest-sig")) (div "procedure:{any -> any} list ... -> list/false")) (div (@ (class "description")) (("like map but results in false if any result of f is not a true value")))) (div (@ (id "doc-b-" "every-or-index") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "every-or-index") " " (span (@ (class "first-sig")) "f a ... ->")) (div (@ (class "rest-sig")) (div "procedure:{any ... -> boolean} list ... -> true/integer")) (div (@ (class "description")) (("true if \\\"f\\\" is true for all elements, otherwise the index of the element for which \\\"f\\\" was false")))) (div (@ (id "doc-b-" "false-if-null") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "false-if-null") " " (span (@ (class "first-sig")) "a ->")) "" "") (div (@ (id "doc-b-" "filter-append-map") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "filter-append-map") " " (span (@ (class "first-sig")) "f lists ... ->")) "" (div (@ (class "description")) (("apply filter-map and then apply append on the result")))) (div (@ (id "doc-b-" "filter-produce") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "filter-produce") " " (span (@ (class "first-sig")) "f a ... ->")) "" (div (@ (class "description")) (("procedure list ..." (br) "apply \\\"f\\\" to each ordered combination of elements from lists, cartesian product, and return true results in a list." (br) "supports multiple lists and treats non-list arguments as the single element of a list." (br) "example:" (br) " (produce f (1 2) (4 5) 6)" (br) "is equivalent to" (br) " (list (f 1 4 6) (f 1 5 6) (f 2 4 6) (f 2 5 6))")))) (div (@ (id "doc-b-" "first-intersection") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "first-intersection") " " (span (@ (class "first-sig")) "a b ->")) (div (@ (class "rest-sig")) (div "list list -> any")) (div (@ (class "description")) (("give the first found element that is included in both lists")))) (div (@ (id "doc-b-" "first-intersection-p") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "first-intersection-p") " " (span (@ (class "first-sig")) "equal-f a b ->")) (div (@ (class "rest-sig")) (div "{any any -> boolean} list list -> any")) (div (@ (class "description")) (("like first-intersection but the procedure for comparing elements can be specified")))) (div (@ (id "doc-b-" "first-or-false") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "first-or-false") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "list -> any/false")) (div (@ (class "description")) (("give the first element of a list if it is not null, otherwise false")))) (div (@ (id "doc-b-" "first-or-null") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "first-or-null") " " (span (@ (class "first-sig")) "a ->")) "" (div (@ (class "description")) (("results in the first element of a list if it is not null, otherwise null")))) (div (@ (id "doc-b-" "flat?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "flat?") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "list -> boolean")) (div (@ (class "description")) (("true if the list does not contain a list")))) (div (@ (id "doc-b-" "flatten") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "flatten") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "list -> (non-list ...)")) (div (@ (class "description")) (("replace sublists with their content, resulting in a list that does not contain lists")))) (div (@ (id "doc-b-" "fold*") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold*") " " (span (@ (class "first-sig")) "f a custom-state-values ... ->")) (div (@ (class "rest-sig")) (div "procedure:{any:list-element any:state-value ... -> (any:state-value)} list any:state-value ... -> list:state-values")) (div (@ (class "description")) (("like fold but with multiple state values. the state values are updated by returning a list from a call to \\\"f\\\"." (br) "apply \\\"f\\\" to each element of \\\"a\\\" and the state-value elements that were given to" (br) "fold-multiple or subsequently the updated state-values from the previous call to \\\"f\\\"")))) (div (@ (id "doc-b-" "fold-c*") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold-c*") " " (span (@ (class "first-sig")) "f a custom-state-values ... ->")) (div (@ (class "rest-sig")) (div "procedure:{any:list-element any:state-value ... -> (any:state-value)} list any:state-value ... -> list:state-values")) (div (@ (class "description")) (("like fold but with multiple state values. the state values are updated by returning a list from a call to \\\"f\\\"." (br) "apply \\\"f\\\" to each element of \\\"a\\\" and the state-value elements that were given to" (br) "fold-multiple or subsequently the updated state-values from the previous call to \\\"f\\\"")))) (div (@ (id "doc-b-" "fold-integers") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold-integers") " " (span (@ (class "first-sig")) "count init f ->")) (div (@ (class "rest-sig")) (div "integer any {integer any -> any} -> any")) (div (@ (class "description")) (("fold over integers from 0 to count - 1")))) (div (@ (id "doc-b-" "fold-multiple") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold-multiple") " " (span (@ (class "first-sig")) "f a custom-state-values ... ->")) (div (@ (class "rest-sig")) (div "procedure:{any:list-element any:state-value ... -> (any:state-value)} list any:state-value ... -> list:state-values")) (div (@ (class "description")) (("like fold but with multiple state values. the state values are updated by returning a list from a call to \\\"f\\\"." (br) "apply \\\"f\\\" to each element of \\\"a\\\" and the state-value elements that were given to" (br) "fold-multiple or subsequently the updated state-values from the previous call to \\\"f\\\"")))) (div (@ (id "doc-b-" "fold-multiple-c") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold-multiple-c") " " (span (@ (class "first-sig")) "f a custom-state-values ... ->")) "" (div (@ (class "description")) (("procedure:{any:element procedure:continue:{list:next-pair any:state-value ...} any:state-value ... -> any} list any:state-value ... -> list")))) (div (@ (id "doc-b-" "fold-multiple-right") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold-multiple-right") " " (span (@ (class "first-sig")) "f a r ... ->")) (div (@ (class "rest-sig")) (div "procedure list any ... -> any")) (div (@ (class "description")) (("like fold-multiple but works through the list elements from last to first")))) (div (@ (id "doc-b-" "fold-right*") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold-right*") " " (span (@ (class "first-sig")) "f a r ... ->")) (div (@ (class "rest-sig")) (div "procedure list any ... -> any")) (div (@ (class "description")) (("like fold-multiple but works through the list elements from last to first")))) (div (@ (id "doc-b-" "fold-segments") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold-segments") " " (span (@ (class "first-sig")) "size f init a ->")) "" (div (@ (class "description")) (("integer {any:state element ... -> any:state} any:state list -> any" (br) "fold over each overlapping segment with length \\\"size\\\"." (br) "example:" (br) "(fold-segments f 2 #t (list 4 5 6 7))")))) (div (@ (id "doc-b-" "fold-slice") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold-slice") " " (span (@ (class "first-sig")) "slice-length f init a ->")) (div (@ (class "rest-sig")) (div "integer procedure:{any:state any:element ... -> any} any list -> any:state")) (div (@ (class "description")) (("call f with each slice-length number of consecutive elements of a")))) (div (@ (id "doc-b-" "fold-span") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold-span") " " (span (@ (class "first-sig")) "filter-f f a ->")) (div (@ (class "rest-sig")) (div "procedure:{any -> any/false} procedure:{list -> any} list -> any")) (div (@ (class "description")) (("fold over each list of elements that consecutively matched filter-f (utilising the \\\"span\\\" procedure)")))) (div (@ (id "doc-b-" "fold-unless") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold-unless") " " (span (@ (class "first-sig")) "f stop? default init a ... ->")) (div (@ (class "rest-sig")) (div "{any ... -> any} {any -> boolean/any} any any list ... -> any")) (div (@ (class "description")) (("like fold, but returns \\\"default\\\" if \\\"stop?\\\" is true")))) (div (@ (id "doc-b-" "fold-unless-check-init") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold-unless-check-init") " " (span (@ (class "first-sig")) "f stop? default init a ... ->")) "" "") (div (@ (id "doc-b-" "fold-until") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "fold-until") " " (span (@ (class "first-sig")) "f init stop? a ->")) (div (@ (class "rest-sig")) (div "procedure any procedure:{any -> boolean} list -> any")) (div (@ (class "description")) (("end folding if \\\"stop?\\\" is true for a result and return the result")))) (div (@ (id "doc-b-" "group-consecutive") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "group-consecutive") " " (span (@ (class "first-sig")) "filter-f a ->")) (div (@ (class "rest-sig")) (div "{any -> boolean} list -> list")) (div (@ (class "description")) (("wrap multiple elements that consecutively match \\\"filter-f\\\" in a list")))) (div (@ (id "doc-b-" "group-split-at-matches") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "group-split-at-matches") " " (span (@ (class "first-sig")) "start-group? a ->")) (div (@ (class "rest-sig")) (div "procedure:{any -> boolean} list -> (list ...)")) (div (@ (class "description")) (("wrap consecutive elements in lists. elements for which \\\"start-group?\\\" is true become the first element of a new list." (br) "example" (br) "(group-split-at-matches integer? (list \\\"a\\\" \\\"b\\\" 1 \\\"c\\\" \\\"d\\\" 2 \\\"e\\\"))" (br) "->" (br) "((\\\"a\\\" \\\"b\\\") (1 \\\"c\\\" \\\"d\\\") (2 \\\"e\\\"))")))) (div (@ (id "doc-b-" "improper-list-split-at-last") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "improper-list-split-at-last") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "pair:improper-list -> (list any:non-pair)") (div "(1 2 . 3) -> ((1 2) 3)")) "") (div (@ (id "doc-b-" "insert-second") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "insert-second") " " (span (@ (class "first-sig")) "a b ->")) (div (@ (class "rest-sig")) (div "any list -> list")) (div (@ (class "description")) (("insert \\\"a\\\" as the second element into list \\\"b\\\"")))) (div (@ (id "doc-b-" "interleave") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "interleave") " " (span (@ (class "first-sig")) "a value ->")) (div (@ (class "rest-sig")) (div "list any -> list")) (div (@ (class "description")) (("inserts value in front of each element in \\\"a\\\" except the first element." (br) "example: (interleave (list 1 2 3) 4) -> (1 4 2 4 3)")))) (div (@ (id "doc-b-" "intersection") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "intersection") " " (span (@ (class "first-sig")) "lists ... ->")) (div (@ (class "rest-sig")) (div "list ... -> list")) (div (@ (class "description")) (("result in a list of all elements which are contained in all given lists")))) (div (@ (id "doc-b-" "intersection-p") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "intersection-p") " " (span (@ (class "first-sig")) "equal-f rest ... ->")) (div (@ (class "rest-sig")) (div "procedure:{any any -> boolean} list ... -> list")) (div (@ (class "description")) (("like \\\"intersection\\\" but the predicate for comparing the list elements can be specified")))) (div (@ (id "doc-b-" "iterate-three") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "iterate-three") " " (span (@ (class "first-sig")) "f a states ... ->")) (div (@ (class "rest-sig")) (div "procedure:{list:prev any:current list:next any:state ... -> any:state ...} list any:state-init ... -> list:state")) (div (@ (class "description")) (("calls \\\"f\\\" for each list element, previous list elements and following list elements." (br) "multiple custom values can be updated each call with the result of \\\"f\\\" which must be a list")))) (div (@ (id "doc-b-" "iterate-three-stop-end") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "iterate-three-stop-end") " " (span (@ (class "first-sig")) "stop? end map-f a states ... ->")) (div (@ (class "rest-sig")) (div "{list any list any ... -> boolean} {list any list any ... -> list:state-values}:after-stop? {list any list any ... -> list:state-values} list any ... -> any")) (div (@ (class "description")) (("like \\\"iterate-three\\\" but takes two additional procedures - one for stopping the iteration" (br) "after a \\\"map-f\\\" result, and one that is called for the last element or when \\\"stop?\\\" is true")))) (div (@ (id "doc-b-" "let*-list") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "let*-list") " " (span (@ (class "first-sig")) "(((name ...) a) rest ...) body ...")) "" "") (div (@ (id "doc-b-" "list-bind") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "list-bind") " " (span (@ (class "first-sig")) "a lambda-formals body ...")) "" (div (@ (class "description")) (("bind elements of list \\\"a\\\" to \\\"lambda-formals\\\"")))) (div (@ (id "doc-b-" "list-deselect") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-deselect") " " (span (@ (class "first-sig")) "a indices ->")) (div (@ (class "rest-sig")) (div "list (integer ...) -> list")) (div (@ (class "description")) (("return a new, eventually smaller, list consisting of values not at specified indices")))) (div (@ (id "doc-b-" "list-distribute") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-distribute") " " (span (@ (class "first-sig")) "a indices default ->")) (div (@ (class "rest-sig")) (div "list (integer ...) any -> list")) (div (@ (class "description")) (("creates a new list with values from list a at positions indices. the value for \\\"no-element\\\" is set at indices" (br) "not included in the list indices. the length of indices must equal the length of a, and indices should not have duplicates.")))) (div (@ (id "doc-b-" "list-distribute-sorted") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-distribute-sorted") " " (span (@ (class "first-sig")) "a indices default ->")) "" (div (@ (class "description")) (("like list-distribute but faster. works only correctly for indices lists that are sorted ascending")))) (div (@ (id "doc-b-" "list-index-value") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-index-value") " " (span (@ (class "first-sig")) "a value [equal-f] ->")) "" (div (@ (class "description")) (("get the index of value in list")))) (div (@ (id "doc-b-" "list-indices") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-indices") " " (span (@ (class "first-sig")) "f a ->")) (div (@ (class "rest-sig")) (div "procedure:{any -> boolean} list -> (integer ...)")) (div (@ (class "description")) (("create a list of all indices for which f results in true")))) (div (@ (id "doc-b-" "list-logical-condition?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-logical-condition?") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "any -> boolean")) (div (@ (class "description")) (("true if \\\"a\\\" is a list-logical condition")))) (div (@ (id "doc-b-" "list-logical-contains?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-logical-contains?") " " (span (@ (class "first-sig")) "a condition ->")) (div (@ (class "rest-sig")) (div "list list -> boolean")) (div (@ (class "description")) (("test for value inclusion with a condition list like ([or/and/not] value/condition ...)." (br) "example:" (br) "(list-logical-contains? (list 1 2 3) (quote (and 2 3 (or 4 1 5) (not 8)))) -> #t")))) (div (@ (id "doc-b-" "list-logical-match") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-logical-match") " " (span (@ (class "first-sig")) "match-one? condition ->")) (div (@ (class "rest-sig")) (div "procedure:{any -> boolean} list -> false/any:last-sub-condition-result")) (div (@ (class "description")) (("match a logical condition that is a possibly nested list with and/or/not symbol prefixes." (br) "match-one? is called for each element in condition that is not a condition prefix." (br) "returns false early if a required part of the condition does not match." (br) "condition: ([symbol:and/or/not] any/condition ...)" (br) "example" (br) " (list-logical-match (l (b) (contains? somelist b)) (q (and 1 2 (or (and 3 4) (and 5 6)))))")))) (div (@ (id "doc-b-" "list-page") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-page") " " (span (@ (class "first-sig")) "a entry-count number lookahead c ->")) (div (@ (class "rest-sig")) (div "list integer integer integer procedure:{list boolean:last-page? -> any} -> any")) (div (@ (class "description")) (("pass a list of \\\"entry-count\\\" elements at an offset of (* number entry-count)," (br) "eventually including \\\"lookahead\\\" number of elements if they are the last elements" (br) "and a boolean indicating if it is the last page to continuation procedure \\\"c\\\"")))) (div (@ (id "doc-b-" "list-prefix?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-prefix?") " " (span (@ (class "first-sig")) "a prefix ->")) (div (@ (class "rest-sig")) (div "list list -> boolean")) (div (@ (class "description")) (("true if the given \\\"prefix\\\" elements exist in order at the beginning of list." (br) "examples:" (br) "(list-prefix? (list 3 2 4) (list 3 1)) -> #f" (br) "(list-prefix? (list 3 2 4) (list 3 2)) -> #t")))) (div (@ (id "doc-b-" "list-replace-last") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-replace-last") " " (span (@ (class "first-sig")) "a replacement ->")) (div (@ (class "rest-sig")) (div "list any/procedure:{any -> any} -> list")) (div (@ (class "description")) (("replace the last element in a list")))) (div (@ (id "doc-b-" "list-replace-last-n") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-replace-last-n") " " (span (@ (class "first-sig")) "n a replacement ->")) (div (@ (class "rest-sig")) (div "list integer any/procedure:{any ... -> any/list} -> list")) "") (div (@ (id "doc-b-" "list-select") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-select") " " (span (@ (class "first-sig")) "a indices ->")) (div (@ (class "rest-sig")) (div "list (integer ...) -> list")) (div (@ (class "description")) (("return a new list consisting of values at indices")))) (div (@ (id "doc-b-" "list-set-add") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-set-add") " " (span (@ (class "first-sig")) "= list rest ... ->")) "" (div (@ (class "description")) (("Add to LIST any of the elements of REST not already in the list." (br) "These elements are `cons'ed onto the start of LIST (so the return shares" (br) "a common tail with LIST), but the order they're added is unspecified." (br) "" (br) "The given `=' procedure is used for comparing elements, called" (br) "as `(@var{=} listelem elem)', i.e., the second argument is one of the" (br) "given REST parameters.")))) (div (@ (id "doc-b-" "list-set-difference") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-set-difference") " " (span (@ (class "first-sig")) "= list1 rest ... ->")) "" "") (div (@ (id "doc-b-" "list-set-equal?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-set-equal?") " " (span (@ (class "first-sig")) "a ... ->")) (div (@ (class "rest-sig")) (div "list ... -> boolean")) (div (@ (class "description")) (("true if all elements of the given lists appear in all others." (br) "uses \\\"equal?\\\" for element equality comparison")))) (div (@ (id "doc-b-" "list-set-eqv?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-set-eqv?") " " (span (@ (class "first-sig")) "a ... ->")) (div (@ (class "rest-sig")) (div "list ... -> boolean")) (div (@ (class "description")) (("like \\\"list-set-equal?\\\" but uses \\\"eqv?\\\" for element equality comparison")))) (div (@ (id "doc-b-" "list-set-subset?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-set-subset?") " " (span (@ (class "first-sig")) "= rest ... ->")) "" "") (div (@ (id "doc-b-" "list-set-union") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-set-union") " " (span (@ (class "first-sig")) "= rest ... ->")) "" "") (div (@ (id "doc-b-" "list-sort-by-list") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-sort-by-list") " " (span (@ (class "first-sig")) "order a [accessor] ->")) (div (@ (class "rest-sig")) (div "list list -> list")) (div (@ (class "description")) (("sort a list so the elements correspond to the order of elements in list \\\"order\\\"." (br) "elements not contained in \\\"order\\\" are moved to the end of the result list." (br) "examples:" (br) "(list-sort-by-list (list 3 2 4) (list 4 2 3)) -> (3 2 4)" (br) "(list-sort-by-list (list 3 2 4) (list 4 5 2 3)) -> (3 2 4 5)")))) (div (@ (id "doc-b-" "list-sort-with-accessor") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-sort-with-accessor") " " (span (@ (class "first-sig")) "less? accessor a ->")) (div (@ (class "rest-sig")) (div "procedure:{any any -> boolean} procedure:{any:list-element -> any} list -> list")) (div (@ (class "description")) (("sort list by calling accessor for each argument before comparison. only the order of elements changes, the individual elements are not changed")))) (div (@ (id "doc-b-" "list-suffix?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-suffix?") " " (span (@ (class "first-sig")) "a suffix ->")) (div (@ (class "rest-sig")) (div "list list -> boolean")) (div (@ (class "description")) (("true if the given \\\"suffix\\\" elements exist in order at the end of list." (br) "see also \\\"list-prefix?\\\"")))) (div (@ (id "doc-b-" "list-tail-ref") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "list-tail-ref") " " (span (@ (class "first-sig")) "a b ->")) "" "") (div (@ (id "doc-b-" "map-apply") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-apply") " " (span (@ (class "first-sig")) "f a ... ->")) (div (@ (class "rest-sig")) (div "procedure:{any ... -> any} (list ...) ... -> list")) (div (@ (class "description")) (("like map but the procedure is applied with elements of \\\"a\\\" as arguments." (br) "instead of calling f like (f (list 1 2)) like \\\"map\\\" would do, f is called like (f 1 2)" (br) "example" (br) " (map-apply f (list (list 1 2) (list 3 4)))")))) (div (@ (id "doc-b-" "map-c") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-c") " " (span (@ (class "first-sig")) "f lists ... ->")) (div (@ (class "rest-sig")) (div "procedure:{procedure:{any:new-element -> any}:continue any:element ... -> any:last-result} list ... -> list")) (div (@ (class "description")) (("map over list with a procedure that when called with the current map result continues the mapping." (br) "if the procedure is not called, the result of the current call will become the tail of the result list." (br) "maps only the length of the shortest list if multiple lists are given" (br) "example" (br) " (map-c (l (c a) (if (> 3 a) (c (+ 1 a)) (list))) (list 1 2 3 4 5))" (br) " ->" (br) " (2 3 4)")))) (div (@ (id "doc-b-" "map-consecutive") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-consecutive") " " (span (@ (class "first-sig")) "filter-f f a ->")) (div (@ (class "rest-sig")) (div "{any -> boolean} {any any ... -> any} list -> list")) (div (@ (class "description")) (("\\\"f\\\" is called for and with every list of elements that consecutively matched \\\"filter-f\\\". at least two elements at a time")))) (div (@ (id "doc-b-" "map-first") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-first") " " (span (@ (class "first-sig")) "f a ->")) (div (@ (class "rest-sig")) (div "procedure list -> list")) (div (@ (class "description")) (("call \\\"f\\\" for the first element of list and replace the first element in the list with the result of \\\"f\\\"." (br) "replace-first")))) (div (@ (id "doc-b-" "map-fold") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-fold") " " (span (@ (class "first-sig")) "f a init ... ->")) (div (@ (class "rest-sig")) (div "procedure list any ... -> list any ...")) (div (@ (class "description")) (("procedure:{(list-element state ...) -> (list-element state ...)}" (br) "combination of map and fold." (br) "call f with each list element and state values, which are set to init for the first call." (br) "each call to f must return a list of: the mapped result element and one" (br) "element for each updated value of state." (br) "example: (map-fold (l (a index) (list (+ a index) (+ 1 index))) (list 1 2 3) 0)")))) (div (@ (id "doc-b-" "map-integers") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-integers") " " (span (@ (class "first-sig")) "count f ->")) (div (@ (class "rest-sig")) (div "integer procedure:{integer -> any} -> list")) (div (@ (class "description")) (("map over integers from 0 to count - 1")))) (div (@ (id "doc-b-" "map-last-n") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-last-n") " " (span (@ (class "first-sig")) "n b f ->")) (div (@ (class "rest-sig")) (div "procedure:{any ... -> any/(any ...)} list -> list")) (div (@ (class "description")) (("call f to replace the last n elements in list b." (br) "if the result of f is a list it is spliced so that the" (br) "elements can be replaced with multiple elements")))) (div (@ (id "doc-b-" "map-map") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-map") " " (span (@ (class "first-sig")) "f a ... ->")) (div (@ (class "rest-sig")) (div "procedure (list ...) ... -> list")) (div (@ (class "description")) (("given a list of lists, maps over the elements of lists." (br) "like (map (l (a) (map f a) a))")))) (div (@ (id "doc-b-" "map-one") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-one") " " (span (@ (class "first-sig")) "predicate f a ->")) (div (@ (class "rest-sig")) (div "{any -> any}:predicate {any:element -> any} list -> list")) (div (@ (class "description")) (("apply f only to the first element that matches predicate." (br) "all elements that do not match are mapped with the \\\"identity\\\" function")))) (div (@ (id "doc-b-" "map-segments") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-segments") " " (span (@ (class "first-sig")) "size f a ->")) (div (@ (class "rest-sig")) (div "integer procedure:{any ... -> any} list -> list")) (div (@ (class "description")) (("map over each overlapping segment of length len." (br) "each segment is one step apart." (br) "example: for (1 2 3 4) size 2 maps (1 2) (2 3) (3 4)")))) (div (@ (id "doc-b-" "map-selected") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-selected") " " (span (@ (class "first-sig")) "select? f a ... ->")) (div (@ (class "rest-sig")) (div "procedure procedure list ... -> list")) (div (@ (class "description")) (("apply f only to elements for which \\\"select?\\\" is true. unmatched items are included in the result list." (br) "if multiple lists are given, it works like \\\"map\\\" except that the elements from the multiple lists for one call that are not selected are saved as a list." (br) "map-some/map-only")))) (div (@ (id "doc-b-" "map-slice") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-slice") " " (span (@ (class "first-sig")) "slice-length f a ->")) (div (@ (class "rest-sig")) (div "integer procedure:{any ... -> any} list -> list")) (div (@ (class "description")) (("call \\\"f\\\" with each \\\"slice-length\\\" number of consecutive elements of \\\"a\\\"")))) (div (@ (id "doc-b-" "map-span") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-span") " " (span (@ (class "first-sig")) "filter-f f a ->")) (div (@ (class "rest-sig")) (div "procedure:{any -> any/false} procedure:{any any ... -> any} list -> list")) (div (@ (class "description")) (("apply \\\"f\\\" to each list of elements that consecutively matched \\\"filter-f\\\"." (br) "an unpredictable number of arguments might be passed to f. with (lambda a body ...) a single list can still be accessed." (br) "this allows for things like (map-span string? string-append a)")))) (div (@ (id "doc-b-" "map-unless") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-unless") " " (span (@ (class "first-sig")) "f stop? default a ... ->")) (div (@ (class "rest-sig")) (div "procedure stop? list -> list/boolean:false") (div "{any -> any} {any -> boolean} list -> list/boolean")) (div (@ (class "description")) (("map unless \\\"stop?\\\" is true for a mapping-result. return an empty list or \\\"default\\\" if \\\"stop?\\\" was true")))) (div (@ (id "doc-b-" "map-with-index") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "map-with-index") " " (span (@ (class "first-sig")) "f a ... ->")) (div (@ (class "rest-sig")) (div "procedure:{integer:index any:element ... -> any} list ... -> list")) "") (div (@ (id "doc-b-" "pair->list") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "pair->list") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "pair -> list")) "") (div (@ (id "doc-b-" "pair-bind") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "pair-bind") " " (span (@ (class "first-sig")) "a (b c) body ...")) "" (div (@ (class "description")) (("bind the first and second value of \\\"a\\\" to \\\"b\\\" and \\\"c\\\" respectively." (br) "ideally, maybe, lambda/apply should support (apply (lambda (a . b)) (pair 1 2))")))) (div (@ (id "doc-b-" "pair-fold-multiple") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "pair-fold-multiple") " " (span (@ (class "first-sig")) "f a init ... ->")) (div (@ (class "rest-sig")) (div "{pair any -> any} list any ... -> any")) (div (@ (class "description")) (("like fold-multiple but calling f with the pairs of list")))) (div (@ (id "doc-b-" "pair-map") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "pair-map") " " (span (@ (class "first-sig")) "f a ->")) (div (@ (class "rest-sig")) (div "procedure list -> list")) (div (@ (class "description")) (("like map but not the list elements are passed to \\\"f\\\" but the pairs of the list." (br) "for example (1 2 3) is just another notation for the pair notation (1 . (2 . (3 . ())))" (br) "instead of mapping (1 2 3) pair-map maps ((1 2 3) (2 3) (3))")))) (div (@ (id "doc-b-" "pair-reverse") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "pair-reverse") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "pair -> pair")) (div (@ (class "description")) (("reverse the order of values in a pair." (br) "example: (pair-reverse (pair 1 2)) -> (2 . 1)")))) (div (@ (id "doc-b-" "pattern-match-min-length") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "pattern-match-min-length") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "list -> integer")) (div (@ (class "description")) (("takes a flat list with symbols and ellipses and counts the required parts of a pattern with" (br) "symbols interpreted as matching any element and ellipses to match zero or many occurences of the previous element." (br) "# examples" (br) " ((a ...)) -> 0" (br) " ((a a ...)) -> 1" (br) " ((a ... b ...)) -> 0" (br) " ((a ... b ... c d)) -> 2")))) (div (@ (id "doc-b-" "produce") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "produce") " " (span (@ (class "first-sig")) "f a ... ->")) "" "") (div (@ (id "doc-b-" "produce-unless") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "produce-unless") " " (span (@ (class "first-sig")) "f stop? default a b ->")) (div (@ (class "rest-sig")) (div "{any any -> any} {any -> boolean} any list list -> false/any")) (div (@ (class "description")) (("produce two lists unless \\\"stop?\\\" is true for a production-result. if stop? is true, result in false")))) (div (@ (id "doc-b-" "replace") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "replace") " " (span (@ (class "first-sig")) "a select? replacement ->")) (div (@ (class "rest-sig")) (div "list procedure any -> list")) "") (div (@ (id "doc-b-" "replace-at-once") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "replace-at-once") " " (span (@ (class "first-sig")) "match? f a ->")) (div (@ (class "rest-sig")) (div "procedure:{any -> boolean} procedure:{list:matched-elements -> list:replacements} list:source -> list")) (div (@ (class "description")) (("all elements matching \\\"match?\\\" are collected in a list and passed to \\\"f\\\"." (br) "the result of \\\"f\\\" is then used to replace the matched elements in source in order")))) (div (@ (id "doc-b-" "replace-value") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "replace-value") " " (span (@ (class "first-sig")) "a search-value replacement [equal-f] ->")) (div (@ (class "rest-sig")) (div "list any any [procedure:{any any -> boolean}] -> list")) "") (div (@ (id "doc-b-" "simplify") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "simplify") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "any/list -> list/pair/any") (div "list with one element -> element") (div "list with two non-pair elements -> pair")) "") (div (@ (id "doc-b-" "simplify-list") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "simplify-list") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "list -> list")) (div (@ (class "description")) (("examples:" (br) "(((1 2))) -> (1 2)" (br) "(((1 2) (3))) -> ((1 2) (3))" (br) " removes extra nesting")))) (div (@ (id "doc-b-" "sph-list-description") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "sph-list-description")) "" "") (div (@ (id "doc-b-" "splice") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "splice") " " (span (@ (class "first-sig")) "predicate a ->")) (div (@ (class "rest-sig")) (div "{list -> boolean} list -> list")) (div (@ (class "description")) (("splice elements that are lists and match predicate")))) (div (@ (id "doc-b-" "splice-last-list") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "splice-last-list") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "list -> list")) (div (@ (class "description")) (("if the last element is a list, append it to the previous elements." (br) "example: (splice-last-list (1 2 (3 4))) -> (1 2 3 4)")))) (div (@ (id "doc-b-" "split-at-last") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "split-at-last") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "list -> (list list)")) (div (@ (class "description")) (("get a list with the list of the initial elements and a list with the last element")))) (div (@ (id "doc-b-" "split-at-value") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "split-at-value") " " (span (@ (class "first-sig")) "a search-value [inclusiveness] ->")) (div (@ (class "rest-sig")) (div "list any [symbol:exclusive/inclusive] -> (list:left list:right)")) "") (div (@ (id "doc-b-" "split-by-pattern") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "split-by-pattern") " " (span (@ (class "first-sig")) "pattern a ->")) (div (@ (class "rest-sig")) (div "(symbol symbol/ellipsis:... ...) list -> (list:((key . values) ...):matches list:rest)")) (div (@ (class "description")) (("basic matcher that only supports matching single or repeated elements with multiple ellipses." (br) "creates alist elements for variables in pattern that match elements in list \\\"a\\\"." (br) "the result is a list with two values: one for the match and one for the unmatched rest." (br) "if pattern did not match, then both values are false. if pattern is null, matches is null and rest is the input list." (br) "unlike other pattern matchers, \\\"pattern\\\" is a list and not syntax and so can be passed as a variable." (br) "# example" (br) " (split-by-pattern (quote (a b ... c)) (list 1 2 3 4)) -> (((a . 1) (b 2 3) (c . 4)) ())")))) (div (@ (id "doc-b-" "tail-or-null") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "tail-or-null") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "list -> list")) (div (@ (class "description")) (("return the tail of list or null if there is no tail which is" (br) "the case when list is null")))) (div (@ (id "doc-b-" "take*") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "take*") " " (span (@ (class "first-sig")) "count a ->")) "" (div (@ (class "description")) (("like srfi-1 take but with reversed argument order (like stream-take from srfi-41) and" (br) "returns null if list contains less elements than count instead of raising an exception")))) (div (@ (id "doc-b-" "union") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "union") " " (span (@ (class "first-sig")) "a ... ->")) "" "")))))))) ()))