unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Panicz Maciej Godek <godek.maciek@gmail.com>
To: guile-user@gnu.org
Subject: Reader syntax for accessing arrays
Date: Tue, 23 Aug 2011 01:17:38 +0200	[thread overview]
Message-ID: <CAMFYt2ZqK7ax7uU3os0c+Oe_gGFY0aiPsHoVdCc_Zu2Xe41GeQ@mail.gmail.com> (raw)

Hi,
I've noticed that one of the biggest inconveniences of lisp is a very
clumsy way of accessing arrays.
Having to write
(array-set! a (* (array-ref a i j) 2) i j))
seems to be unnecessarily prolix, for in C, language designed
specifically to access arrays,
the same operation could be written as
a[i][j] *= 2;

Indeed, LISP is intended for processing lists, but there are certain
tasks where dealing with
arrays is inevitable. So perhaps it would be a good idea to use square
brackets, as it is
done in C, to access arrays, so that
[a i j]
could be understood by the interpreter as
(ref-array a i j)
where ref-array is the appropriate getter with setter.

Therefore I wonder how could this functionality be implemented in
guile, or, preferably,
in generic R^5RS. [I've heard that R^6RS makes no distinction between [] and ()]

Regards
Maciek



             reply	other threads:[~2011-08-22 23:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 23:17 Panicz Maciej Godek [this message]
2011-08-23  8:10 ` Reader syntax for accessing arrays 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
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=CAMFYt2ZqK7ax7uU3os0c+Oe_gGFY0aiPsHoVdCc_Zu2Xe41GeQ@mail.gmail.com \
    --to=godek.maciek@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).