Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!europa.asd.contel.com!gatech!prism!gt4084c From: gt4084c@prism.gatech.EDU (SRINIVASAN,K) Newsgroups: comp.lang.lisp Subject: Re: macro misbehaviour Message-ID: <30996@hydra.gatech.EDU> Date: 10 Jun 91 02:38:59 GMT References: <16456.285261a2@levels.sait.edu.au> Organization: Georgia Institute of Technology Lines: 27 I have a similar problem too. I wrote the follwing macro for reading a file and defining classes. During any single iteration, the three calls to "read" read three succesive symbols from the file as you would expect. However, during successive iterations, the same set of three symbols are read repeatedly. So, I get the same class defined 4 times instead of defining 4 different classes. If I put in 4 explicit calls contained in a progn form instead of the do-loop, it works fine. Can somebody please help me fix this problem. Thanks in advance. Define-Class is a macro calling defclass (written by Marty Hall of AAI Corp., and very kindly shared with me). (defmacro class-from-file (file-name) (with-open-file (input-stream file-name :direction :input) `(do ((q 4 (- q 1))) ((= q 0) nil) (Define-Class ,(read input-stream) ,(read input-stream) .,(read input-stream))))) -- SRINIVASAN,K School of Textile Engineering Georgia Tech. uucp: ...!{allegra,amd,hplabs,seismo,ut-ngp}!gatech!prism!gt4084c ARPA: gt4084c@prism.gatech.edu