Provides a 'hierarchical set' data structure. See hier-set for details.
Provides a 'hierarchical set' data structure. See `hier-set` for details.
(hier-set hcontains? & keys)Creates a hierarchical set with the containment predicate hcontains? and
primary members keys. The hcontains? predicate should be a function with
two arguments of the set element type. It should return true if the first
argument contains the second, and false otherwise.
A hierarchical set is a set of elements that can contain other elements
hierarchically. The element sort-order and the hcontains? predicate define
the hierarchical relationship. These constraints apply: (a) elements must sort
before any descendants; and (b) elements must contain all elements that sort
between themselves and any descendant. This means (hcontains? x x) must be
true. Elements are both ancestors and descendants of themselves.
Lookup in the set returns a seq of all primary members that are ancestors of the provided key. It returns nil if the provided key is not a descendant of a primary member.
Creates a hierarchical set with the containment predicate `hcontains?` and primary members `keys`. The `hcontains?` predicate should be a function with two arguments of the set element type. It should return `true` if the first argument contains the second, and false otherwise. A hierarchical set is a set of elements that can contain other elements hierarchically. The element sort-order and the `hcontains?` predicate define the hierarchical relationship. These constraints apply: (a) elements must sort before any descendants; and (b) elements must contain all elements that sort between themselves and any descendant. This means `(hcontains? x x)` must be true. Elements are both ancestors and descendants of themselves. Lookup in the set returns a seq of all primary members that are ancestors of the provided key. It returns nil if the provided key is not a descendant of a primary member.
(hier-set-by hcontains? comparator & keys)Like hier-set, but specifies the comparator for element comparison.
Like hier-set, but specifies the comparator for element comparison.
Defines operations on collections with hierarchical relationships.
Defines operations on collections with hierarchical relationships.
(ancestors coll key)(ancestors coll key strict?)Returns a lazy sequence of all ancestors of key in coll. Do not
include key when strict? is true. The default is false.
Returns a lazy sequence of all ancestors of `key` in `coll`. Do not include `key` when `strict?` is true. The default is false.
(descendants coll key)(descendants coll key strict?)Returns a lazy sequence of all descendants of key in coll. Do not
include key when strict? is true. The default is false.
Returns a lazy sequence of all descendants of `key` in `coll`. Do not include `key` when `strict?` is true. The default is false.
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 |