Liking cljdoc? Tell your friends :D

meander.match.epsilon


*collection-context*clj/s

The current collection context e.g. :vector, :seq, etc.

The current collection context e.g. :vector, :seq, etc.
sourceraw docstring

*negating*clj/s

sourceraw docstring

analyze-find-argsclj/s

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

analyze-match-argsclj/s

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

analyze-search-argsclj/s

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

compileclj/s

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

compile-groundclj/s

(compile-ground node)

Compile node as a literal if possible.

Compile node as a literal if possible.
sourceraw docstring

compile-specialized-matrixclj/smultimethod

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

compile-wth-matrixclj/s

(compile-wth-matrix targets matrix)
source

findclj/s≠macro

clj
(find x & clauses)
cljs
(find & match-args)

Like search but returns only the first successful match.

Like `search` but returns only the first successful match.
source (clj)source (cljs)raw docstring

find-search-keys-recursiveclj/s

(find-search-keys-recursive env [k v])
source

js-array-context?clj/s

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

literal?clj/s

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

matchclj/s≠macro

clj
(match x & clauses)
cljs
(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`.
source (clj)source (cljs)raw docstring

negating?clj/s

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

prioritize-matrixclj/s

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

clj
(search x & clauses)
cljs
(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 ,,,)
source (clj)source (cljs)raw docstring

solved?clj/s

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

sort-by-search-keysclj/s

(sort-by-search-keys the-map env)
source

specialize-matrixclj/s

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

vector-context?clj/s

(vector-context?)

true if the current value of collect-context is :vector.

true if the current value of *collect-context* is :vector.
sourceraw docstring

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

× close