我试图在 chez 方案中查找有关 andmap 和 ormap 操作的信息。
还是不明白这些操作的用途,和map有什么区别。
最佳答案
在伪方案中,
(andmap f xs) == (fold and #t (map f xs))
(ormap f xs) == (fold or #f (map f xs))
除了那个:
and
和 or
通过这种方式。 andmap
和 ormap
可以短路处理列表。 也就是说,除了略有不同的短路行为,
(andmap f (list x1 x2 x3 ...)) == (and (f x1) (f x2) (f x3) ...)
(ormap f (list x1 x2 x3 ...)) == (or (f x1) (f x2) (f x3) ...)
关于scheme - Andmap\ormap - chez 方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8231383/