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

Re: SOME (and other mapping

In article <9401052311.AA11767@cambridge.apple.com>,
Bill St. Clair <bill@cambridge.apple.com> wrote:

>You haven't missed anything. Genera uses a declaration inside each
>mapping function to implement your idea. Another implementation could
>enumerate the mapping functions some other way. MCL has no way to identify
>a mapping function, hence you need to explicitly include the dynamic-extent
>declaration in every caller.

Thanks for all the suggestions. Anyway, can't MCL do something like

(setf (symbol-function 'saved-some) (symbol-function 'some))
(defmacro some (fun &rest list)
    (if (and (consp fun)
             (eq (car fun) 'function)
             (consp (second fun))
             (eq (car (second fun)) 'lambda))
      (let ((args (second (second fun)))
            (body (cddr (second fun))))
            `(flet ((not-so-anonymous-lambda ,args ,@body))
               (declare (dynamic-extent #'not-so-anonymous-lambda))
               (saved-some #'not-so-anonymous-lambda ,@list))) 
      `(saved-some ,fun ,@list)))

With a little work, it could be cleaned up to something like
(define-downward-funarg some 0).  

I recalled there was no space allocated on the Symbolics, but I had
all my lisp machines carted away last month so I couldn't test it.  I
really like MCL, but it's a shame that it's not an improvement over