home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.lang.scheme
- Subject: Re: arity problem
- Date: 13 Nov 1992 17:51:21 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 21
- Message-ID: <1e0pupINNgp6@early-bird.think.com>
- References: <1992Nov12.234655.12264@newssrv.edvz.univie.ac.at>
- NNTP-Posting-Host: telecaster.think.com
-
- In article <1992Nov12.234655.12264@newssrv.edvz.univie.ac.at> A4422DAB@vm.univie.ac.at (Erich Neuwirth) writes:
- >i want to do the following:
- >i need a function which takes a logical function as input and
- >returns the function which is just the negation.
- >as long as i know the arity of the input function it is easy
- >to write this meta function just uning lambda, but i want this
- >operation to work with functions of any arity (=number of arguments)
- >in the best case it even should work with functions with variable arity.
- >is there a way to acomplish this?
-
- The function it returns should take any number of arguments and just pass
- them along with apply:
-
- (define (inverse f)
- (lambda args (not (apply f args))))
-
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-