最初のリストを反転してから2番目のリストと連結するSMLで関数を実行しようとしています(次のようなもの: list1 = [5,3,1] and list 2 = [ 6 7 8], then inv(list1, list2) = [ 1,3,5,6,7,8].) コードは次のとおりです。
fun inv (nil,nil) = []
|inv (ha::ta,hb::tb) =
if ha = [] then ta::(hb::tb)
else ha::inv(ta,hb::tb);
これを返します:
エラー: if 分岐の型が一致しません [circularity] then 分岐: ''Z リスト リスト リスト else 分岐: ''式の Z リスト リスト:
if ha = nil then ta :: hb :: tb else ha :: inv (ta, :: )
誰でもこれで私を助けてくれますか?