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 :: []) , []) ;
开发者_Python百科 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))
decomposition state_init new_state state f1
has type unit -> unit
(because you're returning fun () -> ...
). So if you just call it like that, it won't do anything.
You either have to call it as decomposition state_init new_state state f1 ()
, or remove the fun () ->
bit, so the unit argument isn't necessary.
精彩评论