Hi Maciej,
I've been thinking among the same lines. At the same time this syntax could
be used to access members of a 'struct' or 'class' object. It should be
relatively simple to write a small interpreter (or maybe a pre-compiler).
Otherwise you could make a wrapper around the array in the form of a
closure. In that case, your example could be written
(*=! (a i j) 2)
Cheers, Johan

2011/8/23 Panicz Maciej Godek <[email protected]>

> 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 via email to