【发布时间】:2011-05-31 18:45:51
【问题描述】:
我写了一个用于分解布尔函数的函数,问题是编译我得到这个:“警告5:这个函数应用程序是部分的,可能缺少一些参数。” 我怎么解决这个问题?我设置了错误的模式匹配,或者我无法使用模式匹配运行此操作
代码如下:
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))
【问题讨论】:
标签: functional-programming pattern-matching ocaml