On Fri, 2009-09-04 at 16:10 -0500, Eduardo Cavazos wrote:
> 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?

lambda or my `and?' higher-order procedure.  I find syntax like this
confusing, because I have to learn the syntax for no syntactic benefit
(IMO) over lambda (but the same could be said of my `and?', which I've
barely used, I mostly made it for fun).  But keep practicing macros and
build your own world and don't listen to me.

-- 
: Derick
----------------------------------------------------------------

Reply via email to