Skip to content

Cheat Sheet

Nathan Marz edited this page Feb 13, 2018 · 14 revisions

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 two 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, vtransform

Navigators

Maps

ALL, MAP-KEYS, MAP-VALS, compact, keypath, map-key, submap, must

Sequences

ALL, ALL-WITH-META, AFTER-ELEM, BEFORE-ELEM, BEGINNING, END, FIRST, INDEXED-VALS, LAST

before-index, compact, continuous-subseqs, filterer, index-nav, nthpath, srange, srange-dynamic

Sets

ALL, NONE-ELEM, compact, set-elem, subset

Keywords/Symbols

NAME, NAMESPACE

Atoms

ATOM

Strings

BEGINNING, END, FIRST, LAST, regex-nav, srange

Metadata

ALL-WITH-META, META

Views

NIL->LIST, NIL->SET, NIL->VECTOR, nil->val, parser, transformed, traversed, view

Value collection

DISPENSE, VAL, collect, collect-one, collected?, putval, with-fresh-collected

Control

STAY, STOP, cond-path, continue-then-stay, if-path, multi-path, stay-then-continue, subselect

Filters

pred, pred=, pred<, pred>, pred<=, pred>=, not-selected?, selected?

Walking

codewalker, walker

Multi-transform

terminal, terminal-val, vterminal

Custom navigators

declarepath, defprotocolpath, extend-protocolpath, local-declarepath, path, providepath, recursive-path, defcollector, defdynamicnav, defnav, eachnav, nav