(literal? t)
Is a given simple-type a literal/non-special?
Is a given simple-type a literal/non-special?
(match-binding ctx bind form)
Pattern must be a symbol in ?x style already.
Pattern must be a symbol in ?x style already.
(match-single ctx items)
Checks multiple single-element values at once.
Instead of generating a big and
like in v1, this rebinds ctx and the
children-form for each pattern, returning nil
if one of the patterns
doesn't match and somewhat short-circuiting the rest of the checks.
Relies on the output of the single-element pattern functions and expects them to return the ctx object iff there's a match.
Checks multiple single-element values at once. Instead of generating a big `and` like in v1, this rebinds ctx and the children-form for each pattern, returning `nil` if one of the patterns doesn't match and somewhat short-circuiting the rest of the checks. Relies on the output of the single-element pattern functions and expects them to return the ctx object iff there's a match.
(non-coll? t)
Is a given simple-type a non-collection?
Is a given simple-type a non-collection?
(pattern pattern)
Parse a provided pattern s-expression into a function that checks each element and sub-element of the form as a whole predicate. Makes semi-smart decisions about using let-bindings to avoid re-accessing the same value multiple times, adding type hints to rely on interop, and handles the complexities of the pattern DLS.
Returns a map or nil
. If the provided pattern uses bindings, the map will
have the bindings as keys.
Parse a provided pattern s-expression into a function that checks each element and sub-element of the form as a whole predicate. Makes semi-smart decisions about using let-bindings to avoid re-accessing the same value multiple times, adding type hints to rely on interop, and handles the complexities of the pattern DLS. Returns a map or `nil`. If the provided pattern uses bindings, the map will have the bindings as keys.
(read-dispatch pattern)
(read-dispatch _ctx pattern _form)
Same as [[simple-type]] except that :symbol and :list provide hints about
their contents. Can be skipped by adding the metadata :splint/lit
.
Same as [[simple-type]] except that :symbol and :list provide hints about their contents. Can be skipped by adding the metadata `:splint/lit`.
(read-form ctx pattern form)
Implementation of the main logic of pattern
. Requires form and ctx
symbols to be provided to allow for recursion.
Implementation of the main logic of [[pattern]]. Requires form and ctx symbols to be provided to allow for recursion.
(seq-match-step ctx form fns)
Inspired by segment-matcher from pangloss/pattern.
Inspired by segment-matcher from pangloss/pattern.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close