小编T.T*_*T.T的帖子

haskell中的全加器

Haskell新手在这里.我需要一些帮助来为全加器编写函数.我有以下内容:

xor :: Bool -> Bool -> Bool
xor True False = True
xor False True = True
xor _ _ = False

fulladder :: Bool -> Bool -> Bool ->(Bool, Bool)
fulladder a b c =  c xor (a xor b) ++ (a&&b) || ((a xor b) && c)      
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

  * Couldn't match expected type `(Bool -> Bool -> Bool)
                                    -> Bool -> Bool'
                  with actual type `Bool'
  * The function `a' is applied to two arguments,
      but its …
Run Code Online (Sandbox Code Playgroud)

haskell boolean-logic

3
推荐指数
1
解决办法
589
查看次数

标签 统计

boolean-logic ×1

haskell ×1