2007-07-06から1日間の記事一覧

条件を満たす行を取り除く

条件を満たす行を取り除く via http://d.hatena.ne.jp/gan2/20070706/1183708048'#'で始まる行を取り除く問題。すげーひさしぶりに Haskell で書いてみる。 module Main where import System f :: String -> Bool f (h:tl) | h == '#' = False | otherwise =…

ピラミッドを作る

どう書く?org - ピラミッドを作る与えられた高さのピラミッドを作る module Main where import System cjust :: Int -> String -> String cjust w s | w <= length s = s | otherwise = margin ++ s ++ margin where margin = replicate ((w - (length s)) …