Path: csiph.com!weretis.net!feeder9.news.weretis.net!border-4.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-3.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 17 Jun 2026 01:50:31 +0000 From: steve g Newsgroups: comp.lang.lisp Subject: Re: implementing scheme - implementing macros References: <110hst1$2gjgb$1@dont-email.me> Date: Tue, 16 Jun 2026 21:50:26 -0400 Message-ID: <87ik7iq6jh.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:LMVeeCBgt+M7jniH8OsYL2ur6Yg= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Lines: 41 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-qAW6HaS3SIV+/YlEUpzOWa65FVPihfkwDWFpDtoi2wo7bQf/k8Ke6gElPd5yVIV0+ZObKXIlWe5lMqp!exWo8AL87AOpJgoOT38hEioB33BP7J98VC7TUS3NLDBTWvI= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Xref: csiph.com comp.lang.lisp:60931 Mario Rosell writes: > [ Repost from Reddit. r/lisp: https://t.ly/Fldzk ] > > Hello everyone. > > I am making a Scheme R5RS implementation and it is going pretty well. > > I am trying implement macros, and don't really know how to implement them. > Scheme has a pretty complex macro system, so for now I am trying to > implement defmacro and then implement define-syntax, syntax-case, etc. > > Any tips? using eval is your friend. the old emacs way was hard to read. the emacs lisp info page: " 14.1 A Simple Example of a Macro ================================ Suppose we would like to define a Lisp construct to increment a variable value, much like the ‘++’ operator in C. We would like to write ‘(inc x)’ and have the effect of ‘(setq x (1+ x))’. Here's a macro definition that does the job: (defmacro inc (var) (list 'setq var (list '1+ var))) " you need to ``reevaluate'' the macro twice. the commmon lisp was uses symbols like @ , . etc.. hope this is helpful.