不在范围“foldrl”内;
尝试定义函数
maximum' :: (Ord a) => [a] -> a
maximum' = foldrl (\x acc -> if x > acc then x else acc)
ghci 时报告错误:
Not in scope: `foldrl'
Failed, modules loaded: none.
Ubuntu 10.04
$ ghci --version
The Glorious Glasgow Haskell Compilation System, version 6.12.1
Why isn't the function foldrl
in range?
When trying to define the function
maximum' :: (Ord a) => [a] -> a
maximum' = foldrl (\x acc -> if x > acc then x else acc)
ghci reports the error:
Not in scope: `foldrl'
Failed, modules loaded: none.
Ubuntu 10.04
$ ghci --version
The Glorious Glasgow Haskell Compilation System, version 6.12.1
Why isn't the function foldrl
in scope?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
哦哦,你想要
foldr1
而不是foldrl
,最后一个字符是1
,而不是l
Ohhh, you want
foldr1
notfoldrl
, the last character is a1
, not anl
我认为你的意思是
foldr1
(最后一个字符是数字1
),而不是foldrl
。I think you mean
foldr1
(last character is the digit1
), notfoldrl
.