Hello,
Examples:
> ( (&& (number? negative? even?)) -4 )
#t
> ( (&& (number? negative? even?)) -5 )
#f
Like the compose macro from a couple of days ago, this one also allows a
specification of the resulting procedure arity:
> (define (f x y) (> (+ x y) 5))
> (define (g x y) (> (* x y) 10))
> ( (&& (> f g) (x y)) 4 5 )
#f
> ( (&& (> f g) (x y)) 5 4 )
#t
>
The macro:
(define-syntax &&
(syntax-rules ()
( (&& (f ...) (x ...))
(lambda (x ...)
(and (f x ...)
...)) )
( (&& (f ...))
(&& (f ...) (x)) )))
Just curious, what do y'all use for this sort of thing?
Ed