From: Joris van der Hoeven <TeXmacs@math.u-psud.fr>
Subject: Quasi-macros ?
Date: Sun, 9 Feb 2003 20:23:23 +0100 (MET) [thread overview]
Message-ID: <Pine.GSO.3.96.1030209201831.26546C-100000@anh> (raw)
Hi,
Consider the following piece of code:
(define (define-table-decls name l)
(if (null? l) l
(cons `(hash-set! ,name ',(caar l) ',(cadar l))
(define-table-decls name (cdr l)))))
(define-macro (define-table name . l)
`(begin
(define ,name (make-hash-table ,(+ (* (length l) 2) 1)))
,@(define-table-decls name l)))
(define-table test
(hello hoi)
(joke grapje)
(gnu blauwbilgorgel))
This allows you to define many tables in a nice way.
Sometimes however, it would be nice to write things like
(define-table the-question
(two ,(+ 1 1))
(four ,(* 2 2)))
Someone has an idea of how to do this *without* explicitly
using 'eval', which might result in loosing the context?
Thanks, Joris
-----------------------------------------------------------
Joris van der Hoeven <vdhoeven@texmacs.org>
http://www.texmacs.org: GNU TeXmacs scientific text editor
http://www.math.u-psud.fr/~vdhoeven: personal homepage
-----------------------------------------------------------
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
next reply other threads:[~2003-02-09 19:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-09 19:23 Joris van der Hoeven [this message]
2003-02-10 16:33 ` Quasi-macros ? david
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.GSO.3.96.1030209201831.26546C-100000@anh \
--to=texmacs@math.u-psud.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).