(->list coll)
Efficient thread-first friendly concrete list creation.
(apply list (range 1000)) => 40.8 µs (apply list (vec (range 1000))) => 43.8 µs
(->list (range 1000)) => 28.5 µs (->list (vec (range 1000))) => 15.2 µs
Efficient thread-first friendly concrete list creation. (apply list (range 1000)) => 40.8 µs (apply list (vec (range 1000))) => 43.8 µs (->list (range 1000)) => 28.5 µs (->list (vec (range 1000))) => 15.2 µs
(keepv f coll)
Wrapper around `(into [] (keep f) coll) cuz that's annoying to write. Short-circuits on nil and empty Counted collections.
Wrapper around `(into [] (keep f) coll) cuz that's annoying to write. Short-circuits on nil and empty Counted collections.
(mapv* f coll)
Efficient version of mapv which operates directly on the sequence instead of Clojure's reduce abstraction.
(doall (map inc nil)) => 30 ns (doall (map inc (range 1000))) => 32 us (doall (map inc (vec (range 1000)))) => 32 us
(into [] (map inc) nil) => 100 ns (into [] (map inc) (range 1000)) => 23 us (into [] (map inc) (vec (range 1000))) => 23 us
(mapv inc nil) => 86 ns (mapv inc (range 1000)) => 15 us (mapv inc (vec (range 1000))) => 15 us
(mapv* inc nil) => 3 ns (mapv* inc (range 1000)) => 22 us (mapv* inc (vec (range 1000))) => 19 us
Efficient version of mapv which operates directly on the sequence instead of Clojure's reduce abstraction. (doall (map inc nil)) => 30 ns (doall (map inc (range 1000))) => 32 us (doall (map inc (vec (range 1000)))) => 32 us (into [] (map inc) nil) => 100 ns (into [] (map inc) (range 1000)) => 23 us (into [] (map inc) (vec (range 1000))) => 23 us (mapv inc nil) => 86 ns (mapv inc (range 1000)) => 15 us (mapv inc (vec (range 1000))) => 15 us (mapv* inc nil) => 3 ns (mapv* inc (range 1000)) => 22 us (mapv* inc (vec (range 1000))) => 19 us
(pmap* f coll)
Efficient version of pmap which avoids the overhead of lazy-seq.
(doall (pmap (fn [_] (Thread/sleep 100)) coll)) => 3.34 secs (pmap* (fn [_] (Thread/sleep 100)) coll) => 202 ms
Efficient version of pmap which avoids the overhead of lazy-seq. (doall (pmap (fn [_] (Thread/sleep 100)) coll)) => 3.34 secs (pmap* (fn [_] (Thread/sleep 100)) coll) => 202 ms
(postwalk* f form)
More efficient and meta-preserving clojure.walk/postwalk. Only handles types returned from simple-type. All ISeqs return concrete lists.
(clojure.walk/postwalk identity big-map) => 72 us (postwalk* identity big-map) => 25 us
More efficient and meta-preserving clojure.walk/postwalk. Only handles types returned from simple-type. All ISeqs return concrete lists. (clojure.walk/postwalk identity big-map) => 72 us (postwalk* identity big-map) => 25 us
(run!* f coll)
Efficient version of run! which operates directly on the sequence
instead of Clojure's reduce abstraction. Does not respond to reduced
.
(run! inc (range 1000)) => 7 µs (run!* inc (range 1000)) => 950 ns
Efficient version of run! which operates directly on the sequence instead of Clojure's reduce abstraction. Does not respond to `reduced`. (run! inc (range 1000)) => 7 µs (run!* inc (range 1000)) => 950 ns
(vary-meta* obj f & args)
Like vary-meta but returns the obj if given an object that doesn't support metadata.
Like vary-meta but returns the obj if given an object that doesn't support metadata.
(walk* form inner outer)
Protocol version of postwalk
Protocol version of postwalk
(with-meta* obj meta)
Same as clojure.core/with-meta except it doesn't error if the obj doesn't support meta.
Same as clojure.core/with-meta except it doesn't error if the obj doesn't support meta.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close