[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gcl-devel] Dotted lists
[Gcl-devel] Dotted lists
23 Aug 2002 00:15:37 -0400
Gcl has apparently been designed to only handle proper lists. I have a
working tree which can compile itself and maxima, and which extends
functionality to dotted lists in general, but may yet have a few loose
ends. Before I commit, I'd like to consult with the list.
1) One solution of course is to modify the reader to store dotted
lists in proper form. This of course would eliminate the
distinction between the two forms of list. I take it one wants the
ability to distinguish between the two, but I can't see why. Is
the standard just written to included dotted lists because some
original implementations tried to save the space of the final cons?
Or are they useful as distinct from proper lists?
2) The solution I have preserves the distinction, but alters the endp
macro to redirect the list to a special cons pointing to the final
cdr atom when passed an argument of this atom. In this way, all
bodies of loops over lists will handle all elements properly
including the last. At loop end, the list variable holds Cnil for
a proper list, or a special symbol indicating the end of a dotted
list. This allows certain functions which return their answers as
lists to either dot the last element or cons it as usual. Such end
loop processing has to be done function by function, but I made the
determination that such functions which care about the form of the
end of a list, apart from the fact that the list is at end, are
few, and preserving uniform treatment of loop body code is more
important. The compiler actually wrote calls to endp with
arguments which could not be redirected in certain places, so these
have been adjusted as well. There are only two places in the
compiler where it still seems necessary to use the old endp
behavior (i.e. for proper lists only), but this may actually be
used only for compiler internals, and in any case might be worked
around n the future. On the other hand, if there are certain
definable areas where dotted lists should not be allowed, it would
be better to preserve the old endp in such places. In any case,
the behavior for proper lists should be completely unchanged. All
of Paul's related bug reports are fixed in this tree, to my
Is this the right strategy here?
a) Do we need to support dotted lists as separate objects from proper lists?
b) Is the idea that all elements of both should be
handled the same in most places, with exceptions treated by hand,
c) Does anyone know if inferences can be made regarding the type lists the
compiler uses at various points? I can give specifics on request.
Camm Maguire address@hidden
"The earth is but one country, and mankind its citizens." -- Baha'u'llah
- [Gcl-devel] Dotted lists,
Camm Maguire <=