Hrodrick
10/02/2023, 1:57 PM.average()
in a list of Int which works as mean. But what about the others?
In particular .mode()
(I would prefer just .mostFrequent()
) would be useful for any type of collection or at least List 🤔Chris Fillmore
10/02/2023, 2:06 PMephemient
10/02/2023, 3:13 PMlist.sorted()[list.length / 2]
(plus whatever logic you want to handle ties)
mode: list.groupingBy { it }.eachCount().entries.maxBy { it.value }.key
Hrodrick
10/02/2023, 3:14 PM