From: Panicz Maciej Godek <godek.maciek@gmail.com>
To: Johan Hidding <johannes.hidding@gmail.com>
Cc: "Ludovic Courtès" <ludo@gnu.org>, guile-user@gnu.org
Subject: Re: Reader syntax for accessing arrays
Date: Fri, 26 Aug 2011 23:02:31 +0200 [thread overview]
Message-ID: <CAMFYt2b0ykdjDxkfWf9XQoe4m3pzewq-Q850Ah9ZeV0vNiE0wg@mail.gmail.com> (raw)
In-Reply-To: <CAEz5FLb_ekgs3RK7qCT5uYjVp6P1WczPgE1mTcwgbb+wtTdM=g@mail.gmail.com>
Howdie,
I would agree that specifying a rigid behavior for [] and {} brackets
is pretty far away from the minimalistic spirit of scheme. However,
section 7.1.1 of R5RS specification states, that characters [, ], {, }
and | are "reserved for further extension of the language".
(R6RS, on the other hand, makes a step backward, and indeed
specifies a trivial rigid behavior for []).
I eventually went without making a closure, and defined the
following syntax:
(define-syntax [
(syntax-rules (])
(([ v i ])
(vector-ref v i))))
It has three disadvantages. Firstly, it still needs the additional
surrounding parentheses, secondly it requires spaces between
the adjacent symbols, and thirdly it is not R5RS compliant, due
to the reason stated above (and hence it doesn't work with
various scheme implementations).
I remember that I once used the infix module written by Daniel
Skarda, but it used the quite non-portable read-hash-extend and
I guess it is no longer shipped with guile.
I believe that there must be a way to utilize the square and
curly brackets that would suit the scheme philosophy. Perhaps
the bigloo's read mechanism is close to that way, as it is
conceptually simple, makes scheme more self-documentable
and allows it to remain compatible with the behavior of []
in R6RS, while enabling the programmer to specify new behavior
for it.
Best regards,
Maciek
next prev parent reply other threads:[~2011-08-26 21:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-22 23:17 Reader syntax for accessing arrays Panicz Maciej Godek
2011-08-23 8:10 ` Johan Hidding
2011-08-23 18:03 ` Panicz Maciej Godek
2011-08-24 10:51 ` Ludovic Courtès
2011-08-24 18:45 ` Panicz Maciej Godek
2011-08-24 19:52 ` Johan Hidding
2011-08-26 21:02 ` Panicz Maciej Godek [this message]
2012-01-09 15:39 ` Andy Wingo
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=CAMFYt2b0ykdjDxkfWf9XQoe4m3pzewq-Q850Ah9ZeV0vNiE0wg@mail.gmail.com \
--to=godek.maciek@gmail.com \
--cc=guile-user@gnu.org \
--cc=johannes.hidding@gmail.com \
--cc=ludo@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).