Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Averages-Mode/Oz/averages-mode.oz
Normal file
17
Task/Averages-Mode/Oz/averages-mode.oz
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
declare
|
||||
fun {Mode Xs}
|
||||
Freq = {Dictionary.new}
|
||||
for X in Xs do
|
||||
Freq.X := {CondSelect Freq X 0} + 1
|
||||
end
|
||||
MaxCount = {FoldL {Dictionary.items Freq} Max 0}
|
||||
in
|
||||
for Value#Count in {Dictionary.entries Freq} collect:C do
|
||||
if Count == MaxCount then
|
||||
{C Value}
|
||||
end
|
||||
end
|
||||
end
|
||||
in
|
||||
{Show {Mode [1 2 3 3 2 1 1]}}
|
||||
{Show {Mode [1 2 3 3 2 1]}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue