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

STACK-LET



    Date: Tue, 11 May 1993 18:17 EDT
    From: jbarnett@charming.nrtc.northrop.com

    STACK-LET and the more primitive stack-consers don't seem to handle MAKE-LIST.
    For something I'm doing, I am using forms like
	    (STACK-LET*((ARRAY (ZL:MAKE-ARRAY N :TYPE SYS:ART-Q-LIST))
			(LIST (G-L-P ARRAY)))
	      body)
    Is there any cleaner way to do this sort of thing?

    Jeff

STACK-LET is driven off the entries in the alist
SI:*STACK-LET-OPERATIONS*.  It uses this to translate function calls
into corresponding WITH-STACK-xxx bindings.  Here's an addition that
does what you want.

(defmacro with-stack-make-list ((var size &key initial-element) 
				&body body)
  ;; Use ,VAR for both bindings, so don't need a GENSYM!
  `(stack-let* ((,var (zl:make-array ,size :type sys:art-q-list
				     :initial-value ,initial-element)) 
                (,var (g-l-p ,var)))
     ,@body))

(eval-when (compile load eval)
  (pushnew '(make-list 1 nil with-stack-make-list)
	   si:*stack-let-operations* :key #'car))