how bout ...

antif: func [fn-args[block!]][not do fn-args]

then

anitif [fn args1  argn]


On Mon, 23 Feb 2004, Ladislav Mecir wrote:

>
> Doc draw my attention to the %subject%, which was discussed at
> comp.lang.scheme. The thread started with:
>
> {Suppose f is a function returning a boolean.Is there a way of defining
> a function anti, which, when given f, returns "not f"?}
>
> the discussion continued:
>
> {
>  > > > > (define (anti f)
>
> > > > >     (lambda args
> > > > >       (not (apply f args))))
>
> > > Why is this objectionable?  It provides the ability to do something that
> > > hardly any other languages can do.
> }
>
> {
> > This last statement is a bit too strong, even in Python you can do
>
> Sheesh, I clearly said "hardly any other languages", not "no other
> languages".  I stand by my original statement -- most programming
> languages can't do this.  Python and Scheme are some of the few that
> can.  C can do it for functions of a specific arity, but can't
> generalize (e.g. you can write anti_f1 for 1-argument functions, anti_f2
> for 2-argument functions, etc.)
> }
>
> {
> I expect most general-purpose dynamically typed languages can, at least
> those using a conventional syntax. Perl can, Ruby can (but its treatment
> of higher orded functions is weird), Dylan can, and probably all Lisp
> variants too.
>
> Smalltalk can't because variable arity doesn't make sense: the method name
> implies the arity syntactically. Rebol probably can't: here the arity of a
> function tells how many words to parse as its argument and where the next
> function call begins. Forth and Postscript can't.
>
> Among statically typed languages C# can, and it's the only one I know.
> }
>
> Question: Is the guess about Rebol correct? (I will post my answer later)
>
> -L
>
>
> --
> 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.

Reply via email to