[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Reader syntax for accessing arrays
From: |
Panicz Maciej Godek |
Subject: |
Reader syntax for accessing arrays |
Date: |
Tue, 23 Aug 2011 01:17:38 +0200 |
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
- Reader syntax for accessing arrays,
Panicz Maciej Godek <=