Liking cljdoc? Tell your friends :D

wagoe.audience.core.composition

AND/OR/NOT composition of audience segment result sets. FC/IS rule: pure functions only — no I/O, no side effects.

Well-formedness (unknown operator, NOT-inside-OR, circular/unknown/invalid segment refs) is checked up front by explain-composition; the shell validates a composition tree before evaluating it and raises the typed error at the HTTP boundary. The evaluation functions below therefore assume a valid tree and never throw — their error branches fail safe (an empty result set, and the cycle guard still terminates).

AND/OR/NOT composition of audience segment result sets.
FC/IS rule: pure functions only — no I/O, no side effects.

Well-formedness (unknown operator, NOT-inside-OR, circular/unknown/invalid
segment refs) is checked up front by `explain-composition`; the shell
validates a composition tree before evaluating it and raises the typed error
at the HTTP boundary. The evaluation functions below therefore assume a valid
tree and never throw — their error branches fail safe (an empty result set,
and the cycle guard still terminates).
raw docstring

compose-resultsclj

(compose-results tree)

Evaluate a composition tree whose leaves are {:user-ids #{...}} maps.

Supported operators (as map keys): :and — intersection of all positive children; subtract :not children :or — union of all children

Returns: a set of user IDs.

Evaluate a composition tree whose leaves are {:user-ids #{...}} maps.

Supported operators (as map keys):
  :and  — intersection of all positive children; subtract :not children
  :or   — union of all children

Returns: a set of user IDs.
sourceraw docstring

explain-compositionclj

(explain-composition tree lookup)

Return {:error {...}} for the first structural or reference problem in the composition tree (unknown operator, NOT-inside-OR, unknown/circular/invalid segment ref), or nil when the tree is well-formed and every ref resolves. Pure; lookup is (fn [id] -> segment-map-or-nil).

Return {:error {...}} for the first structural or reference problem in the
composition tree (unknown operator, NOT-inside-OR, unknown/circular/invalid
segment ref), or nil when the tree is well-formed and every ref resolves.
Pure; `lookup` is (fn [id] -> segment-map-or-nil).
sourceraw docstring

resolve-and-composeclj

(resolve-and-compose tree lookup)

Evaluate a composition tree that may contain {:ref :keyword} leaves.

Refs are resolved via lookup: (fn [id] -> {:user-ids #{...}} | {:compose {...}} | nil)

Assumes the tree has been validated by explain-composition (the shell does this and raises on error). Returns a set of user IDs; malformed input fails safe to an empty set and always terminates.

Returns: a set of user IDs.

Evaluate a composition tree that may contain {:ref :keyword} leaves.

Refs are resolved via lookup:
  (fn [id] -> {:user-ids #{...}} | {:compose {...}} | nil)

Assumes the tree has been validated by `explain-composition` (the shell does
this and raises on error). Returns a set of user IDs; malformed input fails
safe to an empty set and always terminates.

Returns: a set of user IDs.
sourceraw docstring

resolve-and-compose*clj

(resolve-and-compose* tree lookup visited)

Internal recursive implementation. tree - composition map with possible {:ref ...} leaves lookup - (fn [id] -> segment-map-or-nil) visited - set of already-resolving ids

Internal recursive implementation.
tree     - composition map with possible {:ref ...} leaves
lookup   - (fn [id] -> segment-map-or-nil)
visited  - set of already-resolving ids
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close