这是我的代码:
data Binary_Tree a = Null
|Node {element :: a, left_tree, right_tree :: Binary_Tree a}
deriving (Show, Eq)
--depth_of_tree
dot :: Integral b => Binary_Tree a -> b
dot Null = 0
dot Node (a left right) = 1 + (dot Node (a left right)) + (dot Node (a left right))
但是,当我在 ghci 中加载它并输入
dot Node (2 (Node 3 Null Null) Null)
它出现了一个错误:
<interactive>:13:1:
Not in scope: `dot'
Perhaps you meant `not' (imported from Prelude)
有人喜欢告诉我我的代码有什么问题吗?
感谢任何可以给我一些建议的人XD