[Comp] ふつける(7.9 練習問題)
if式を使うようじゃまだまだですかね。
main = do cs <- getContents
putStr $ unlines $ concatMap fold (lines cs)
fold :: String -> [String]
fold str = let (s, rest) = splitAt 60 str
in if null rest then [s] else s : fold rest
if 式を使っていない解答例の方が読みやすいですね。
| 固定リンク
この記事へのコメントは終了しました。
コメント