Marco Antoniotti <marcoxa@parades.rm.cnr.it> wrote:
+---------------
| > 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 ()
| > ...))
|
| If multiprocessing is on then 'process-run-function' executes the
| lambda, otherwise the lambda is sipmply returned as a value.
+---------------
You're not reading what I typed clsoely enough. What you said would have
be true if I had typed *this*:
((if multiprocessing-p process-run-function (lambda (x) x))
(lambda ()
...))
but I didn't. In what I typed (which you quoted correctly), if
multiprocessing is on the lambda on the following lines is passed
as a parameter to the "process-run-function", otherwise the lambda
is passed as a parameter to the unnamed function "(lambda (x) (x))",
which *calls* it! (...with no args.) Again:
(lambda (x) (x)) ; calls its arg
(lambda (x) x) ; returns its arg
+---------------
| > 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 ()
| > ...))
|
| Now, this would work.
+---------------
Both forms work as originally posted.
-Rob
-----
Rob Warnock, 8L-846 rpw3@sgi.com
Applied Networking http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
1600 Amphitheatre Pkwy. FAX: 650-933-0511
Mountain View, CA 94043 PP-ASEL-IA