Generic universe-construction helpers: narrowing down a collection of
candidate items (maps, or anything get works on) before constraints are
built. Nothing here knows what an item represents - callers supply the
key/column names.
Generic universe-construction helpers: narrowing down a collection of candidate items (maps, or anything `get` works on) before constraints are built. Nothing here knows what an item represents - callers supply the key/column names.
(exclude-values universe k excluded)Drop items whose (get item k) is in excluded (a collection or set).
Drop items whose `(get item k)` is in `excluded` (a collection or set).
(exclude-values-all universe exclusions)Apply exclude-values for each [k excluded] pair.
Apply `exclude-values` for each `[k excluded]` pair.
(keep-values universe k included)Keep only items whose (get item k) is in included (a collection or set) -
e.g. restrict a universe to index constituents or currently-held names.
Keep only items whose `(get item k)` is in `included` (a collection or set) - e.g. restrict a universe to index constituents or currently-held names.
(range-cut universe k [mn mx])Keep only items where (get item k) falls within [min max] inclusive.
Uses compare, not <=, so it works for any Comparable (numbers, strings,
dates, ...), not just numbers.
Keep only items where `(get item k)` falls within `[min max]` inclusive. Uses `compare`, not `<=`, so it works for any Comparable (numbers, strings, dates, ...), not just numbers.
(range-cut-all universe cuts)Apply a sequence of [k min max] range cuts in turn.
Apply a sequence of `[k min max]` range cuts in turn.
(require-numeric universe ks)Drop items where (get item k) is missing or NaN, for each k in ks.
Useful before an optimisation target or risk constraint that needs a real
number for every surviving item.
Drop items where `(get item k)` is missing or NaN, for each `k` in `ks`. Useful before an optimisation target or risk constraint that needs a real number for every surviving item.
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 |