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

On sequences



1.
(TAIL "")'s behavior is a bug, but making it not be an error would
violate the principle that the type-specific, open-codeable versions of
generic routines should be subsets (in the mathematical sense) of the
generic routines where the domain and range are restricted to the type in
question.  (TAIL (PROCLAIM STRING? FOO)) <=> (STRING-TAIL FOO)
should hold even if FOO is ""; (STRING-TAIL "") is erroneous; therefore
(TAIL "") must be erroneous.  But I think TAIL should go away; see below.

2.
I think that now is the wrong time to be deciding what to do about
sequences.  I doubt that at this early stage in the language's
development we can come up with a consistent and elegant specification.
The sequence chapter probably ought to be struck from the manual for the
time being.  People should feel free to develop their own packages
and experiment, and if someone comes up with something good, the
subject should be T-Discussed again.

Historical footnote: One (maybe the main) reason that sequences were put
into T was to support the implicit FORCE suggested by Sussman, Hanson,
et al.  Since in T (at least until now) forcing happens only when an
operation is invoked on a delayed object, there have to be versions of
CAR and CDR which are operations, so that forcing can happen when
traversing delayed lists.  With additional inspiration from the
sequences of NIL and Common Lisp, T's notion of sequence, with generic
HEAD, TAIL, etc., was born.  This result is a moderately ridiculous and
barely useful hack.

However, I have heard that after some experience with using and
implementing implicit FORCE, and teaching it to students (I think), that
Sussman etc. have changed their minds, and now recommend explict FORCE.
With explicit FORCE, "sequences" can go away; for the purposes of infinite
lists, HEAD can be CAR and TAIL can be (FORCE (CDR ...)).  This is what
I intend to do with T.  I haven't even heard of anyone using generic
sequence operations OR delays, so I doubt these changes will be felt.

I'm not saying generic sequence operations are a bad idea; there are
many reasons for having them.  But it's extremely difficult to get
right, as the Common Lisp design group will attest.