Arc Cross Reference

commonest

[procedure] commonest seq

Returns a list of the most common element in seq and its count.

(def commonest (seq)
  (with (winner nil n 0)
    (ontable k v (counts seq)
      (when (> v n) (= winner k n v)))
    (list winner n)))
arc> (commonest '(a b d j d s b a d c))
(d 3)

Categorys:sequence