Problem with pattern matching in ocaml
Posted
by
Antony
on Stack Overflow
See other posts from Stack Overflow
or by Antony
Published on 2010-12-28T21:23:35Z
Indexed on
2010/12/28
21:54 UTC
Read the original article
Hit count: 245
I wrote the function used to decompose a Boolean function, the problem is that the compilation I get this : "Warning 5: this function application is partial, maybe some arguments are missing." How can I solve this problem? I've set wrong the patter matching or I can not run this operation with pattern matching
The code is the following:
let rec decomposition state_init state prec formula =
match formula with
And form -> (fun () ->
let f1 = List.hd form in
let f2 = And(List.tl form )in
let new_state = Forms (state_init,f1) in
decomposition state_init new_state state f1;
decomposition state_init new_state state f2;
Hashtbl.add graph new_state (("",false,state :: []) , []) ;
let x = Hashtbl.find graph state in
let succ = state :: snd x in
let (desc,last,ptrs) = fst x in
Hashtbl.replace graph state ( ("And-node",last,ptrs) , succ))
© Stack Overflow or respective owner