Liking cljdoc? Tell your friends :D
Mostly clj/s.
Exceptions indicated.

vvvvalvalval.supdate.api


compileclj/s

(compile transform)

Given a transform specification (as passed as second argument to supdate or supdate*), returns a function which accepts an input and transforms it. The returned function runs faster than just calling supdate* (i.e interpreting the transform), at the expense of more ahead-of-time work.

Given a transform specification (as passed as second argument to supdate or supdate*),
returns a function which accepts an input and transforms it.
The returned function runs faster than just calling supdate* (i.e interpreting the transform),
at the expense of more ahead-of-time work.
sourceraw docstring

supdatecljmacro

(supdate v transform)

'Super Update' - transforms an input based on a recursive, data-oriented specification which matches the schema of the input.

Accepts an input value v and a transform specification transform that represents a transformation to apply on v:

  • if transform is a function (as determined by clojure.core/fn?) or keyword, will apply it to v. To avoid the cost of a runtime type check, the caller may add the ^{:vvvvalvalval.supdate.api/type :fn} metadata to the transform form.
  • if transform is a map, will treat v as a map, and recursively modify the values of v for the keys transform supplies. The transform will only be performed for the keys that are contained in v. If the transform value for a key is false, then the key is dissoc'ed from v.
  • if transform is a vector with one element (a nested transform), will treat v as a collection an apply the nested transform to each element. It the source collection is a vector, the output collection will be a vector as well.
  • if transform is a sequence, will apply each transform in the sequence in order.

In order to achieve efficiency, this macro will attempt to leverage static information on the transform form, thus generating code which skips type checks and dynamic traversal of the transform data structure at runtime.

'Super Update' - transforms an input based on a recursive, data-oriented specification which matches the schema of the input.

Accepts an input value `v` and a transform specification `transform` that represents a transformation to apply on v:
* if `transform` is a function (as determined by clojure.core/fn?) or keyword, will apply it to v.
To avoid the cost of a runtime type check, the caller may add the ^{:vvvvalvalval.supdate.api/type :fn} metadata to the `transform` form.
* if `transform` is a map, will treat v as a map, and recursively modify the values of v for the keys transform supplies.
The transform will only be performed for the keys that are contained in v.
If the transform value for a key is `false`, then the key is dissoc'ed from v.
* if `transform` is a vector with one element (a nested transform), will treat v as a collection an apply the nested transform to each element.
It the source collection is a vector, the output collection will be a vector as well.
* if transform is a sequence, will apply each transform in the sequence in order.

In order to achieve efficiency, this macro will attempt to leverage static information on the `transform` form,
thus generating code which skips type checks and dynamic traversal of the transform data structure at runtime.
sourceraw docstring

supdate*clj/s

(supdate* v transform)

Dynamic counterpart to the supdate macro, which works by using runtime type checks.

Dynamic counterpart to the `supdate` macro, which works by using runtime type checks.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close