Liking cljdoc? Tell your friends :D

acyclic.utils.pinhole


extract-keys-from-mapclj

(extract-keys-from-map opts ks)

Given opts of form {:k1 v1 :k2 v2 ..}, return [opts' vs] where vs are values corresponding to ks and opts' is opts with those pairs removed.

Given opts of form {:k1 v1 :k2 v2 ..}, return [opts' vs] where
vs are values corresponding to ks and opts' is opts with those pairs removed.
raw docstring

extract-optsclj

(extract-opts opts ks)

Given opts of form [:k1 v1 :k2 v2 ..], return [opts' vs] where vs are values corresponding to ks and opts' is opts with those pairs removed.

Given opts of form [:k1 v1 :k2 v2 ..], return [opts' vs] where
vs are values corresponding to ks and opts' is opts with those pairs removed.
raw docstring

m-sectionclj

(m-section m ks)

Cross section of a map. Given a sequence of key-specifiers ks, returns a map containing only the specified keys. A key-specifier can take the forms :some-key [:new-key-name :old-key-name] [:new-key-name [:path :to :entry :ala :get-in] See also ph-get-in.

Cross section of a map.  Given a sequence of key-specifiers ks, returns a map containing only the specified keys.   A key-specifier can take the forms
      :some-key
      [:new-key-name :old-key-name]
      [:new-key-name [:path :to :entry :ala :get-in]
See also ph-get-in.
raw docstring

mk-ph-applyclj

(mk-ph-apply ks)

Returns a function that modifies within the structure.

Returns a function that modifies within the structure.
raw docstring

mk-ph-getclj

(mk-ph-get ks)
(mk-ph-get path-dict k)

Returns a function that can be used like get, but internally uses the path as in ph-get

Returns a function that can be used like get, but internally uses the path as in ph-get
raw docstring

mk-ph-modclj

(mk-ph-mod f & arg-paths)

mk-ph-setclj

(mk-ph-set ks)
(mk-ph-set path-dict k)

Returns a function that can be used like assoc, but internally uses the path as in ph-assoc.

Returns a function that can be used like assoc, but internally uses the path as in ph-assoc.
raw docstring

ph-assocclj

(ph-assoc path-dict m & kvs)

Pinhole association. o comprises nested maps or records, path-dict is a map like {:key1 :new-key ;or :key2 [:path :just-like :assoc-in] ...} and kvs are alternating keys and values, as in assoc. If a key is not found in path-dict, it is assoc'd normally. If a key is found in path-dict, associated with a scalar, then the value will be assoc'd in with that scalar as a key. If a key is found in path-dict, associated with a sequence, then the value will be assoc-in'd with that sequence, except that if the first item in the sequence, the result of its application to the value will be assoc'd in with the rest of the sequence. If the first element of the path is a vector, then the first element of that vector is assumed to be a function that will be applied to the value before insertion. Returns the "modified" o.

Pinhole association.  o comprises nested maps or records, path-dict is a map like
    {:key1 :new-key  ;or
     :key2 [:path :just-like :assoc-in] ...}
   and kvs are alternating keys and values, as in assoc.
If a key is not found in path-dict, it is assoc'd normally.
If a key is found in path-dict, associated with a scalar, then the value will be assoc'd in with that scalar as a key.
If a key is found in path-dict, associated with a sequence, then the value will be assoc-in'd with that sequence,
except that if the first item in the sequence, the result of its application to the value will be assoc'd in
with the rest of the sequence.
If the first element of the path is a vector, then the first element of that vector is assumed to be a function
that will be applied to the value before insertion.
Returns the "modified" o.
raw docstring

ph-assoc-inclj

(ph-assoc-in m [k & ks] v)

Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created. If any key is a vector, the first element of the vector will be taken as a function to be applied to the next iteration.

Associates a value in a nested associative structure, where ks is a
sequence of keys and v is the new value and returns a new nested structure.
If any levels do not exist, hash-maps will be created.
If any key is a vector, the first element of the vector will be taken as a function to
be applied to the next iteration.
raw docstring

ph-getclj

(ph-get path-dict o k)

Pinhole lookup. o comprises nested maps or records, path-dict is a map like {:key1 :new-key ;or :key2 [:path :just-like :assoc-in] ...} and k is a key. If a key is not found in path-dict, it is retrieved normally with get.

If a key is found in path-dict, associated with a sequence, then that sequence will be used to retrieve the value with get-in, Returns the value. If the first element of a path is a vector, then the second element of that vector is assumed to be a function applied to the final result.

Pinhole lookup.  o comprises nested maps or records, path-dict is a map like
    {:key1 :new-key  ;or
     :key2 [:path :just-like :assoc-in] ...}
   and k is a key.
If a key is not found in path-dict, it is retrieved normally with get.

If a key is found in path-dict, associated with a sequence, then that sequence will be used to retrieve the value with get-in,
Returns the value.
If the first element of a path is a vector, then the second element of that vector is assumed to be a function
applied to the final result.
raw docstring

ph-get-inclj

(ph-get-in m [k & ks])

Returns the value in a nested associative structure, where ks is a sequence of keys. Returns nil if the key is not present, or the not-found value if supplied. If any element is a vector, the second element of that vector is applied as a function to the structure before proceeding; should the vector element be at the end of the key sequence, the function is applied to the final result, e.g. (ph-get-in {:a {:b "{:c 1}"}} [:a :b [pr-str read-string] :c [dec inc]])

Returns the value in a nested associative structure,
where ks is a sequence of keys. Returns nil if the key
is not present, or the not-found value if supplied.
If any element is a vector, the second element of that
vector is applied as a function to the structure before
proceeding; should the vector element be at the end of
the key sequence, the function is applied to the final
result, e.g.
(ph-get-in {:a {:b "{:c 1}"}} [:a :b [pr-str read-string] :c [dec inc]])
raw docstring

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

× close