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


Groups > comp.lang.lisp > #60931

Re: implementing scheme - implementing macros

From steve g <Sgonedes1977@gmail.com>
Newsgroups comp.lang.lisp
Subject Re: implementing scheme - implementing macros
References <110hst1$2gjgb$1@dont-email.me>
Date 2026-06-16 21:50 -0400
Message-ID <87ik7iq6jh.fsf@gmail.com> (permalink)

Show all headers | 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