Subject: Re: Functional programming
From: (Rob Warnock)
Date: 1999/11/10
Newsgroups: comp.lang.lisp
Message-ID: <80atnu$>
Tim Bradshaw  <> wrote:
| * Tord Kallqvist Romstad wrote:
| > I cannot think of any situations in which this is useful.  Could you 
| > please give an example?  Thanks in advance!
| I have code that looks like:
| 	(funcall (if multiprocessing-p #'process-run-function #'funcall)
| 	         #'(lambda ()
| 		     ...))

But since in Scheme the "function" position is evaluated with the *same*
rules as the "arg" positions -- that is, the function position can be
*any* expression that evaluates to a function -- you can accomplish the
above in Scheme with:

  	((if multiprocessing-p process-run-function (lambda (x) (x)))
  	         (lambda ()


p.s. A definition of "funcall" that would work with the above *and*
handle the more general uses of "funcall" is:

	(define (funcall f . rest) (apply f rest))

Then you could say:

  	((if multiprocessing-p process-run-function funcall)
  	         (lambda ()

Rob Warnock, 8L-846
Applied Networking
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		FAX: 650-933-0511
Mountain View, CA  94043	PP-ASEL-IA