you could use my encompass function to create an anti function. It would even handle all the refinements transparently and would map all parameters, without you needing to know the function's actual argument block.
-MAx --- "You can either be part of the problem or part of the solution, but in the end, being part of the problem is much more fun." > -----Original Message----- > From: Andreas Bolka [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 24, 2004 7:54 AM > To: Ladislav Mecir > Subject: [REBOL] Re: Can I define an anti function? > > > > > Monday, February 23, 2004, 8:55:15 PM, Ladislav wrote: > > > Question: Is the guess about Rebol correct? (I will post my answer > > later) > > I'll second Gabriele's answer: The reasoning seems to be intriguing at > first glance, but it's (at least partly) wrong. > > A (naive) demonstration: > > anti: func [ f ] [ func first :f compose [ not (second :f) ] ] > > f: func [ a b ] [ = a b ] > anti-f: anti :f > > f 1 2 > ; == false > anti-f 1 2 > ; == true > > The above obviously does not cope with functions where 'return is > used, however I'm not going into more detail here, as I'm really > looking forward to Ladislav's answer (which will be more correct than > mine could ever be, anyway). > > But let me explain why I weakened my above statement with 'at least > partly'. In Scheme the following is perfectly legal: > > (define (anti f) (lambda args (not (apply f args)))) > (define (f a b) (equal? a b)) > ((anti f) 1 2) > ; == #t > > In REBOL however, my naive approach given above would not give the > desired results in this case (anti :f 1 2), as anti :f does not return > a "loaded" function, i.e. we'd have to force it's application by using > 'do: > > >> do anti :f 1 2 > == true > >> do anti :f 1 1 > == false > > In my opinion, that is the perfect REBOL equivalent to the special > Scheme form used above. However, Scheme purists may argue with me on > that point :) Nevertheless, even in Scheme, I imagine the "typical" > use of anti would be: > > (define anti-f (anti f)) > > -- > Best regards, > Andreas > > > -- > To unsubscribe from this list, just send an email to > [EMAIL PROTECTED] with unsubscribe as the subject. > > -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.