gpt4 book ai didi

scheme - Andmap\ormap - chez 方案

转载 作者:行者123 更新时间:2023-12-04 00:46:49 25 4
gpt4 key购买 nike

我试图在 chez 方案中查找有关 andmap 和 ormap 操作的信息。

还是不明白这些操作的用途,和map有什么区别。

最佳答案

在伪方案中,

(andmap f xs)  ==  (fold and #t (map f xs))
(ormap f xs) == (fold or #f (map f xs))

除了那个:
  • 您不能使用 andor通过这种方式。
  • andmapormap可以短路处理列表。

  • 也就是说,除了略有不同的短路行为,
    (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/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com