[alexandria-devel] DX declaration in COMPOSE &c

Tobias C. Rittweiler tcr at freebits.de
Mon Mar 10 12:48:44 UTC 2008


;;; Isn't the DYNAMIC-EXTENT declaration wrong on
;;;
;;; (flet ((id (&rest args) args))
;;;   (compose #'id #'id))
;;;
;;; ?

(defun compose (function &rest more-functions)
  "Returns a function composed of FUNCTION and MORE-FUNCTIONS that applies its
arguments to to each in turn, starting from the rightmost of MORE-FUNCTIONS,
and then calling the next one with the primary value of the last."
  (declare (optimize (speed 3) (safety 1) (debug 1)))
  (reduce (lambda (f g)
            (lambda (&rest arguments)
              (declare (dynamic-extent arguments))
              (funcall f (apply g arguments))))
          more-functions
          :initial-value function))


Similiar for MULTIPLE-VALUE-COMPOSE, CURRY, and RCURRY.

  -T.




More information about the alexandria-devel mailing list