Guest User

Why doesn't this work

a guest
Sep 5th, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.27 KB | None | 0 0
  1. (* Counts the number of instances of num in x::xs
  2.  * for instance, (countNum ([1;1;2;3], 0, 1)) should return 2*)
  3.  
  4. let rec countNum (x::xs, soFar, num) =
  5.    match x with
  6.       | [] -> soFar
  7.       | num -> countX (xs, (soFar+1), x)
  8.       | _ -> countX (xs, soFar, x);;
Advertisement
Add Comment
Please, Sign In to add comment