Liking cljdoc? Tell your friends :D
Clojure only.

clj-foundation.grep

Unix-style grep for arbitrary Clojure nested collections. Returns container(s) with at least one element matching a literal, regex, substring, or predicate.

Examples:

(grep 42 {:1 {:a 11} :2 {:b 42}}) => {:b 42} (grep #"[0-9]" [{:a "42"} {:b "Hello, world"}]) => {:a "42"} (grep "world" [{:1 "Hello"} {:1 "Hello, world"}]) => {:1 "Hello, world"} (grep zero? [[1 2 3] [4 5 6] [7 8 9] [0 1 2]]) => [0 1 2]

Unix-style grep for arbitrary Clojure nested collections.  Returns container(s) with at
least one element matching a literal, regex, substring, or predicate.

Examples:

(grep 42         {:1 {:a 11} :2 {:b 42}})                => {:b 42}
(grep #"[0-9]" [{:a "42"} {:b "Hello, world"}])    => {:a "42"}
(grep "world"  [{:1 "Hello"} {:1 "Hello, world"}]) => {:1 "Hello, world"}
(grep zero?      [[1 2 3] [4 5 6] [7 8 9] [0 1 2]])      => [0 1 2]
raw docstring

grepclj

(grep pattern node & node-transformers)

Recursively grep the contents of node for elements matching pattern. Pattern can be any type:

  • If pattern is a regular expression, it is matched against (.toString obj).
  • String patterns match any substring of (.toString obj).
  • If pattern is a function then the truthiness of (pattern node) determines matches.
  • All other types must match literally.

node-transformers (if specified) are arity 1 functions (e.g.: clojure.string/upper-case) that transform the node before the pattern is matched against it. These are applied in the order specified before matching.

Returns [[breadcrumb1 match1-parent] [breadcrumb2 match2-parent] ... [breadcrumbn matchn-parent]]

Recursively grep the contents of node for elements matching pattern.  Pattern can be
any type:

* If pattern is a regular expression, it is matched against (.toString obj).
* String patterns match any substring of (.toString obj).
* If pattern is a function then the truthiness of (pattern node) determines matches.
* All other types must match literally.

node-transformers (if specified) are arity 1 functions (e.g.: clojure.string/upper-case) that
transform the node before the pattern is matched against it.  These are applied in the order
specified before matching.

Returns [[breadcrumb1 match1-parent] [breadcrumb2 match2-parent] ... [breadcrumbn matchn-parent]]
sourceraw docstring

grep-nodesclj

(grep-nodes pattern node & node-transformers)

Recursively grep the contents of node for elements matching pattern. Pattern can be any type:

  • If pattern is a regular expression, it is matched against (.toString obj).
  • String patterns match any substring of (.toString obj).
  • If pattern is a function then the truthiness of (pattern node) determines matches.
  • All other types must match literally.

node-transformers (if specified) are arity 1 functions (e.g.: clojure.string/upper-case) that transform the node before the pattern is matched against it. These are applied in the order specified before matching.

Returns [[breadcrumb1 match1-node] [breadcrumb2 match2-node] ... [breadcrumbn matchn-node]]

where the node objects are the clojure.zip visitor nodes corresponding to the matches.

Use the functions inside clojure.zip to traverse the object graph from the match node locations and to retrieve the value(s) you want to manipulate.

Recursively grep the contents of node for elements matching pattern.  Pattern can be
any type:

* If pattern is a regular expression, it is matched against (.toString obj).
* String patterns match any substring of (.toString obj).
* If pattern is a function then the truthiness of (pattern node) determines matches.
* All other types must match literally.

node-transformers (if specified) are arity 1 functions (e.g.: clojure.string/upper-case) that
transform the node before the pattern is matched against it.  These are applied in the order
specified before matching.

Returns [[breadcrumb1 match1-node] [breadcrumb2 match2-node] ... [breadcrumbn matchn-node]]

where the node objects are the clojure.zip visitor nodes corresponding to the matches.

Use the functions inside clojure.zip to traverse the object graph from the match node locations
and to retrieve the value(s) you want to manipulate.
sourceraw docstring

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

× close