(sub? sub x)true if sub is either nil, equal to x, or a recursive
subcollection of x.
If sub is a sequential collection of size N the first N elements of
x are tested. If sub is a map every value in sub is tested with
the corresponding value in x. If sub is a set every key in sub
should exist in x.
Examples:
(sub? nil
{:anything :at-all})
(sub? [:a :b]
[:a :b :c])
(not (sub? [:a :b :c]
[:a :b]))
(sub? {:a [1 2 3]}
{:a [1 2 3 4] :b 2})
(sub? {:a [1 nil 3]}
{:a [1 2 3 4] :b 2})
(not (sub? {:a [1 2 3 4]}
{:a [1 2 3] :b 2}))
(sub? #{:a}
{:a 1 :b 2})
(sub? #{:a}
#{:a :b})
(not (sub? #{:a :c}
#{:a :b}))
(sub? :something
:something)
(sub? [:1 :2 :3]
(list :1 :2 :3))
(sub? [:1 :2]
(list :1 :2 :3))
(sub? (list :1 :2 :3)
[:1 :2 :3])
(not (sub? (list nil 2)
[:1 :2 :3]))
true if `sub` is either `nil`, equal to `x`, or a recursive
subcollection of `x`.
If sub is a sequential collection of size N the first N elements of
`x` are tested. If sub is a map every value in sub is tested with
the corresponding value in `x`. If `sub` is a set every *key* in sub
should exist in `x`.
**Examples:**
(sub? nil
{:anything :at-all})
(sub? [:a :b]
[:a :b :c])
(not (sub? [:a :b :c]
[:a :b]))
(sub? {:a [1 2 3]}
{:a [1 2 3 4] :b 2})
(sub? {:a [1 nil 3]}
{:a [1 2 3 4] :b 2})
(not (sub? {:a [1 2 3 4]}
{:a [1 2 3] :b 2}))
(sub? #{:a}
{:a 1 :b 2})
(sub? #{:a}
#{:a :b})
(not (sub? #{:a :c}
#{:a :b}))
(sub? :something
:something)
(sub? [:1 :2 :3]
(list :1 :2 :3))
(sub? [:1 :2]
(list :1 :2 :3))
(sub? (list :1 :2 :3)
[:1 :2 :3])
(not (sub? (list nil 2)
[:1 :2 :3]))
(test-async ch)Asynchronous test awaiting ch to produce a value or close.
Asynchronous test awaiting ch to produce a value or close.
(test-within ms ch)Asserts that ch does not close or produce a value within ms. Returns a channel from which the value can be taken.
Asserts that ch does not close or produce a value within ms. Returns a channel from which the value can be taken.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |