From 22e3ddab00dea8f467924f02fc7d566b5967fcb0 Mon Sep 17 00:00:00 2001 From: Nathan Marz Date: Thu, 2 Jun 2016 12:03:15 -0400 Subject: [PATCH] add api docs --- com.rpl.specter.defhelpers.html | 3 + com.rpl.specter.html | 85 ++++++++++++++++++++++++++++ com.rpl.specter.macros.html | 22 +++++++ com.rpl.specter.prot-opt-invoke.html | 3 + com.rpl.specter.zipper.html | 15 +++++ index.html | 3 + 6 files changed, 131 insertions(+) create mode 100644 com.rpl.specter.defhelpers.html create mode 100644 com.rpl.specter.html create mode 100644 com.rpl.specter.macros.html create mode 100644 com.rpl.specter.prot-opt-invoke.html create mode 100644 com.rpl.specter.zipper.html create mode 100644 index.html diff --git a/com.rpl.specter.defhelpers.html b/com.rpl.specter.defhelpers.html new file mode 100644 index 0000000..5339846 --- /dev/null +++ b/com.rpl.specter.defhelpers.html @@ -0,0 +1,3 @@ + +com.rpl.specter.defhelpers documentation

com.rpl.specter.defhelpers

define-ParamsNeededPath

macro

(define-ParamsNeededPath clj? fn-type invoke-name var-arity-impl)

gensyms

(gensyms amt)
\ No newline at end of file diff --git a/com.rpl.specter.html b/com.rpl.specter.html new file mode 100644 index 0000000..5603d00 --- /dev/null +++ b/com.rpl.specter.html @@ -0,0 +1,85 @@ + +com.rpl.specter documentation

com.rpl.specter

ATOM

Navigates to atom value.
+

BEGINNING

bind-params*

Takes a compiled path that needs late-bound params and supplies it with
+an array of params and a position in the array from which to begin reading
+params. The return value is an executable selector.

codewalker

collect

(collect & path)

collect-one

(collect-one & path)

comp-paths

(comp-paths & paths)

compiled-replace-in

Version of replace-in that takes in a path precompiled with comp-paths
+

compiled-select

Version of select that takes in a path pre-compiled with comp-paths
+

compiled-select-first

Version of select-first that takes in a path pre-compiled with comp-paths
+

compiled-select-one

Version of select-one that takes in a path pre-compiled with comp-paths
+

compiled-select-one!

Version of select-one! that takes in a path pre-compiled with comp-paths
+

compiled-setval

Version of setval that takes in a path precompiled with comp-paths
+

compiled-transform

Version of transform that takes in a path pre-compiled with comp-paths
+

cond-path

(cond-path & conds)
Takes in alternating cond-path path cond-path path...
+Tests the structure if selecting with cond-path returns anything.
+If so, it uses the following path for this portion of the navigation.
+Otherwise, it tries the next cond-path. If nothing matches, then the structure
+is not selected.
+
+The input paths may be parameterized, in which case the result of cond-path
+will be parameterized in the order of which the parameterized navigators
+were declared.

continue-then-stay

(continue-then-stay & path)
Navigates to the provided path and then to the current element. This can be used
+to implement post-order traversal.

continuous-subseqs

Navigates to every continuous subsequence of elements matching `pred`
+

filterer

(filterer & path)
Navigates to a view of the current sequence that only contains elements that
+match the given path. An element matches the selector path if calling select
+on that element with the path yields anything other than an empty sequence.
+
+ The input path may be parameterized, in which case the result of filterer
+ will be parameterized in the order of which the parameterized selectors
+ were declared.

if-path

(if-path cond-p if-path)(if-path cond-p if-path else-path)
Like cond-path, but with if semantics.
+

keypath

Navigates to the specified key, navigating to nil if it does not exist.
+

multi-path

(multi-path & paths)
A path that branches on multiple paths. For updates,
+applies updates to the paths in order.

must

Navigates to the key only if it exists in the map.
+

must-cache-paths!

Mandate that operations that do inline path factoring and compilation
+(select/transform/setval/replace-in/path/etc.) must succeed in 
+factoring the path into static and dynamic portions. If not, an
+error will be thrown and the reasons for not being able to factor
+will be printed. Defaults to false, and `(must-cache-paths! false)`
+can be used to turn this feature off.
+
+Reasons why it may not be able to factor a path include using
+a local symbol, special form, or regular function invocation
+where a navigator is expected.

NIL->LIST

NIL->SET

nil->val

Navigates to the provided val if the structure is nil. Otherwise it stays
+navigated at the structure.

NIL->VECTOR

not-selected?

(not-selected? & path)

params-reset

(params-reset params-path)

pred

Keeps the element only if it matches the supplied predicate. This is the
+late-bound parameterized version of using a function directly in a path.

putval

Adds an external value to the collected vals. Useful when additional arguments
+are required to the transform function that would otherwise require partial
+application or a wrapper function.
+
+e.g., incrementing val at path [:a :b] by 3:
+(transform [:a :b (putval 3)] + some-map)

replace-in*

(replace-in* path transform-fn structure & {:keys [merge-fn], :or {merge-fn concat}})
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.

