2014-03-29 5 views
0

좋아, 미안 얘들 아, 그 날 다시 x)는 이 기능은 같은 (COORD에 의해 지정된 좌표에) 이진 트리 인 ( dt를 의 하위 트리를 대체 할 예정이다 [ 0; 1; 0; 0]) 하위 트리 nt에 의해 0이 왼쪽으로 가고 1이 반대가됨을 의미합니다. 그건 그렇고, sub 함수는 지정된 좌표로 서브 트리를 반환합니다. 나는 구문 오류OCaml의 이상한 구문 오류

else if (List.hd coord)=0 then edit l coord nt 
Error: Syntax error 
# 
납니다

난 정말 몰라 왜 : 나는 당신이 그냥 거기에 여분의 let을 제거 할 필요가 말할 것 감사 어쨌든 S :

let rec edit dt coord nt = 
     match dt with 
       Decision(choiceL, costL, l, choiceR, costR, r) -> if (sub dt coord)=l then Decision(choiceL, costL, nt, choiceR, costR, r) 
                                  else if (sub dt coord)=r then Decision(choiceL, costL, l, choiceR, costR, nt) 
                                  else if (List.hd coord)=0 then edit l coord nt 
                                  else edit r coord nt 
      | Chance(eventL, probL, l, eventR, probR, r) -> if (sub dt coord)=l then Chance(choiceL, costL, nt, choiceR, costR, r) 
                                  else if (sub dt coord)=r then let Chance(choiceL, costL, l, choiceR, costR, nt) 
                                  else if (List.hd coord)=0 then edit l coord nt 
                                  else edit r coord nt 
      | Outcome value -> raise (Arg.Bad ("Bad argument")) 
    ;; 

답변

0

.

+0

고마워, 나는 또한 prob와 event x 대신에 "chance"탭에서 선택과 비용이 필요했다. 나는 정말로 잠이 필요하다. – MMrj