com.rpl.specter.macros
declarepath
macro
(declarepath name)(declarepath name params)
defcollector
macro
(defcollector name & body)
defnav
macro
(defnav name & body)
defnavconstructor
macro
(defnavconstructor name & args)
defpathedfn
macro
(defpathedfn name & args)
Defines a higher order navigator that itself takes in one or more paths
as input. This macro is generally used in conjunction with [[fixed-pathed-nav]]
or [[variable-pathed-nav]]. When inline factoring is applied to a path containing
one of these higher order navigators, it will automatically interepret all
@@ -8,7 +8,7 @@ arguments as paths, factor them accordingly, and set up the callsite to
provide the parameters dynamically. Use ^:notpath metadata on arguments
to indicate non-path arguments that should not be factored – note that in order
to be inline factorable, these arguments must be statically resolvable (e.g. a
-top level var). See `transformed` for an example.
defprotocolpath
macro
(defprotocolpath name)(defprotocolpath name params)
Defines a navigator that chooses the path to take based on the type
+top level var). See `transformed` for an example.
defprotocolpath
macro
(defprotocolpath name)(defprotocolpath name params)
Defines a navigator that chooses the path to take based on the type
of the value at the current point. May be specified with parameters to
specify that all extensions must require that number of parameters.
@@ -23,50 +23,50 @@ Example of usage:
SingleAccount :funds
FamilyAccount [ALL FundsPath]
)
-
extend-protocolpath
macro
(extend-protocolpath protpath & extensions)
Used in conjunction with `defprotocolpath`. See [[defprotocolpath]].
-
fixed-pathed-nav
macro
(fixed-pathed-nav bindings impl1 impl2)
This helper is used to define navigators that take in a fixed number of other
+
extend-protocolpath
macro
(extend-protocolpath protpath & extensions)
Used in conjunction with `defprotocolpath`. See [[defprotocolpath]].
+
fixed-pathed-nav
macro
(fixed-pathed-nav bindings impl1 impl2)
This helper is used to define navigators that take in a fixed number of other
paths as input. Those paths may require late-bound params, so this helper
will create a parameterized navigator if that is the case. If no late-bound params
-are required, then the result is executable.
nav
macro
(nav params impl1 impl2)
Defines a navigator with late bound parameters. This navigator can be precompiled
+are required, then the result is executable.
nav
macro
(nav params impl1 impl2)
Defines a navigator with late bound parameters. This navigator can be precompiled
with other navigators without knowing the parameters. When precompiled with other
navigators, the resulting path takes in parameters for all navigators in the path
-that needed parameters (in the order in which they were declared).
paramscollector
macro
(paramscollector params impl)
Defines a Collector with late bound parameters. This collector can be precompiled
+that needed parameters (in the order in which they were declared).
paramscollector
macro
(paramscollector params impl)
Defines a Collector with late bound parameters. This collector can be precompiled
with other selectors without knowing the parameters. When precompiled with other
selectors, the resulting selector takes in parameters for all selectors in the path
that needed parameters (in the order in which they were declared).
-
paramsfn
macro
(paramsfn params [structure-sym] & impl)
path
macro
(path & path)
Same as calling comp-paths, except it caches the composition of the static part
+
paramsfn
macro
(paramsfn params [structure-sym] & impl)
path
macro
(path & path)
Same as calling comp-paths, except it caches the composition of the static part
of the path for later re-use (when possible). For almost all idiomatic uses
of Specter provides huge speedup. This macro is automatically used by the
-select/transform/setval/replace-in/etc. macros.
pathed-collector
macro
(pathed-collector [name path] impl)
This helper is used to define collectors that take in a single selector
+select/transform/setval/replace-in/etc. macros.
pathed-collector
macro
(pathed-collector [name path] impl)
This helper is used to define collectors that take in a single selector
paths as input. That path may require late-bound params, so this helper
will create a parameterized selector if that is the case. If no late-bound params
-are required, then the result is executable.
providepath
macro
(providepath name apath)
replace-in
macro
(replace-in apath transform-fn structure & args)
Similar to transform, except returns a pair of [transformed-structure sequence-of-user-ret].
+are required, then the result is executable.
providepath
macro
(providepath name apath)
replace-in
macro
(replace-in apath transform-fn structure & args)
Similar to transform, except returns a pair of [transformed-structure sequence-of-user-ret].
The transform-fn in this case is expected to return [ret user-ret]. ret is
what's used to transform the data structure, while user-ret will be added to the user-ret sequence
in the final return. replace-in is useful for situations where you need to know the specific values
of what was transformed in the data structure.
This macro will attempt to do inline factoring and caching of the path, falling
back to compiling the path on every invocation it it's not possible to
-factor/cache the path.
select
macro
(select apath structure)
Navigates to and returns a sequence of all the elements specified by the path.
+factor/cache the path.
select
macro
(select apath structure)
Navigates to and returns a sequence of all the elements specified by the path.
This macro will attempt to do inline factoring and caching of the path, falling
back to compiling the path on every invocation it it's not possible to
-factor/cache the path.
select-first
macro
(select-first apath structure)
Returns first element found. Not any more efficient than select, just a convenience.
+factor/cache the path.
select-first
macro
(select-first apath structure)
Returns first element found. Not any more efficient than select, just a convenience.
This macro will attempt to do inline factoring and caching of the path, falling
back to compiling the path on every invocation it it's not possible to
-factor/cache the path.
select-one
macro
(select-one apath structure)
Like select, but returns either one element or nil. Throws exception if multiple elements found.
+factor/cache the path.
select-one
macro
(select-one apath structure)
Like select, but returns either one element or nil. Throws exception if multiple elements found.
This macro will attempt to do inline factoring and caching of the path, falling
back to compiling the path on every invocation it it's not possible to
-factor/cache the path.
select-one!
macro
(select-one! apath structure)
Returns exactly one element, throws exception if zero or multiple elements found.
+factor/cache the path.
select-one!
macro
(select-one! apath structure)
Returns exactly one element, throws exception if zero or multiple elements found.
This macro will attempt to do inline factoring and caching of the path, falling
back to compiling the path on every invocation it it's not possible to
-factor/cache the path.
setval
macro
(setval apath aval structure)
Navigates to each value specified by the path and replaces it by `aval`.
+factor/cache the path.
setval
macro
(setval apath aval structure)
Navigates to each value specified by the path and replaces it by `aval`.
This macro will attempt to do inline factoring and caching of the path, falling
back to compiling the path on every invocation it it's not possible to
-factor/cache the path.
variable-pathed-nav
macro
(variable-pathed-nav [latepaths-seq-sym paths-seq] impl1 impl2)
This helper is used to define navigators that take in a variable number of other
+factor/cache the path.
variable-pathed-nav
macro
(variable-pathed-nav [latepaths-seq-sym paths-seq] impl1 impl2)
This helper is used to define navigators that take in a variable number of other
paths as input. Those paths may require late-bound params, so this helper
will create a parameterized navigator if that is the case. If no late-bound params
-are required, then the result is executable.
\ No newline at end of file
+are required, then the result is executable.