select*

(select* path structure)
Navigates to and returns a sequence of all the elements specified by the path.
+

select-first*

(select-first* path structure)
Returns first element found. Not any more efficient than select, just a convenience
+

select-one!*

(select-one!* path structure)
Returns exactly one element, throws exception if zero or multiple elements found
+

select-one*

(select-one* path structure)
Like select, but returns either one element or nil. Throws exception if multiple elements found
+

selected?

(selected? & path)
Filters the current value based on whether a path finds anything.
+e.g. (selected? :vals ALL even?) keeps the current element only if an
+even number exists for the :vals key.
+
+The input path may be parameterized, in which case the result of selected?
+will be parameterized in the order of which the parameterized navigators
+were declared.

setval*

(setval* path val structure)
Navigates to each value specified by the path and replaces it by val
+

srange

Navigates to the subsequence bound by the indexes start (inclusive)
+and end (exclusive)

srange-dynamic

Uses start-fn and end-fn to determine the bounds of the subsequence
+to select when navigating. Each function takes in the structure as input.

STAY

Stays navigated at the current point. Essentially a no-op navigator.
+

stay-then-continue

(stay-then-continue & path)
Navigates to the current element and then navigates via the provided path.
+This can be used to implement pre-order traversal.

STOP

Stops navigation at this point. For selection returns nothing and for 
+transformation returns the structure unchanged

submap

Navigates to the specified submap (using select-keys).
+In a transform, that submap in the original map is changed to the new
+value of the submap.

subselect

(subselect & path)
Navigates to a sequence that contains the results of (select ...),
+but is a view to the original structure that can be transformed.
+
+Requires that the input navigators will walk the structure's
+children in the same order when executed on "select" and then
+"transform".

subset

Navigates to the specified subset (by taking an intersection).
+In a transform, that subset in the original set is changed to the
+new value of the subset.

transform*

(transform* path transform-fn structure)
Navigates to each value specified by the path and replaces it by the result of running
+the transform-fn on it

transformed

(transformed path update-fn)
Navigates to a view of the current value by transforming it with the
+specified path and update-fn.
+
+The input path may be parameterized, in which case the result of transformed
+will be parameterized in the order of which the parameterized navigators
+were declared.

view

Navigates to result of running `afn` on the currently navigated value.
+
\ No newline at end of file diff --git a/com.rpl.specter.macros.html b/com.rpl.specter.macros.html new file mode 100644 index 0000000..70e2377 --- /dev/null +++ b/com.rpl.specter.macros.html @@ -0,0 +1,22 @@ + +com.rpl.specter.macros documentation

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)

defprotocolpath

macro

(defprotocolpath name)(defprotocolpath name params)

extend-protocolpath

macro

(extend-protocolpath protpath & extensions)

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
+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
+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
+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
+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)

select

macro

(select apath structure)

select-first

macro

(select-first apath structure)

select-one

macro

(select-one apath structure)

select-one!

macro

(select-one! apath structure)

setval

macro

(setval apath aval structure)

transform

macro

(transform apath transform-fn structure)

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 diff --git a/com.rpl.specter.prot-opt-invoke.html b/com.rpl.specter.prot-opt-invoke.html new file mode 100644 index 0000000..70fb970 --- /dev/null +++ b/com.rpl.specter.prot-opt-invoke.html @@ -0,0 +1,3 @@ + +com.rpl.specter.prot-opt-invoke documentation

com.rpl.specter.prot-opt-invoke

mk-optimized-invocation

macro

(mk-optimized-invocation protocol obj method num-args)
\ No newline at end of file diff --git a/com.rpl.specter.zipper.html b/com.rpl.specter.zipper.html new file mode 100644 index 0000000..4e11bc1 --- /dev/null +++ b/com.rpl.specter.zipper.html @@ -0,0 +1,15 @@ + +com.rpl.specter.zipper documentation

com.rpl.specter.zipper

find-first

Navigate the zipper to the first element
+in the structure matching predfn. A linear scan
+is done using NEXT to find the element.

INNER-LEFT

Navigate to the empty subsequence directly to the
+left of this element.

INNER-RIGHT

Navigate to the empty subsequence directly to the
+right of this element.

LEFT

Navigate to the element to the left.
+If no element there, works like STOP.

LEFTMOST

NEXT

Navigate to the next element in the structure.
+If no next element, works like STOP.

NEXT-WALK

Navigate to every element reachable using calls
+to NEXT

NODE-SEQ

Navigate to the subsequence containing only
+the node currently pointed to. This works just 
+like srange and can be used to remove elements
+from the structure

PREV

Navigate to the previous element.
+If this is the first element, works like STOP.

RIGHT

Navigate to the element to the right.
+If no element there, works like STOP.

RIGHTMOST

VECTOR-ZIP

\ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..14ca4ca --- /dev/null +++ b/index.html @@ -0,0 +1,3 @@ + +Specter 0.11.1-SNAPSHOT

Specter 0.11.1-SNAPSHOT

Installation

To install, add the following dependency to your project or build file:

[com.rpl/specter "0.11.1-SNAPSHOT"]

Namespaces

\ No newline at end of file