0
大家好我有这个错误信息,我找不到一种方法来解决这个...这个表达式有类型(String.t * String.t *'a)list - >'b但是表达式需要类型'c list OCAML
这是我的函数:
let station gares dist =
let rec station2 firstT secondT index gares final = function
| [] -> final
| tete::reste when (String.equal (getFirstTown tete) firstT) == true
&& (String.equal (getSecondTown tete) secondT) == true -> if (index + 1) < (List.length gares) then
station2 (List.nth gares index) (List.nth gares (index + 1)) (index + 1) gares [email protected][(firstT, secondT, (getDistance tete))] reste
else final
| tete::reste when (String.equal (getFirstTown tete) firstT) == false
|| (String.equal (getSecondTown tete) secondT) == false -> station2 firstT secondT index gares final reste
| _::_ -> final
in station2 (List.nth gares 0) (List.nth gares 1) 1 gares [] dist
,这是我的函数的签名:
val station : string list -> (string * string * int) list -> (string * string * int) list
我觉得我的错误是从那里部分未来我试图在我的最终列表中添加一个新的元组:
[email protected][(firstT, secondT, (getDistance tete))]
我在这一点上失去了,我觉得我已经tryed一切......
谢谢!工作完美:) –