Haskellã§Stackå®è£
Haskellã§Stackãå®è£
ãã¾ããã
åå ããäºå®ã ã£ã初心者Haskell勉強会第3回 - [PARTAKE]ã®å®¿é¡ã«ãªã£ã¦ãããã¤ã§ãï¼çµå±ãããªãã£ãã®ã ãã©ï¼
data Stack a = Stack [a] deriving (Show) empty :: Stack a empty = Stack [] isEmpty :: Stack a -> Bool isEmpty (Stack []) = True isEmpty _ = False push :: a -> Stack a -> Stack a push x (Stack xs) = Stack (x:xs) pop :: Stack a -> (a, Stack a) pop (Stack (x:xs)) = (x, Stack xs)
Haskellã®ã¤ã³ãã³ãã«ã¼ã«ããããããªãã®ã§ãè¦ã人ã«ãã£ã¦ã¯ãã¢ã¤ããã
ãªã«ãã¢ããã¤ã¹ãã£ããæãã¦ãã ããï¼ï¼
ãã¨6/3ã§25æ³ã«ãªãã¾ããï¼ããã§ã¨ããããï¼