Haskell

macのhaskellについて

macportsのhaskellは使ったら駄目. ghciに-1.0を入力するだけでsegv発動するよ. ちゃんと本家から落とすこと. http://hackage.haskell.org/platform/

Real World Haskell Chapter3 続き

昨日よくわからないと言っていた練習問題の続き. rightとleftを区別する方法がわからないので,無視. --Tree2.hs data Tree a = Node a (Maybe(Tree a)) (Maybe(Tree a)) deriving (Show) simpleTree = Just (Node "parent" (Just (Node "left leaf" Nothi…

Real World Haskell Chapter3

Nullable.hsはNulllabel.hsのtypo? --Nullable.hs data Maybe a = Just a | Nothing someBool = Just True someString = Just "something" wrapped = Just (Just "wrapped") 写経すると以下のエラー. よく分からんが,定義が重複しているみたい? [1 of 1] C…

Real World Haskell Chapter 2

last [] last [1..] Haskellで循環リストみたいなものを作れるのならば. --lastButOne.hs lastButOne (x:xs) = if length(xs) == 1 then x else lastButOne xs 以下のほうが,関数型ぽいかな? --lastButOne.hs lastButOne (x:[_]) = x lastButOne (x:xs) =…

Real World Haskell Chapter1

--wc.hs main = interact wordCount where wordCount input = show(length(lines input)) ++ "\t" ++ show(length(words input)) ++ "\t" ++ show(length( input)) ++ "\n"

Real World Haskell

Haskellの学習を始めた. "Real World Haskell"の練習問題を解いていこうと思います. どこかにカンニングできるところがあれば,教えてください. 書籍中のサポートページのURLが間違っている. 正しいページに行っても,正誤表には辿りつけない.(存在しな…