Liking cljdoc? Tell your friends :D

hiposfer.kamal.libs.tool

useful functions that have not found a proper place yet

useful functions that have not found a proper place yet
raw docstring

assertclj

(assert m spec)

checks that m conforms to spec. Returns an error message on error or nil otherwise

checks that m conforms to spec. Returns an error message on error or nil
otherwise
sourceraw docstring

coerceclj

(coerce m coercers)

takes a map and a mapping of keyword to a 1 argument function. Recursively transforms m by updating its value through the passed functions. Non existent values are ignored

takes a map and a mapping of keyword to a 1 argument function. Recursively
transforms m by updating its value through the passed functions. Non existent
values are ignored
sourceraw docstring

combinationsclj

(combinations n coll)

returns a lazy sequence of all the possible combinations of the elements in coll in groups of n members. Example: (combinations 2 [:a :b :c]) ;;=> ((:a :b) (:a :c) (:b :c))

returns a lazy sequence of all the possible combinations of the elements in
coll in groups of n members.
Example: (combinations 2 [:a :b :c]) ;;=> ((:a :b) (:a :c) (:b :c))
sourceraw docstring

gtfs-nsclj

source

gtfs-resourceclj

(gtfs-resource entity)

takes an entity and checks if any of its values are entities, if so replaces them by their unique identity value.

WARNING: this works only for GTFS entities, since those obey the :name/id pattern. Any other reference entity is not guarantee to work

takes an entity and checks if any of its values are entities, if so replaces
them by their unique identity value.

WARNING: this works only for GTFS entities, since those obey the :name/id
pattern. Any other reference entity is not guarantee to work
sourceraw docstring

json-namespaceclj

(json-namespace value)

takes a Clojure datastructure and destructures all namespaced keyword maps into separate maps and all sequences of namespaced keywords into sequences of simple keywords.

Accepts an sequence of custom java object which are stringified according to their own toString method.

This attempts to mimic the way that a json response would be shaped For example: (json-namespace {:a (ZoneId/of "Europe/Berlin") :c/b [:d.e :f/g]} (keys edn/java-readers)) => {:a "Europe/Berlin", :c {:b ((:d :e) (:f :g))}}

takes a Clojure datastructure and destructures all namespaced keyword maps
into separate maps and all sequences of namespaced keywords into sequences
of simple keywords.

Accepts an sequence of custom java object which are stringified according
to their own toString method.

This attempts to mimic the way that a json response would be shaped
For example:
(json-namespace {:a (ZoneId/of "Europe/Berlin") :c/b [:d.e :f/g]}
                (keys edn/java-readers))
=> {:a "Europe/Berlin", :c {:b ((:d :e) (:f :g))}} 
sourceraw docstring

map-valsclj

(map-vals f)
(map-vals f coll)

map over values ONLY

map over values ONLY
sourceraw docstring

someclj

(some pred? coll)

an alternative version of Clojure's some which uses reduce instead of recur. Useful for collections that know how to reduce themselves faster than first/next

Returns the value that caused (pred? value) to be true; as opposed to Clojure's

an alternative version of Clojure's some which uses reduce instead of
recur. Useful for collections that know how to reduce themselves faster
than first/next

Returns the value that caused (pred? value) to be true; as opposed to Clojure's
sourceraw docstring

uniqueclj

(unique)
(unique coll)

Returns a lazy sequence of the elements of coll with duplicates removed. Returns a stateful transducer when no collection is provided.

Returns a lazy sequence of the elements of coll with duplicates removed.
Returns a stateful transducer when no collection is provided.
sourceraw docstring

unique-byclj

(unique-by attr)
(unique-by attr coll)

Returns a lazy sequence of the elements of coll with duplicates attributes removed. Returns a stateful transducer when no collection is provided.

Returns a lazy sequence of the elements of coll with duplicates attributes removed.
Returns a stateful transducer when no collection is provided.
sourceraw docstring

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

× close