(cluster arr n f)clusters a space with an aggregate function
(cluster (range 1 200) 10 math/mean) => [10 29 48 67 86 105 124 143 162 181]
clusters a space with an aggregate function (cluster (range 1 200) 10 math/mean) => [10 29 48 67 86 105 124 143 162 181]
(create-template entry)creates a template for entry
creates a template for entry
(duration arr {:keys [key unit order]})calculates the duration from array and options
(duration [1 2 3 4] {:key identity :unit :m}) => 180000
calculates the duration from array and options
(duration [1 2 3 4] {:key identity :unit :m})
=> 180000(flat-fn template)creates a nested to flat transform
(def transform-fn (flat-fn (raw-template {:a {:b {:c 1}}})))
(transform-fn {:a {:b {:c 10}}}) => {:a.b.c 10}
creates a nested to flat transform
(def transform-fn (flat-fn (raw-template {:a {:b {:c 1}}})))
(transform-fn {:a {:b {:c 10}}})
=> {:a.b.c 10}(from-ms ms to)converts ms time into a given unit
(from-ms 100 :ns) => 100000000
converts ms time into a given unit (from-ms 100 :ns) => 100000000
(linspace arr n)takes the linear space of n samples
(linspace (range 100) 10) => [0 11 22 33 44 55 66 77 88 99]
takes the linear space of n samples (linspace (range 100) 10) => [0 11 22 33 44 55 66 77 88 99]
(make-empty entry)creates an empty entry given structure
(make-empty {:a 1 :b "hello" :c :world}) => {:a 0, :b "", :c nil}
creates an empty entry given structure
(make-empty {:a 1 :b "hello" :c :world})
=> {:a 0, :b "", :c nil}(nest-fn template)creates a nested to flat transform
(def transform-fn (nest-fn (raw-template {:a {:b {:c 1}}})))
(transform-fn {:a.b.c 10}) => {:a {:b {:c 10}}}
creates a nested to flat transform
(def transform-fn (nest-fn (raw-template {:a {:b {:c 1}}})))
(transform-fn {:a.b.c 10})
=> {:a {:b {:c 10}}}(order-flip order)returns the opposite of the order
(order-flip :asc) => :desc
returns the opposite of the order (order-flip :asc) => :desc
(order-fn [asc desc])creates a function that returns or flips the input
(mapv (order-fn [:up :down]) [:asc :desc] [false true]) => [:up :up]
creates a function that returns or flips the input
(mapv (order-fn [:up :down])
[:asc :desc]
[false true])
=> [:up :up](order-fns order)(order-fns order flip)returns commonly used functions
(order-fns :asc) => {:comp-fn <, :comp-eq-fn <=, :op-fn +}
returns commonly used functions
(order-fns :asc)
=> {:comp-fn <, :comp-eq-fn <=, :op-fn +}(parse-sample-expr sample time-opts)parses a sample expression
(parse-sample-expr [10] {}) => {:size 10, :strategy :linear}
parses a sample expression
(parse-sample-expr [10] {})
=> {:size 10, :strategy :linear}(parse-time s)(parse-time s unit)parses a string or keyword time representation
(parse-time :0.1m :us) => 6000000
(parse-time :0.5ms :us) => 500
parses a string or keyword time representation (parse-time :0.1m :us) => 6000000 (parse-time :0.5ms :us) => 500
(parse-time-expr m)parses a time expression
(parse-time-expr {:interval "0.5ms"}) => {:key identity, :unit :ms, :order :asc, :interval 0}
parses a time expression
(parse-time-expr {:interval "0.5ms"})
=> {:key identity, :unit :ms, :order :asc, :interval 0}(process-sample arr {:keys [size strategy every] :as m} time-opts)process sample given sampling function
(process-sample (range 100) (parse-sample-expr [10 :random] {}) {:key identity :order :asc}) ;; (4 20 39 51 51 60 70 72 89 96) => coll?
;; extended sampling function from range (process-sample (range 100) (parse-sample-expr [[0 :10ms] :range] {:key identity :order :asc :unit :ms}) {:key identity :order :asc :unit :ms}) => [0 1 2 3 4 5 6 7 8 9 10]
process sample given sampling function
(process-sample (range 100)
(parse-sample-expr [10 :random] {})
{:key identity :order :asc})
;; (4 20 39 51 51 60 70 72 89 96)
=> coll?
;; extended sampling function from range
(process-sample (range 100)
(parse-sample-expr [[0 :10ms] :range] {:key identity :order :asc :unit :ms})
{:key identity :order :asc :unit :ms})
=> [0 1 2 3 4 5 6 7 8 9 10](raw-template entry)creates a template for nest/flat mapping
(raw-template {:a {:b 1 :c "2"}}) => {:nest {:a {:b "{{a.b}}", :c "{{a.c}}"}}, :flat {:a.b "{{a.b}}", :a.c "{{a.c}}"}, :types {:a.b java.lang.Long, :a.c java.lang.String} :empty {:a.b 0, :a.c ""}}
creates a template for nest/flat mapping
(raw-template {:a {:b 1 :c "2"}})
=> {:nest {:a {:b "{{a.b}}",
:c "{{a.c}}"}},
:flat {:a.b "{{a.b}}",
:a.c "{{a.c}}"},
:types {:a.b java.lang.Long,
:a.c java.lang.String}
:empty {:a.b 0, :a.c ""}}(to-ms ms from)converts a time to ms time
(to-ms 10000 :ns) => 0
(to-ms 10000 :s) => 10000000
converts a time to ms time (to-ms 10000 :ns) => 0 (to-ms 10000 :s) => 10000000
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |