Liking cljdoc? Tell your friends :D

pattern.matchers.map

Matchers defined in this namespace are not available during bootstrap.

Because of that, they do have access to all of the features of the library.

Matchers defined in this namespace are not available during bootstrap.

Because of that, they do have access to all of the features of the library.
raw docstring

match-*mapclj

(match-*map [_ k v] comp-env)

Create a ?:*map matcher than can match a key/value pair multiple times.

Create a ?:*map matcher than can match a key/value pair multiple times.
raw docstring

match-+mapclj

(match-+map [_ k v] comp-env)

Create a ?:+map matcher than can match a key/value pair at least once.

Create a ?:+map matcher than can match a key/value pair at least once.
raw docstring

match-in-mapclj

(match-in-map [t & kvs] comp-env)

match-mapclj

(match-map [t & kv-pairs :as pattern] comp-env)

Match map datastructures. For instance to match {:from 1 :to 10}:

(?:map :from ?f :to ?t)

These would both work identically because the matcher will do some simple organization of the terms to try to maximize efficiency:

(?:map :addr ?addr ?addr ?info) (?:map ?addr ?info :addr ?addr)

If the pattern contains multiple keys meant to match the same key of the map, it will never match because after a key is matched, it is removed from the map matched by the next key/value matcher pair. Use & and | in either key or value position to apply multiple patterns to a single data key or value.

This matcher does not fail if there are extra keys in the map it's matching against unless you wrap them in ?:closed. To rule out specific keys, you can use ?:not matchers or predicates. For exact map matches, just use a literal map directly in the matcher.

Match map datastructures. For instance to match {:from 1 :to 10}:

    (?:map :from ?f :to ?t)

These would both work identically because the matcher will do some simple
organization of the terms to try to maximize efficiency:

   (?:map :addr ?addr ?addr ?info)
   (?:map ?addr ?info :addr ?addr)

If the pattern contains multiple keys meant to match the same key of the map,
it will never match because after a key is matched, it is removed from the
map matched by the next key/value matcher pair. Use `&` and `|` in either key
or value position to apply multiple patterns to a single data key or value.

This matcher does not fail if there are extra keys in the map it's matching
against unless you wrap them in ?:closed. To rule out specific keys, you can
use ?:not matchers or predicates.  For exact map matches, just use a literal
map directly in the matcher.
raw docstring

match-map-literalclj

(match-map-literal the-map comp-env)

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

× close