Liking cljdoc? Tell your friends :D

meander.syntax.delta


any-form?clj/s

(any-form? x)

true if x is a symbol beginning with _.

true if x is a symbol beginning with _.
raw docstring

any-node?clj/s

(any-node? x)

true if x is an :any node, false otherwise.

true if x is an :any node, false otherwise.
raw docstring

childrenclj/smultimethod

(children node)

Return a sequential? of all children of node.

Return a sequential? of all children of node.
raw docstring

consolidate-withclj/s

(consolidate-with node)

Collapse all :wth nodes into a single :wth node.

Collapse all :wth nodes into a single :wth node.
raw docstring

defsyntaxclj/s≠macro

clj
(defsyntax name docstring? meta? arglist & body)
cljs
(defsyntax &form &env & args)

EXPERIMENTAL Like defn but for defining new pattern syntax by extending the parser. When parsing, if a seq is encountered starting with a symbol which can be resolved to the created var then the tail of the seq is applied to the var and the result is parsed.

Example

(defsyntax re [regex] `(~'pred (fn [s#] (and (string? s#) (re-matches ~regex s#)))))

(require '[meander.match.delta :as r.match])

(r.match/match "elf" (re #"[a-z]+") :okay!) ;; => :okay

EXPERIMENTAL Like defn but for defining new pattern syntax by
extending the parser. When parsing, if a seq is encountered starting
with a symbol which can be resolved to the created var then the tail
of the seq is applied to the var and the result is parsed.

Example

(defsyntax re [regex]
  `(~'pred
    (fn [s#]
      (and (string? s#)
           (re-matches ~regex s#)))))

(require '[meander.match.delta :as r.match])

(r.match/match "elf"
  (re #"[a-z]+")
  :okay!)
;; => :okay
raw docstring

expand-seqclj/smultimethod

(expand-seq seq env)

foldclj/s

(fold f value node)

Same as clojure.core/reduce but specifically for ASTs. f must be a binary (arity 2) function and will receive as arguments the current accumulated value and an AST node. fold is eager and will visit each subnode in node.

Same as clojure.core/reduce but specifically for ASTs. f must be a
binary (arity 2) function and will receive as arguments the current
accumulated value and an AST node. fold is eager and will visit each
subnode in node.
raw docstring

ground?clj/smultimethod

(ground? node)

true if node is ground i.e. it contains no variables or is not a match operator.

true if node is ground i.e. it contains no variables or is not a
match operator.
raw docstring

logic-variable-form?clj/s

(logic-variable-form? x)

true if x is in the form of a logic variable i.e. a simple symbol with a name beginning with ?.

true if x is in the form of a logic variable i.e. a simple symbol
with a name beginning with \?.
raw docstring

logic-variablesclj/s

(logic-variables node)

Return all :lvr nodes in node.

Return all :lvr nodes in node.
raw docstring

lvr-node?clj/s

(lvr-node? x)

make-ref-mapclj/s

(make-ref-map node)

If node is a node repesenting a with pattern, return a map from reference to pattern node derived from it's bindings, otherwise return an empty map.

If node is a node repesenting a with pattern, return a map from
reference to pattern node derived from it's bindings, otherwise
return an empty map.
raw docstring

max-lengthclj/smultimethod

(max-length node)

The maximum possible length the pattern described by node can be. Note, this mutlimethod will throw an error wheneven node does not have a method to handle it. This behavior is intentional as the implementations should only exist for things which have can have length.

The maximum possible length the pattern described by node can
be. Note, this mutlimethod will throw an error wheneven node does
not have a method to handle it. This behavior is intentional as the
implementations should only exist for things which have can have
length.
raw docstring

memory-variable-form?clj/s

(memory-variable-form? x)

true if x is in the form of a memory variable i.e. a simple symbol with a name beginning with !.

true if x is in the form of a memory variable i.e. a simple symbol
with a name beginning with \!.
raw docstring

memory-variablesclj/s

(memory-variables node)

Return all :mvr nodes in node.

Return all :mvr nodes in node.
raw docstring

min-lengthclj/smultimethod

(min-length node)

The maximum possible length the pattern described by node can be. Note, this mutlimethod will throw an error wheneven node does not have a method to handle it. This behavior is intentional as the implementations should only exist for things which have can have length.

The maximum possible length the pattern described by node can be.
Note, this mutlimethod will throw an error wheneven node does not
have a method to handle it. This behavior is intentional as the
implementations should only exist for things which have can have
length.
raw docstring

mvr-node?clj/s

(mvr-node? x)

node?clj/s

(node? x)

true if x is an AST node.

true if x is an AST node.
raw docstring

parseclj/s

(parse x)
(parse x env)

Parse x into an abstract syntax tree (AST) optionally with respect to the environment env.

(parse '(?x1 ?x2 :as ?xs)) ;; => {:tag :seq :as {:tag :lvr :symbol ?xs} :prt {:tag :prt :left {:tag :cat :elements ({:tag :lvr :symbol ?x1} {:tag :lvr :symbol ?x2})} :right {:tag :cat :elements []}}}

Parse `x` into an abstract syntax tree (AST) optionally with
respect to the environment `env`.

(parse '(?x1 ?x2 :as ?xs))
;; =>
{:tag :seq
 :as {:tag :lvr
      :symbol ?xs}
 :prt {:tag :prt
       :left {:tag :cat
              :elements ({:tag :lvr :symbol ?x1}
                         {:tag :lvr :symbol ?x2})}
       :right {:tag :cat
               :elements []}}}
raw docstring

parse-setclj/s

(parse-set s env)

postwalkclj/s

(postwalk f node)

postwalk-replaceclj/s

(postwalk-replace smap form)

Same as clojure.walk/postwal-replace but for AST nodes.

Same as clojure.walk/postwal-replace but for AST nodes.
raw docstring

prewalkclj/s

(prewalk f node)

prewalk-replaceclj/s

(prewalk-replace smap form)

Same as clojure.walk/prewalk-replace but for AST nodes.

Same as clojure.walk/prewalk-replace but for AST nodes.
raw docstring

proper-subnodesclj/s

(proper-subnodes node)

Return the all subnodes in node excluding node.

Return the all subnodes in node excluding node.
raw docstring

ref-node?clj/s

(ref-node? x)

true if x is a :ref node, false otherwise.

true if x is a :ref node, false otherwise.
raw docstring

ref-sym?clj/s

(ref-sym? x)

referencesclj/s

(references node)

Return all :ref nodes in node.

Return all :ref nodes in node.
raw docstring

rename-refsclj/s

(rename-refs node)

Give all distinct :ref nodes a unique :symbol.

Give all distinct :ref nodes a unique :symbol.
raw docstring

search?clj/smultimethod

(search? node)

true if node represents a search, false otherwise.

true if node represents a search, false otherwise.
raw docstring

subnodesclj/s

(subnodes node)

Return a sequence of all subnodes of node.

Return a sequence of all subnodes of node.
raw docstring

substitute-refsclj/s

(substitute-refs node)
(substitute-refs node ref-map)

Given node and an optional ref-map

Given node and an optional ref-map 
raw docstring

tagclj/s

(tag node)

Return the tag of node.

Return the tag of node.
raw docstring

top-levelclj/s

(top-level node)

unparseclj/smultimethod

(unparse node)

In pre-order fashion rewrite a node into a Clojure form.

In pre-order fashion rewrite a node into a Clojure form.
raw docstring

variable-length?clj/s

(variable-length? node)

true if node may have a variable length, false otherwise. Note this function will throw an error if node does not implement methods for both min-length and max-length.

true if node may have a variable length, false otherwise. Note this
function will throw an error if node does not implement methods for
both min-length and max-length.
raw docstring

variable-node?clj/s

(variable-node? x)

variablesclj/s

(variables node)

Return all :lvr and :mvr nodes in node.

Return all :lvr and :mvr nodes in node.
raw docstring

walkclj/smultimethod

(walk inner outer node)

Same as clojure.walk/walk but for AST nodes.

Same as clojure.walk/walk but for AST nodes.
raw docstring

with-node?clj/s

(with-node? x)

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

× close