[previous] [up] [next]     [index]
Next: Numbers Up: Basic Data Extensions Previous: Void and Undefined

Booleans

Unless otherwise specified, two instances of a particular MzScheme data type are equal? only when they are eq?.

The andmap and ormap procedures apply a test procedure to the elements of a list, returning immediately when the result for testing the entire list is determined. The arguments to andmap and ormap are the same as for map, but a single Boolean value is returned as the result rather than a list:

Examples:

  (andmap positive? '(1 2 3)) ; => #t
  (ormap eq? '(a b c) '(a b c)) ; => #t
  (andmap positive? '(1 2 a)) ; => raises exn:application:type
  (ormap positive? '(1 2 a)) ; => #t
  (andmap positive? '(1 -2 a)) ; => #f
  (andmap + '(1 2 3) '(4 5 6)) ; => 9
  (ormap + '(1 2 3) '(4 5 6)) ; => 5 


PLT