Liking cljdoc? Tell your friends :D

top

An aggregate functions that returns the highest n values for some expr across the group.

In the below example we use top to find the highest 5 scores for a table of Player data.

;; QUERY
[[:from :Player]
 [:agg [] [:highest-scores [rel/top 5 :score]]]]

;; STATE
{:Player [{:score 1}
          {:score 200}
          {:score 4323}
          {:score 5555}
          {:score 4242}
          {:score -123}
          {:score 330}]}

;; EXPECTED
[{:highest-scores [5555, 4323, 4242, 330, 200]}]

Can you improve this documentation?Edit on GitHub

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

× close