Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Andmap\ormap - chez scheme

I tried to find information about andmap & ormap operations in chez scheme.

Still, I don't understand the use of these operations, and what is the difference between it and map.

like image 386
Adam Sh Avatar asked Oct 27 '25 21:10

Adam Sh


1 Answers

In pseudo-Scheme,

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

except that:

  1. You can't use and and or in this way.
  2. andmap and ormap can short-circuit processing the list.

That is, except for slightly different short-circuiting behavior,

(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) ...)
like image 190
Matthias Benkard Avatar answered Oct 30 '25 15:10

Matthias Benkard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!