「分割統治」を使用せずに 2 つのリストを結合する関数を作成しようとしています。したがって、私は使用できません(++)
。
Prelude> let combineList (x:xs) (y:ys) = if null (y:ys)==True then x:xs else combineList (x:xs++[y]) (ys)
これは私が今持っているもので、"Non-exhaustive patterns in function combineList"
. if null (y:ys)==True
この機能が機能するため、問題が から発生していることに気付きました-
Prelude> let combineList (x:xs) (y:ys) = if ys==[] then x:xs++[y] else combineList (x:xs++[y]) (ys)
++[y]
しかし、可能であれば、出力の を取り除きたいです。
コードの修正は大歓迎です。