The current collection context e.g. :vector, :seq, etc.
The current collection context e.g. :vector, :seq, etc.
(analyze-find-args match-args)
(analyze-find-args match-args env)
Analyzes arguments as would be supplied to the find macro e.g.
(expr clause action ,,,)
Returns a map containing the following keys:
:errors A sequence of errors. These are instances of
clojure.lang.Exception and are derived by applying
meander.match.check.epsilon/check
to the pattern of each clause.
:expr The expression which is the target of pattern matching, the
first argument to the match macro.
:matrix The pattern matrix derived from the (clause action ,,,)
forms. Each action expression is wrapped in a list.
Analyzes arguments as would be supplied to the find macro e.g. (expr clause action ,,,) Returns a map containing the following keys: :errors A sequence of errors. These are instances of clojure.lang.Exception and are derived by applying `meander.match.check.epsilon/check` to the pattern of each clause. :expr The expression which is the target of pattern matching, the first argument to the match macro. :matrix The pattern matrix derived from the (clause action ,,,) forms. Each action expression is wrapped in a list.
(analyze-match-args match-args)
(analyze-match-args match-args env)
Analyzes arguments as would be supplied to the match macro e.g.
(expr clause action ,,,)
Returns a map containing the following keys:
:errors A sequence of errors. These are instances of
clojure.lang.Exception and are derived by applying
meander.match.check.epsilon/check
to the pattern of each clause.
:expr The expression which is the target of pattern matching, the
first argument to the match macro.
:exhaustive? Boolean value indicating whether or not the match
clauses are exhaustive. true if :final-clause is present, false
otherwise.
:final-clause The pattern matrix row which is the first catch-all
pattern matching clause.
:matrix The pattern matrix derived from the (clause action ,,,)
forms. If :final-clause is present contains all of the rows above
:final-clause and none of the rows below it.
Analyzes arguments as would be supplied to the match macro e.g. (expr clause action ,,,) Returns a map containing the following keys: :errors A sequence of errors. These are instances of clojure.lang.Exception and are derived by applying `meander.match.check.epsilon/check` to the pattern of each clause. :expr The expression which is the target of pattern matching, the first argument to the match macro. :exhaustive? Boolean value indicating whether or not the match clauses are exhaustive. true if :final-clause is present, false otherwise. :final-clause The pattern matrix row which is the first catch-all pattern matching clause. :matrix The pattern matrix derived from the (clause action ,,,) forms. If :final-clause is present contains all of the rows above :final-clause and none of the rows below it.
(analyze-search-args match-args)
(analyze-search-args match-args env)
Analyzes arguments as would be supplied to the search macro e.g.
(expr clause action ,,,)
Returns a map containing the following keys:
:errors A sequence of errors. These are instances of
clojure.lang.Exception and are derived by applying
meander.match.check.epsilon/check
to the pattern of each clause.
:expr The expression which is the target of pattern matching, the
first argument to the match macro.
:matrix The pattern matrix derived from the (clause action ,,,)
forms. Each action expression is wrapped in a list.
Analyzes arguments as would be supplied to the search macro e.g. (expr clause action ,,,) Returns a map containing the following keys: :errors A sequence of errors. These are instances of clojure.lang.Exception and are derived by applying `meander.match.check.epsilon/check` to the pattern of each clause. :expr The expression which is the target of pattern matching, the first argument to the match macro. :matrix The pattern matrix derived from the (clause action ,,,) forms. Each action expression is wrapped in a list.
(compile targets matrix)
Compile the pattern matrix with respect to targets to a decision tree.
Compile the pattern matrix with respect to targets to a decision tree.
(compile-ground node)
Compile node as a literal if possible.
Compile node as a literal if possible.
(compile-specialized-matrix tag targets matrix)
Compile the matrix specialized for tag with respect to targets to a sequence of decision trees.
Compile the matrix specialized for tag with respect to targets to a sequence of decision trees.
(find x & clauses)
(find & match-args)
Like search
but returns only the first successful match.
Like `search` but returns only the first successful match.
(js-array-context?)
true if the current value of collect-context is :js-array.
true if the current value of *collect-context* is :js-array.
(literal? node)
true if node is ground and does not contain :map or :set subnodes, false otherwise.
The constraint that node may not contain :map or :set subnodes is due to the semantics of map and set patterns: they express submap and subsets respectively. Compiling these patterns to literals as part of an equality check would result in false negative matches.
See also: compile-ground
true if node is ground and does not contain :map or :set subnodes, false otherwise. The constraint that node may not contain :map or :set subnodes is due to the semantics of map and set patterns: they express submap and subsets respectively. Compiling these patterns to literals as part of an equality check would result in false negative matches. See also: compile-ground
(match x & clauses)
(match & match-args)
Traditional pattern matching operator.
Syntax
(match x
pattern_1 expr_1
,,,
pattern_n expr_n)
Attempts to pattern match x
against one of patterns pattern_1
through pattern_n
. If some pattern pattern_i
matches
successfully, expr_i
will be executed. If none of the patterns
match successfully an error will be thrown indicating the pattern
match failed.
This operator restricts patterns which may have several possible solutions. For example, the pattern
#{?x ?y}
matches any set with at least two elements. However, with
consideration to the property that Clojure sets are unordered, there
are many possible ways we could bind values for ?x
and
?y
. Because there is no obvious way to know which solution to
pick, patterns which have this property are illegal in the context
of this operator.
For operators which relax this restriction, see find
and search
.
Traditional pattern matching operator. Syntax (match x pattern_1 expr_1 ,,, pattern_n expr_n) Attempts to pattern match `x` against one of patterns `pattern_1` through `pattern_n`. If some pattern `pattern_i` matches successfully, `expr_i` will be executed. If none of the patterns match successfully an error will be thrown indicating the pattern match failed. This operator restricts patterns which may have several possible solutions. For example, the pattern #{?x ?y} matches any set with at least two elements. However, with consideration to the property that Clojure sets are unordered, there are many possible ways we could bind values for `?x` and `?y`. Because there is no obvious way to know which solution to pick, patterns which have this property are illegal in the context of this operator. For operators which relax this restriction, see `find` and `search`.
(negating?)
true if currently compiling a matrix derived from a not pattern, false otherwise.
true if currently compiling a matrix derived from a not pattern, false otherwise.
(prioritize-matrix targets matrix)
Reorganizes a the pattern targets and matrix columns according to the score of each column. Columns are resorted from lowest to highest score.
Reorganizes a the pattern targets and matrix columns according to the score of each column. Columns are resorted from lowest to highest score.
(search x & clauses)
(search & match-args)
Like match
but allows for patterns which may match x
in more
than one way. Returns a lazy sequence of expression values in
depth-first order.
Example
(search [1 2 3]
[!xs ... !ys ...]
{'!xs !xs, '!ys !ys})
;; =>
({!xs [], !ys [1 2 3]}
{!xs [1], !ys [2 3]}
{!xs [1 2], !ys [3]}
{!xs [1 2 3], !ys []})
Note, if only the first value is needed, use find
instead. The
expression
(first (search x ,,,))
can be significantly slower than
(find x ,,,)
Like `match` but allows for patterns which may match `x` in more than one way. Returns a lazy sequence of expression values in depth-first order. Example (search [1 2 3] [!xs ... !ys ...] {'!xs !xs, '!ys !ys}) ;; => ({!xs [], !ys [1 2 3]} {!xs [1], !ys [2 3]} {!xs [1 2], !ys [3]} {!xs [1 2 3], !ys []}) Note, if only the first value is needed, use `find` instead. The expression (first (search x ,,,)) can be significantly slower than (find x ,,,)
(solved? node env)
true if all logic variables occuring in node are bound in env and node is free of memory variables, false otherwise.
true if all logic variables occuring in node are bound in env and node is free of memory variables, false otherwise.
(specialize-matrix tag matrix)
Retains rows of the matrix whose tag is tag or :any
.
Retains rows of the matrix whose tag is tag or `:any`.
(vector-context?)
true if the current value of collect-context is :vector.
true if the current value of *collect-context* is :vector.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close