Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!mips!apple!uokmax!munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!levels!majgr From: Jenny.Rowland@levels.sait.edu.au Newsgroups: comp.lang.lisp Subject: macro misbehaviour Message-ID: <16456.285261a2@levels.sait.edu.au> Date: 9 Jun 91 07:43:06 GMT Organization: University of South Australia Lines: 50 Please help..... I use VAX Lisp, and have come across some annoying behaviour. I would like to know: 1. why it occurs; (I suspect that it is some kind of optimization) 2. how to get around it. The Problem: Given the following macros and function: (DEFMACRO TRY (X) (LET ((A (EVAL X))) `(TT ,(MAPCAR #'ADD-1 A)))) (DEFUN ADD-1 (X) (1+ X)) (DEFMACRO TT (X) `(FORMAT T "~a ~%" ',X)) and the following code: (dotimes (n 3) (let ((a (list n n n))) (try a))) I get the following results: (1 1 1) (1 1 1) (1 1 1) when I would expect: (1 1 1) (2 2 2) (3 3 3) It appears that the first call is evaluated, but further calls are 'recognised' as being the same as previous calls (despite the fact that the value of n and therefore a has changed), bypasses evaluation of the mapcar form, and sends the previous result to macro tt. Has anyone and explanation? and HOW CAN I GET AROUND IT??? Regards, and thanks in advance, Jenny Rowland -------- Jenny.rowland@sait.edu.au University of South Australia .....You play, you win, you play, you lose, you play... J Winterson