Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- match list with
- | [] -> failwith "none"
- | x::xs -> List.fold_left (fun (maxelt, maxcount, elt, count) x ->
- if elt = x then (maxelt, maxcount, elt, (count + 1))
- else if (count > maxcount) then (elt, count, x, 1)
- else (maxelt, maxcount, x, 1)
- ) (x, 0, x, 1) list;;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement