Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* Counts the number of instances of num in x::xs
- * for instance, (countNum ([1;1;2;3], 0, 1)) should return 2*)
- let rec countNum (x::xs, soFar, num) =
- match x with
- | [] -> soFar
- | num -> countX (xs, (soFar+1), x)
- | _ -> countX (xs, soFar, x);;
Advertisement
Add Comment
Please, Sign In to add comment