Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let insert l a =
- if List.mem_assoc a l
- then
- let n = List.assoc a l in (a, n+1)::(List.remove_assoc a l)
- else (a, 1)::l
- ;;
- let for_each str f =
- let l = MultiSet.empty in
- let rec helper spot final =
- if spot = final then l
- else begin
- f l str.[spot];
- helper (spot + 1) final
- end
- in
- helper 0 (String.length str);
Add Comment
Please, Sign In to add comment