From: "Maciek Godek" <pstrychuj@gmail.com>
To: guile-user@gnu.org
Subject: Re: References/locations
Date: Fri, 15 Aug 2008 11:35:26 +0200 [thread overview]
Message-ID: <e2ceda030808150235i257d5d63y5946987f9e2c24b@mail.gmail.com> (raw)
In-Reply-To: <m2ljz5nw8k.fsf@member.fsf.org>
Stephen Compall:
> Actually, if you (use-syntax (ice-9 syncase)), you should be able to
> define lexical symbol-macros that expand a single symbol, even in a
> set! place, something like:
>
> (define v #(1 2 3))
> (define-syntax v1
> (lambda (stx)
> (syntax-case stx ()
> (_ v))))
I don't really get this syntax-rules. Do you know of any good tutorial?
[I find the description in the revised report too difficult to understand]
> Obviously aliasing will serve:
>
> (define-syntax alias-syntax
> (syntax-rules ()
> ((_ form)
> (lambda (stx)
> (syntax-case stx ()
> (_ (syntax form)))))))
>
> (define-syntax defalias
> (syntax-rules stx ()
> ((_ new form)
> (define-syntax new (alias-syntax form)))))
ERROR: invalid syntax (syntax-rules stx () ((_ new form)
(define-syntax new (alias-syntax form))))
=> error-in-evaluation
(That's what guile says)
> (define-syntax let-alias
> (syntax-rules ()
> ((_ ((new form) ...) body ...)
> (let-syntax ((new (alias-syntax form)) ...) body ...))))
>
> (defalias v1 (vector-ref v 1))
>
> (set! v1 42)
> (vector-ref v 1) ; => 42
Could you explain it in more detail? Why should it work?
(Or at least give me a link with such explanations)
Thanks in advance
M.
next prev parent reply other threads:[~2008-08-15 9:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-08 1:50 References/locations Maciek Godek
2008-08-10 7:51 ` References/locations Stephen Compall
2008-08-15 9:35 ` Maciek Godek [this message]
[not found] ` <e2ceda030808141732r524fc0cehb8ae7c6007550ea6@mail.gmail.com>
[not found] ` <m2wsihltfv.fsf@member.fsf.org>
[not found] ` <e2ceda030808200441q52d9858bv63323055e0f6308a@mail.gmail.com>
2008-08-21 5:05 ` References/locations Stephen Compall
[not found] <cmu-lmtpd-5833-1218211546-4@mail-imap1.uio.no>
2008-08-08 18:34 ` References/locations Kjetil S. Matheussen
2008-08-10 23:00 ` References/locations Maciek Godek
2008-08-15 10:14 ` References/locations Maciek Godek
2008-08-15 13:55 ` References/locations Clinton Ebadi
2008-08-18 8:09 ` References/locations Maciek Godek
2008-08-18 16:15 ` References/locations Clinton Ebadi
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=e2ceda030808150235i257d5d63y5946987f9e2c24b@mail.gmail.com \
--to=pstrychuj@gmail.com \
--cc=guile-user@gnu.org \
/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).