【发布时间】:2017-01-25 01:39:16
【问题描述】:
我正在尝试使用foldr 或foldl 在SML 中构建一个函数,它将返回列表中所有元素的逻辑或逻辑和。
我尝试过这种方式,使用 and 和 or:
fun band x = foldr (op and) true x;
fun bor x = foldr (op or) false x;
并且还使用 andalso 和 orelse。但我不断收到错误消息,例如:
Error: unbound variable or constructor: or
【问题讨论】:
标签: functional-programming sml fold ml