Public Variables and Functions
*match-lookup*
dynamic var
Allow map matching syntax to check for IMatchLookup
Source
*no-backtrack*
dynamic var
Flag to optimize performance over code size.
Source
*recur-present*
dynamic var
In the presence of recur we cannot apply code size optimizations
Source
*syntax-check*
dynamic var
Enable syntax check of match macros
Source
*vector-type*
dynamic var
Default vector type. Can be rebound allowing emission of
custom inline code for vector patterns, for example
type-hinted primitive array operations
Source
->AppPattern
function
Usage: (->AppPattern p form _meta)
Positional factory function for class clojure.core.match.AppPattern.
Source
->BindNode
function
Usage: (->BindNode bindings node)
Positional factory function for class clojure.core.match.BindNode.
Source
->FailNode
function
Usage: (->FailNode)
Positional factory function for class clojure.core.match.FailNode.
Source
->GuardPattern
function
Usage: (->GuardPattern p gs _meta)
Positional factory function for class clojure.core.match.GuardPattern.
Source
->LeafNode
function
Usage: (->LeafNode value bindings)
Positional factory function for class clojure.core.match.LeafNode.
Source
->LiteralPattern
function
Usage: (->LiteralPattern l _meta)
Positional factory function for class clojure.core.match.LiteralPattern.
Source
->MapKeyPattern
function
Usage: (->MapKeyPattern p)
Positional factory function for class clojure.core.match.MapKeyPattern.
Source
->MapPattern
function
Usage: (->MapPattern m _meta)
Positional factory function for class clojure.core.match.MapPattern.
Source
->OrPattern
function
Usage: (->OrPattern ps _meta)
Positional factory function for class clojure.core.match.OrPattern.
Source
->PatternMatrix
function
Usage: (->PatternMatrix rows ocrs)
Positional factory function for class clojure.core.match.PatternMatrix.
Source
->PatternRow
function
Usage: (->PatternRow ps action bindings)
Positional factory function for class clojure.core.match.PatternRow.
Source
->PredicatePattern
function
Usage: (->PredicatePattern p gs _meta)
Positional factory function for class clojure.core.match.PredicatePattern.
Source
->RestPattern
function
Usage: (->RestPattern p)
Positional factory function for class clojure.core.match.RestPattern.
Source
->SeqPattern
function
Usage: (->SeqPattern s _meta)
Positional factory function for class clojure.core.match.SeqPattern.
Source
->SwitchNode
function
Usage: (->SwitchNode occurrence cases default)
Positional factory function for class clojure.core.match.SwitchNode.
Source
->VectorPattern
function
Usage: (->VectorPattern v t size offset rest? _meta)
Positional factory function for class clojure.core.match.VectorPattern.
Source
->WildcardPattern
function
Usage: (->WildcardPattern sym named _meta)
Positional factory function for class clojure.core.match.WildcardPattern.
Source
backtrack
var
Pre-allocated exception used for backtracing
Source
emit-matrix
function
Usage: (emit-matrix vars clauses)
(emit-matrix vars clauses default)
Take the list of vars and sequence of unprocessed clauses and
return the pattern matrix. The pattern matrix contains the processed
pattern rows and the list of vars originally specified. Inserts
a last match - :else if provided by the user or a default match that
throws.
Source
emit-pattern
multimethod
No usage documentation available
Returns the corresponding pattern for the given syntax. Dispatches
on the class of its argument. For example, `[(:or 1 2) 2]` is dispatched
as clojure.lang.IPersistentVector
Source
emit-pattern-for-syntax
multimethod
No usage documentation available
Handles patterns wrapped in the special list syntax. Dispatches
on the first or second keyword in the list. For example, the pattern
`(:or 1 ...) is dispatches as :or, and `(1 :as a)` is dispatched by :as.
Source
empty-rows-case
function
Usage: (empty-rows-case)
Case 1: If there are no pattern rows to match, then matching always fails
Source
first-column-chosen-case
function
Usage: (first-column-chosen-case matrix col ocrs)
Case 3a: The first column is chosen. Compute and return a
switch/bind node with a default matrix case
Source
first-row-empty-case
function
Usage: (first-row-empty-case rows ocr)
Case 2: If the first row is empty then matching always succeeds
and yields the first action.
Source
first-row-wildcards-case
function
Usage: (first-row-wildcards-case rows ocrs)
Case 2: If the first row is constituted by wildcards then matching
matching always succeeds and yields the first action.
Source
group-keywords
function
Usage: (group-keywords pattern)
Returns a pattern with pattern-keywords (:when and :as) properly
grouped. The original pattern may use the 'flattened' syntax.
For example, a 'flattened' pattern row like [a b :when even?] is
grouped as [a (b :when even?)].
Source
groupable?
multimethod
No usage documentation available
Determine if two patterns may be grouped together for simultaneous
testing.
Source
map->BindNode
function
Usage: (map->BindNode m#)
Factory function for class clojure.core.match.BindNode, taking a map of keywords to field values.
Source
map->FailNode
function
Usage: (map->FailNode m#)
Factory function for class clojure.core.match.FailNode, taking a map of keywords to field values.
Source
map->LeafNode
function
Usage: (map->LeafNode m#)
Factory function for class clojure.core.match.LeafNode, taking a map of keywords to field values.
Source
map->MapKeyPattern
function
Usage: (map->MapKeyPattern m#)
Factory function for class clojure.core.match.MapKeyPattern, taking a map of keywords to field values.
Source
map->PatternMatrix
function
Usage: (map->PatternMatrix m#)
Factory function for class clojure.core.match.PatternMatrix, taking a map of keywords to field values.
Source
map->RestPattern
function
Usage: (map->RestPattern m#)
Factory function for class clojure.core.match.RestPattern, taking a map of keywords to field values.
Source
map->SwitchNode
function
Usage: (map->SwitchNode m#)
Factory function for class clojure.core.match.SwitchNode, taking a map of keywords to field values.
Source
match
macro
Usage: (match vars & clauses)
Pattern match a row of occurrences. Take a vector of occurrences, vars.
Clause question-answer syntax is like `cond`. Questions must be
wrapped in a vector, with same arity as vars. Last question can be :else,
which expands to a row of wildcards. Optionally may take a single
var not wrapped in a vector, questions then need not be wrapped in a
vector.
Example:
(let [x 1
y 2]
(match [x y 3]
[1 2 3] :answer1
:else :default-answer))
Source
matchm
macro
Usage: (matchm vars & clauses)
Same as match but supports IMatchLookup when
matching maps.
Source
other-column-chosen-case
function
Usage: (other-column-chosen-case matrix col)
Case 3b: A column other than the first is chosen. Swap column
col with the first column and compile the result
Source
process-vars
function
Usage: (process-vars vars)
Process the vars for the pattern matrix. If user provides an
expression, create a var and annotate via metadata with the
original expression.
Source
to-pattern-row
function
Usage: (to-pattern-row pat action)
Take an unprocessed pattern expression and an action expression and return
a pattern row of the processed pattern expression plus the action epxression.
Source
to-source
multimethod
No usage documentation available
Returns a Clojure form that, when executed, is truthy if the
pattern matches the occurrence. Dispatches on the `type` of the
pattern. For instance, a literal pattern might return `(= ~(:pattern
pattern) ~ocr)`, using `=` to test for a match.
Source
wildcards-and-duplicates
function
Usage: (wildcards-and-duplicates patterns)
Returns a vector of two elements: the set of all wildcards and the
set of duplicate wildcards. The underbar _ is excluded from both.
Source