From: Steve Dickey
Subject: beginner question
Date: 
Message-ID: <m27lvtdgaf.fsf@bonkonin.hip.berkeley.edu>
Hello,
  I have a basic understanding of lisp and have been playing with acl5 on linux
with the emacs lisp interface. In order to get a better feel for how the tools
might actually be used, I tried to build the maxima-5.4 source.  I realize that
this is old code, and may not be the best way to learn about how lisp is used
today. Nevertheless, after setting some of the compatibility options in acl,
such as:

#+allegro(setq comp:*cltl1-compile-file-toplevel-compatibility-p* t)
#+allegro(setq excl:*enable-package-locked-errors* nil)
#+allegro(setq excl:*cltl1-in-package-compatibility-p* t)

much of the package compiled (with many warnings to investigate) before I ran
into a problem which I can not figure out.

The error from acl is:

  ; While compiling SWAP-ROWS:
  Error  Cannot expand STORE for array reference (#'MELT MAT N K)

SWAP-ROWS is a function:


(defun SWAP-ROWS (mat m n)		;Interchange row m and n
       (do ((k 0 (f1+ k))
	    (l (ncols mat)))
	   ((> k l) mat)
	   (store (arraycall fixnum mat m k)
		  (prog2 0 (melt mat n k)
			 (store (melt mat n k) (melt mat m k))))))


STORE, the last call in swap-rows, is a macro defined as:


(DEFMACRO STORE (ARRAY-REF NEW-VALUE &aux expand-1 )
  (cond ((not (memq (car array-ref ) '(aref arraycall)))
	 (setq expand-1 (macroexpand-1 array-ref))
	 (setq array-ref
	   (cond ((memq (car expand-1 ) '(aref arraycall))
		  expand-1)
		 (t  (macroexpand array-ref))))))
  (CASE (FIRST ARRAY-REF)
	(FUNCALL (STORE-MACRO-HELPER (CDR ARRAY-REF) NEW-VALUE))
					;    (ARRAYCALL (STORE-MACRO-HELPER (CDDR ARRAY-REF) NEW-VALUE))
	;;the arrays ought to all be on in the symbol location by now --wfs
	(ARRAYCALL `(setf ,array-ref ,new-value))
	(aref `(setf ,array-ref ,new-value))
	(OTHERWISE (STORE-MACRO-HELPER `(#',(FIRST ARRAY-REF) . ,(CDR ARRAY-REF)) NEW-VALUE))))


melt is another macro:


(defmacro melt (a . indices) `(arraycall fixnum ,a . ,indices))


and arraycall is another macro:


(defmacro arraycall (ign array &rest dims) ign
  `(aref ,array . ,dims))


My guess is that the problem has something to do with the calls to macroexpand, 
but I am not at all sure how to go about finding what exactly the problem is.
Any help either pointing out where the problem is, or describing how to use the
tools to find it would be appreciated.

--
Steve Dickey
From: Barry Margolin
Subject: Re: beginner question
Date: 
Message-ID: <Orwd2.8$J61.219@burlma1-snr1.gtei.net>
In article <··············@bonkonin.hip.berkeley.edu>,
Steve Dickey  <······@cory.eecs.berkeley.edu> wrote:
>The error from acl is:
>
>  ; While compiling SWAP-ROWS:
>  Error  Cannot expand STORE for array reference (#'MELT MAT N K)

I suspect you didn't define the MELT macro prior to trying to compile
SWAP-ROWS, so it's not able to expand the MELT form when expanding STORE.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Don't bother cc'ing followups to me.