8.9 KiB
Cheat Sheet
Most of Specter's API consists of an operation, a path and the data to operate on.
Generally usage is like this:
(Operation Path Data)
where
Operation: Query|Transform
Path: Navigator|Vector of Navigators
Data: User-provided data structure to operate on.
Refer to the specific API documentation to check usage.
Operations
There are 2 types of operations: queries and transforms.
Query
select, select-any, select-first, select-one, select-one!, selected-any?, traverse, traverse-all
Transform
transform, multi-transform, replace-in, setval
Paths
A path (often named apath) is a navigator or a vector of navigators.
Navigator sometimes operates on specific data structures.
Maps
MAP-KEYS, MAP-VALS, keypath, map-key, submap, must
Sequences
ALL, ALL-WITH-META, AFTER-ELEM, BEFORE-ELEM, BEGINNING, END, FIRST, INDEXED-VALS, LAST
before-index, continuous-subseqs, filterer, index-nav, nthpath, srange, srange-dynamic
Sets
Keywords/Symbols
Atoms
Strings
BEGINNING, END, FIRST, LAST, regex-nav, srange
Metadata
Views
NIL->LIST, NIL->SET, NIL->VECTOR, nil->val, parser, subselect, transformed, traversed, view
Value collection
DISPENSE, VAL, collect, collect-one, collected?, putval, with-fresh-collected
Control
STAY, STOP, comp-paths, cond-path, continue-then-stay, if-path, multi-path, stay-then-continue
Filters
pred, pred=, pred<, pred>, pred<=, pred>=, not-selected?, selected?
Walking
Multi-transform
Extending Specter
Custom paths
declarepath, defprotocolpath, extend-protocolpath, path, providepath, recursive-path