[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: #\a octothorpe syntax vs SRFI 10
On Fri, 31 Dec 2004 campbell@xxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
>On Fri, 31 Dec 2004, bear wrote:
>> Lispy lists are brilliant: open-paren, elements,
>> close paren. I would love to be able to have
>> something that simple and elegant for arrays.
>> openbracket, elements, closebracket.
>> The need to specify types for uniform arrays and
>> ranks for arrays with multiple dimensions one of
>> which is possibly zero complicates it, but the
>> simplest case, IMO, should be as simple to express
>> and as fundamental in syntax as a list.
>What makes arrays so fundamental in syntax as to require a notation as
>succinct as lists? Lisp syntax is not defined in terms of arrays: the
>literal array syntax is only a minor convenience. There are many more
>lists than arrays in a portion of code, typically.
And that, I believe, is a problem. Lispers often use lists where
arrays would be more appropriate in terms of efficient access to
data. They do this, in part, because lisp handles lists so gracefully
in its syntax and language primitives that it's easy to overlook
arrays. This comes about, I think, because in most lisps, list
syntax is natural and array syntax is comparatively cumbersome.
I would even support arrays-as-syntax replacing lists-as-syntax
in several cases. A 'switch' statement using an array to hold the
cond clauses rather than a list would actually be easier to compile
into an efficient binary-search or index-jump table, in addition
to clarifying the surface syntax.