2006-07-06から1日間の記事一覧
たしかにポイントフリースタイルで書くとすっきりする気がする。ただ綺麗に書ける自信があまりない。 lstrip.hs lstrip :: String -> String lstrip = dropWhile (== ' ') rstrip.hs rstrip :: String -> String rstrip = reverse . lstrip . reverse
fold.hs foldCol = 61 main = do cs <- getContents putStr $ unlines $ map foldLineAt $ lines cs foldLineAt :: String -> String foldLineAt cs = case snd (splitAt foldCol cs) of [] -> cs (c1:cs1) -> if length cs1 >= (foldCol - 1) then foldLine…