Re: Reader syntax for accessing arrays

2012-01-09 Thread Andy Wingo
On Tue 23 Aug 2011 01:17, Panicz Maciej Godek writes: > (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; With the appropriate macrology, it could l

Re: Reader syntax for accessing arrays

2011-08-26 Thread Panicz Maciej Godek
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 h

Re: Reader syntax for accessing arrays

2011-08-24 Thread Johan Hidding
Hi, I think it is a question of philosophy. The suggested [] syntax contains the scent of both infix notation (would [7 '* 6] work?) and work on arrays in stead of lists (also in the case of object member reference; the most straight forward implementation would be having a memory offset assigned t

Re: Reader syntax for accessing arrays

2011-08-24 Thread Panicz Maciej Godek
Hello, >>> 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) > > You could even write macros for this.  I would actually find it more > elegant than additional syntax. The *=! operator could be easily

Re: Reader syntax for accessing arrays

2011-08-24 Thread Ludovic Courtès
Hi, Panicz Maciej Godek skribis: >> 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). > > I thought that

Re: Reader syntax for accessing arrays

2011-08-23 Thread Panicz Maciej Godek
> 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). I thought that maybe it could be achieved using the guile

Re: Reader syntax for accessing arrays

2011-08-23 Thread Johan Hidding
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

Reader syntax for accessing arrays

2011-08-22 Thread Panicz Maciej Godek
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