[Openmcl-devel] Misleading documentation for PROCESS-RUN-FUNCTION (&c.)

Denis Bueno dbueno at gmail.com
Sat Mar 19 09:35:27 PST 2005

I'm writing a bit of multithreaded code to parallelize something I've
already written. I have written various multithreaded apps before,
but, only one other (and that very small) thing in openmcl. So I may
be wrong in my estimation of the problem, but, whatever.

1) The documentation for PROCESS-RUN-FUNCTION
(http://openmcl.clozure.com/Doc/re08.html) doesn't say that it accepts
the :INITIAL-BINDINGS keyword as part of the PROCESS-SPECIFIER.
However, in the process of looking in the mailing list archives and
writing my own thing, it does accept that parameter. So, the
documentation should be update to reflect that. I'd be happy to do

2) In the documentation for MAKE-PROCESS
(http://openmcl.clozure.com/Doc/re02.html) the :INITIAL-BINDINGS
keyword argument is described thus: "an alist of ( symbol  . valueform
) pairs, which can be used to initialize special variable bindings in
the new thread. Each valueform  is used to compute the value of a new
binding of symbol  in the execution environment of the newly-created
thread. The default is nil." This, however, is misleading, given the
following behavior.

If, for example, (9 9 3 13 18 3 0 19 8 7) the cdr of some binding in
:INITIAL-BINDINGS, like so: '((*candidate* 9 9 3 13 18 3 0 19 8 7)),
then I get the following error:

> Error in process test(3): 9 is not of type (OR SYMBOL
>                                                                            FUNCTION), and can't be FUNCALLed or APPLYed

I took a look at ccl/level-1/l1-processes.lisp and found the following:

(defun wrap-initial-bindings (alist) ; line 89
  (mapcar #'(lambda (pair)
              (destructuring-bind (symbol . valform) pair
                (cons (require-type symbol 'symbol)
                      (cond ((symbolp valform)
                             (constantly (symbol-value valform)))
                            ((typep valform 'function) valform)
                            ((consp valform)                    ; this test
                             (if (eq (car valform) 'quote)
                               (constantly (cadr valform))
                               #'(lambda () (apply (car valform) (cdr
                             (constantly valform))))))

Since ALIST should be treated as an alist, it seems bizarre to apply
the first element of the cdr of the PAIR to the rest, if quote isn't
present. (Does this behaviour have anything to do with this thread?

Anyway, I *think* the following patch fixes the problem, if in deed
there's a problem. The only snag is I haven't built openmcl with this
patch, so I can't verify that it works, or even builds. (See the
message I sent to the list not long ago, "Having problems starting
bootstrapping heap image build").

As soon as I figure out what I'm missing in the build process, I'll
build with this patch and see if it fixes my problem.

Index: l1-processes.lisp
RCS file: /usr/local/tmpcvs/ccl-0.14-dev/ccl/level-1/l1-processes.lisp,v
retrieving revision 1.8
diff -u -r1.8 l1-processes.lisp
--- l1-processes.lisp   23 Jun 2004 17:32:00 -0000      1.8
+++ l1-processes.lisp   19 Mar 2005 17:24:10 -0000
@@ -93,10 +93,6 @@
                       (cond ((symbolp valform)
                              (constantly (symbol-value valform)))
                             ((typep valform 'function) valform)
-                            ((consp valform)
-                             (if (eq (car valform) 'quote)
-                               (constantly (cadr valform))
-                               #'(lambda () (apply (car valform) (cdr
                              (constantly valform))))))

Denis Bueno
PGP: http://pgp.mit.edu:11371/pks/lookup?search=0xA1B51B4B&op=index

More information about the Openmcl-devel mailing list