Liking cljdoc? Tell your friends :D

avg

An aggregate function that computes the average for all sampled values by some expr.

In the below example, we use avg to compute the average-order-value (aov) over a group of orders.

;; QUERY
[[:from :Order]
 [:agg [] [:aov [rel/avg :total]]]]

;; STATE
{:Order [{:total 10.0M}
         {:total 25.0M}]}

;; RESULT 
[{:aov 17.5M}]

Can you improve this documentation?Edit on GitHub

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

× close