[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Printing Arrays

I like your proposal a lot.  You seem to have cleaned up a lot of the
confusion that we left in the air after the meeting.  :ELEMENT-TYPE is
definitely the right thing, too.

My original reason for wanting printable arrays (I was only calling
them multi-D vectors to be humorous, of course) was to address
the general complaints I have often heard that arrays are second-class
citizens in Lisp because you can't play with them as easily as
you can play with lists, since they don't print.  The idea was to
allow APL-like interaction with Lisp, in accordance with GLS's
general principle that Lisp try to adopt the good ideas and
the functionality of APL.  This is a pretty vague goal, and as
such does not really help to resolve the issue.

However, we should keep in mind that the general principle that
any Lisp object should be printable in a readable way is violated
in many cases throughout the language; we don't really hold this
to be a general principle.  It is important that objects used
to represent PROGRAMS read in correctly, but anything else is
just icing on the cake.  So I don't think the the readability
of printed arrays is really a big semantic issue.

In fact, since the main thing you're worried about is whether
the printed representation has to reflect the element-type,
I should point out that the element-type is only an efficiency
issue (except for strings etc, but they already print differently)
and so it is not semantically necessary (mostly) to worry about
their preservation; it's mainly an efficiency issue.  And if
you are worried about efficiency, maybe then it is reasonable
to say that you should use some better representation for
your arrays than text that needs parsing.  (This is a somewhat
bogus argument since efficiency in saving and loading is not
the same as efficiency in computation, but I think the spirit
is right.)