您好,我使用sublime text 3和带有ghci的cmd shell。我在st3中编写了以下函数:
testing :: Int -> Bool
testing 0 = True
testing 1 = False
testing n = testing(n mod 2)
我知道haskell提供了一个偶函数,但是我们必须编写自己的偶函数,所以我想到了这个。当我将文件加载到ghci中时:
:cd <pathtofile>
:l myfile.hs
并尝试使用]执行我的功能>
testing 10
我收到此错误:
Variable not in scope: testing :: t0 -> t
[我可能应该提到测试:: Int-> Bool与fibonacci函数共享文件,但是那不应该是问题吧?任何帮助表示赞赏!
您好,我使用sublime text 3和带有ghci的cmd shell。我在st3中编写了以下函数:testing :: Int-> Bool testing 0 =真实测试1 = False test n = testing(n mod 2)我知道haskell ...
我认为它是mod n 2
或n`mod` 2`,也许与此有关。