2009-12-07から1日間の記事一覧

RWH p.102 練習問題

1だけ。 import Data.Char (digitToInt) import Data.List (foldl') asInt_fold xs | head xs == '-' = negate $ fold $ tail xs | otherwise = fold xs where fold xs = foldl' step 0 xs step acc x = 10 * acc + digitToInt x foldl, foldrはまだよくわか…