non;;; Negate a predicate. ; ; (non p) => procedure returning negation of what p returns ; (define (non p) (lambda args (not (apply p args))))
not to automatically interpret multiple arguments as procedure call
Since not takes only one argument, we can overload it for multiple
arguments to automatically parenthesize the arguments.
;;; Extend not to interpret multiple arguments as procedure call.
;
; (not a) => usual meaning
; (not f a1 ...) => (not (f a1 ...))
;
(define not
(let ((not not))
(lambda (a/f . args)
(if (null? args) (not a/f) (not (apply a/f args))))))