ocaml pattern match question

Posted by REALFREE on Stack Overflow See other posts from Stack Overflow or by REALFREE
Published on 2010-06-15T04:51:02Z Indexed on 2010/06/15 4:52 UTC
Read the original article Hit count: 442

Filed under:
|
|

I'm trying to write a simple recursive function that look over list and return a pair of integer. This is easy to write in c/c++/java but i'm new to ocaml so somehow hard to find out the solution due to type conflict

it goes like..

let rec test l = match l with [] -> 0 | x::xs -> if x > 0 then (1+test, 0) else (0, 1+test);;

I kno this is not correct one and kinda awkward.. but any help will be appreciated

© Stack Overflow or respective owner

Related posts about pattern

Related posts about ocaml