相关疑难解决方法(0)

用于分析Haskell程序性能的工具

在解决一些项目Euler问题以学习Haskell(所以目前我是一个完全初学者)时,我遇到了问题12.我写了这个(天真的)解决方案:

--Get Number of Divisors of n
numDivs :: Integer -> Integer
numDivs n = toInteger $ length [ x | x<-[2.. ((n `quot` 2)+1)], n `rem` x == 0] + 2

--Generate a List of Triangular Values
triaList :: [Integer]
triaList =  [foldr (+) 0 [1..n] | n <- [1..]]

--The same recursive
triaList2 = go 0 1
  where go cs n = (cs+n):go (cs+n) (n+1)

--Finds the first triangular Value with more than n Divisors
sol …
Run Code Online (Sandbox Code Playgroud)

performance profiling haskell

101
推荐指数
2
解决办法
2万
查看次数

标签 统计

haskell ×1

performance ×1

profiling ×1