[kepler-dev] Re: zero-length arrays

Tobin Fricke tobin at splorg.org
Thu Aug 12 11:44:00 PDT 2004


On Thu, 12 Aug 2004, Edward A Lee wrote:

> The immutability of tokens

Ah, I forgot about the immutability of tokens.  Of course that's something
that should be preserved.  So you can ignore my speculations about
ListTokens -- mainly I was curious about empty arrays, because they would
be useful to have.

Having empty arrays would allow a lot of lisp idioms to be implemented
without the list-versus-array problem taking too big a toll, by using the
trick with concatenate.  Another way would involve using matlab-esque
array dereferencing:

{1, 2, 3, 4, 5}.extract({true, false, false, true, true}) --> {1, 4, 5}
{1, 2, 3, 4, 5}.extract({2, 3, 4, 1}) --> {2, 3, 4, 1}
{1, 2, 3, 4, 5}.extract(0,2) --> {1, 2}
find({true, false, false, true, true}) --> {0, 3, 4}

What do you think of overloading the 'get' method with these (int,int)
[subarray], ({int}) [list item dereferencing], and ({boolean})
[inclusion/exclusion] forms?

Tobin



More information about the Kepler-dev mailing list