Liking cljdoc? Tell your friends :D

noahtheduke.spat.pattern


drop-quoteclj

(drop-quote sexp)

Convert (quote (a b c)) to (a b c).

Convert (quote (a b c)) to (a b c).
sourceraw docstring

non-coll?clj

(non-coll? t)

Is a given simple-type a non-collection?

Is a given simple-type a non-collection?
sourceraw docstring

patterncljmacro

(pattern sexp)

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.
sourceraw docstring

read-dispatchclj

(read-dispatch sexp _form _retval)

Same as [[simple-type]] except that :symbol and :list provide hints about their contents: :symbol can be refined to :pred, :binding, and :rest, and :list can be refined to :quote. A refinement can be skipped by adding the metadata :spat/lit.

Same as [[simple-type]] except that :symbol and :list provide hints about
their contents: :symbol can be refined to :pred, :binding, and :rest, and :list
can be refined to :quote. A refinement can be skipped by adding the metadata
`:spat/lit`.
sourceraw docstring

read-formcljmultimethod

Implementation of the main logic of pattern. Requires form and retval symbols to be provided to allow for recursion.

Implementation of the main logic of [[pattern]]. Requires form and retval
symbols to be provided to allow for recursion.
sourceraw docstring

SexpTypecljprotocol

simple-typeclj

(simple-type sexp)

Because Clojure doesn't have this built-in, we must do it the slow way: take an object and return a keyword representing that object:

nil -> :nil
true/false -> :boolean
\c -> :char
1 -> :number
:hello -> :keyword
"hello" -> :string
hello -> :symbol
{:a :b} -> :map
#{:a :b} -> :set
[:a :b] -> :vector
(1 2 3) -> :list
:else -> (type sexp)
Because Clojure doesn't have this built-in, we must do it the slow way: take
an object and return a keyword representing that object:

```clojure
nil -> :nil
true/false -> :boolean
\c -> :char
1 -> :number
:hello -> :keyword
"hello" -> :string
hello -> :symbol
{:a :b} -> :map
#{:a :b} -> :set
[:a :b] -> :vector
(1 2 3) -> :list
:else -> (type sexp)
```
source

vec-removeclj

(vec-remove pos coll)
remove elem in coll
from: https://stackoverflow.com/a/18319708/3023252
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close