2018-02-11 22:04:17 +00:00
|
|
|
# Cheat Sheet
|
|
|
|
|
|
|
|
|
|
Most of Specter's API consists of an operation, a path and the data to operate on.
|
|
|
|
|
|
|
|
|
|
## Operations
|
|
|
|
|
|
|
|
|
|
There are 2 types of operations: queries and transforms.
|
|
|
|
|
|
|
|
|
|
#### Query
|
|
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`select`, `select-any`, `select-first`, `select-one`, `select-one!`, `selected-any?`, `traverse-all`
|
2018-02-11 22:04:17 +00:00
|
|
|
|
|
|
|
|
#### 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
|
|
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`MAP-KEYS`, `MAP-VALS`, `keypath`, `map-key`, `submap`, `must`
|
2018-02-11 22:04:17 +00:00
|
|
|
|
|
|
|
|
#### Sequences
|
|
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`ALL`, `ALL-WITH-META`, `AFTER-ELEM`, `BEFORE-ELEM`, `BEGINNING`, `END`, `FIRST`, `INDEXED-VALS`, `LAST`
|
2018-02-11 22:04:17 +00:00
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`before-index`, `continuous-subseqs`, `filterer`, `index-nav`, `nthpath`, `srange`, `srange-dynamic`
|
2018-02-11 22:04:17 +00:00
|
|
|
|
|
|
|
|
#### Sets
|
|
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`NONE-ELEM`, `set-elem`, `subsets`
|
2018-02-11 22:04:17 +00:00
|
|
|
|
|
|
|
|
#### Keywords/Symbols
|
|
|
|
|
|
|
|
|
|
`NAME`, `NAMESPACE`
|
|
|
|
|
|
|
|
|
|
#### Atoms
|
|
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`ATOM`
|
2018-02-11 22:04:17 +00:00
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
#### Strings
|
2018-02-11 22:04:17 +00:00
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`BEGINNING`, `FIRST`, `END`, `LAST`, `regex-nav`, `srange`
|
2018-02-11 22:04:17 +00:00
|
|
|
|
|
|
|
|
#### Metadata
|
|
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`ALL-WITH-META`, `META`
|
2018-02-11 22:04:17 +00:00
|
|
|
|
|
|
|
|
#### Views
|
|
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`NIL->LIST`, `NIL->SET`, `NIL->VECTOR`, `nil->val`, `parser`, `subselect`, `transformed`, `traversed`, `view`
|
2018-02-11 22:04:17 +00:00
|
|
|
|
|
|
|
|
#### Value collection
|
|
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`DISPENSE`, `VAL`, `collect`, `collect-one`, `collected?`, `putval`, `with-fresh-collected`
|
2018-02-11 22:04:17 +00:00
|
|
|
|
|
|
|
|
#### Don't know yet
|
|
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`traverse`
|
2018-02-11 22:04:17 +00:00
|
|
|
|
|
|
|
|
#### Control
|
|
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`STAY`, `STOP`, `comp-path`, `cond-path`, `continue-then-stay`, `if-path`, `multi-path`, `stay-the-continue`
|
2018-02-11 22:04:17 +00:00
|
|
|
|
|
|
|
|
#### Filters
|
|
|
|
|
|
|
|
|
|
`pred`, `pred=`, `pred<`, `pred>`, `pred<=`, `pred>=`, `not-selected?`, `selected?`
|
|
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
#### Walking
|
|
|
|
|
|
|
|
|
|
`codewalker`, `walker`
|
|
|
|
|
|
2018-02-11 22:04:17 +00:00
|
|
|
#### Multi-transform
|
|
|
|
|
|
|
|
|
|
`terminal`, `terminal-val`
|
|
|
|
|
|
|
|
|
|
## Extending Specter
|
|
|
|
|
|
|
|
|
|
#### Custom paths
|
|
|
|
|
|
|
|
|
|
`declarepath`, `defprotocolpath`, `extend-protocolpath`, `path`, `providepath`, `recursive-path`
|
|
|
|
|
|
|
|
|
|
#### Custom collectors
|
|
|
|
|
|
|
|
|
|
`defcollector`
|
|
|
|
|
|
|
|
|
|
#### Custom navigators
|
|
|
|
|
|
2018-02-12 09:09:55 +00:00
|
|
|
`defdynamicnav`, `defnav`, `each-nav`, `nav`
|