私は:spacegather:文字列リスト->文字列を与えました
関数を作成する必要があるので、呼び出しが変わります。
spacegather ["I"、 "am"、 "nice"] to-> "I am nice"
ありがとう
私は:spacegather:文字列リスト->文字列を与えました
関数を作成する必要があるので、呼び出しが変わります。
spacegather ["I"、 "am"、 "nice"] to-> "I am nice"
ありがとう
intercalate xs xss = concat (intersperse xs xss)
インターカレートの実際的な意味を見つけてください。ここに散在があります:
(*intersperse x [a,b,c..,z]=>[a,x,b,x,c,x..,x,z]*)
fun intersperse y nil = nil
| intersperse y [x] = [x]
| intersperse y (x::xs)=x::y::(intersperse y xs)
私がこれを正しく理解しているかどうかを見てみましょう:
fun spacegather (h::[]) = h
| spacegather (h::tl) = h ^ " " ^ (spacegather tl);
spacegather ["I", "am", "nice!!"];
出力:val it="私はいいです!!" : ストリング
これでうまくいくはずですよね?
String.concatWith " " ["I", "am", "nice"]