Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.50 KB | None | 0 0
  1. let natrzy list=
  2.     let rec help_natrzy (list, mod5List, mod10List, otherList) =
  3.         match list with
  4.          [] -> (mod10List, mod5List, otherList)
  5.         | mod10 when List.hd list mod 10 = 0 -> help_natrzy (List.tl list, mod5List, mod10List@List.hd list::[], otherList)
  6.         | mod5  when List.hd list mod 5 = 0 -> help_natrzy (List.tl list, mod5List@List.hd list::[], mod10List, otherList)
  7.         |   _   -> help_natrzy (List.tl list, mod5List, mod10List, otherList@List.hd list::[])
  8.     in help_natrzy (list, [], [], []);;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement