[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Lexical closures (bug?)

    Date: Mon, 15 Aug 88 14:58:32 pdt
    From: lbaum@BOEING.COM (Larry Baum)

Your problem is with the documented Symbolics incompatibility with CL
&rest args.  The infinite loop you're getting into is because the &rest
args are stack consed and are therefore no longer valid by the time the
closure is called.  Try this instead:

(defun compose (&rest functions)
  (setq functions (copy-list functions))
  #'(lambda (x)
      (do ((fns functions (cdr fns))
	   (value x (funcall (car fns) value)))
	  ((null fns) value))))