0
auxInner
下面返回一個int列表。但是當我在隨後的inner
函數中調用List.sum(auxInner xs ys)
時,我得到這個奇怪的錯誤! List.sum
不是int列表嗎?類型''列表'不支持運算符'+'
let rec auxInner xs ys =
match (xs, ys) with
|([],[]) -> []
|([], ys) -> ys
|(xs, []) -> xs
|(x::xs, y::ys) -> x*y::auxInner xs ys
let rec inner xs ys =
match (xs, ys) with
|([],[]) -> []
|([], ys) -> ys
|(xs, []) -> xs
|(xs, ys) -> List.sum(auxInner xs ys)
謝謝!我改變它,以便每個模式返回一個int而不是一個列表,所以現在它工作。 –