2010-12-28 13 views
5

Napisałem funkcję używaną do dekompozycji funkcji Boolean, problem polega na tym, że kompilacja dostaję to: "Ostrzeżenie 5: ta funkcja aplikacji jest częściowa, może brakuje niektórych argumentów." Jak mogę rozwiązać ten problem? Mam ustawiony złego dopasowania patter lub nie mogę uruchomić tej operacji z wzorem pasującymProblem z dopasowaniem do wzorca w ocaml

kodu jest następujący:

  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)) 

Odpowiedz

8

decomposition state_init new_state state f1 ma typ unit -> unit (bo wracasz fun() -> ...). Więc jeśli po prostu tak to nazwiesz, nic nie zrobisz.

Musisz albo nazwać je jako decomposition state_init new_state state f1(), albo usunąć bit fun() ->, więc argument jednostki nie jest konieczny.