我正在学习Haskell,并且我正在尝试编写一个函数来返回一个数字的因子列表。这就是我所拥有的:factors n = [x | x <- [2..s], n `mod` x == 0]当我尝试在ghci中加载模块时,我得到两个错误, No instance for (RealFrac Int)
arising from
我编写了以下函数。f :: Integer -> Integer但是,会发生以下编译时错误:
F.hs:2:31:‘的使用没有(RealFrac整数)的实例,即floor' In the expression: floor . logBase 2 In the expression: (floor:在
我正在学习Haskell。我已经创建了一个函数,它在基数'b‘中返回最大为'n’的乘法表。数字被填充到“w”数字。作为最后一步,我想自动计算“w”。为什么这个不能编译?needed for the multiplication table n*n in base 'base'nOfDg n base = 1 + floor( logBase base (n*n)) No