Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.lisp > #60931

Re: implementing scheme - implementing macros

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 <Sgonedes1977@gmail.com>
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> (permalink)
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

Show key headers only | View raw


Mario Rosell <mario@mariorosell.es> 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.

Back to comp.lang.lisp | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

implementing scheme - implementing macros Mario Rosell <mario@mariorosell.es> - 2026-06-12 21:15 +0000
  Re: implementing scheme - implementing macros steve g <Sgonedes1977@gmail.com> - 2026-06-16 21:50 -0400
    Re: implementing scheme - implementing macros Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-06-17 03:14 +0000
    Re: implementing scheme - implementing macros Paul Rubin <no.email@nospam.invalid> - 2026-06-16 21:45 -0700
      Re: implementing scheme - implementing macros steve g <Sgonedes1977@gmail.com> - 2026-06-19 23:15 -0400
  Re: implementing scheme - implementing macros antispam@fricas.org (Waldek Hebisch) - 2026-06-17 14:26 +0000
  Re: implementing scheme - implementing macros Kaz Kylheku <046-301-5902@kylheku.com> - 2026-06-23 20:59 +0000
    Re: implementing scheme - implementing macros Stefan Monnier <monnier@iro.umontreal.ca> - 2026-06-25 10:59 -0400
    Re: implementing scheme - implementing macros Kragen Javier Sitaker <kragen@canonical.org> - 2026-08-29 17:15 -0300

csiph-web