前回の出題にある通りです。
あらためて書くと、標準入力から与えられる文字列のなかに文字@が何回現れるかを数えてその個数を標準出力せよ、という問題でした。
| -- http://atnd.org/events/46727 | |
| -- https://gist.github.com/cojna/0918920c7a246961227b | |
| import Control.Monad.State | |
| import qualified Data.Map as M | |
| type Memo = M.Map Int Integer | |
| add :: Int -> Integer -> State Memo () | |
| add k v = do s <- get |
| -- a lightweight pxeger with QuickCheck2 in Haskell | |
| -- usage: | |
| -- 1) find an example which satisfies the regex "a": | |
| -- ghci> check (mkRegex "a") | |
| -- *** Failed! Falsifiable (after 50 tests and 5 shrinks): | |
| -- "a" | |
| -- check tries at most 100 tests. here, we found within 50 tests. | |
| -- 2) search more instances with the regex "a.b" | |
| -- ghci> checkDeep 1000 (mkRegex "a.b") | |
| -- *** Failed! Falsifiable (after 316 tests and 7 shrinks): |
| <html> | |
| <p> | |
| 良い本、普通の本は他の人が挙げると思うので、他の人が挙げなさそうなものをできるだけ選んでみます。 | |
| </p> | |
| <hr><pre> | |
| Bernhard Korte and Jens Vygen, | |
| "Combinatorial Optimization, theory and algorithms", | |
| Springer | |
| </pre> | |
| <p> |
前回の出題にある通りです。
あらためて書くと、標準入力から与えられる文字列のなかに文字@が何回現れるかを数えてその個数を標準出力せよ、という問題でした。
| 2013-03-27 すごいHaskell読書会 in 大阪 #7 の課題について | |
| @yashigani さんの出題した課題の設計方針を書きます | |
| 問題はこちら: | |
| https://gist.github.com/yashigani/5231928 | |
| 上記資料の一番下に課題があります。 | |
| 転載: | |
| ----- |
| -- http://koko-u.github.com/haskell_book_reading/#25 | |
| import Data.Char (toUpper, intToDigit, isSpace) | |
| import Data.List (isInfixOf, nub) | |
| import Numeric (showIntAtBase) | |
| upperCase :: String -> String | |
| upperCase = map toUpper | |
| removeSpaces :: String -> String |
| -- http://www.slideshare.net/yashigani/haskell-in/19 | |
| module Homework where | |
| import Data.List(foldl') | |
| myNull :: [a] -> Bool | |
| myNull [] = True | |
| myNull _ = False |
| module Noricoco where | |
| -- Hello! See also | |
| -- http://togetter.com/li/312309 | |
| open import Data.Empty using (⊥-elim) | |
| open import Data.Nat using (_≟_; ℕ) | |
| open import Data.Sum using (_⊎_; inj₁; inj₂) | |
| open import Relation.Binary.PropositionalEquality using (_≡_) | |
| open import Relation.Nullary using (yes; no) |