[plt-scheme] The role of proper and improper lists?

From: Bill Wood (william.wood3 at comcast.net)
Date: Fri Jan 25 14:18:26 EST 2008

On Fri, 2008-01-25 at 13:40 -0500, Matthias Felleisen wrote:
> On Jan 25, 2008, at 1:34 PM, Bill Wood wrote:
> > I rather like having a tuple type (fixed-length heterogeneous sequence
> > ala SML or Python) distinct from proper lists.  When programming in  
> > lisp
> > or Scheme I sometimes use improper lists for tuples -- the  
> > difference in
> > structure acts as a reminder that the type is conceptually different.
> >
> >  -- Bill Wood
> And if you use structures in PLT Scheme (and soon in R6 Schemes near  
> you), you get the same benefits as in SML or Python. -- Matthias

Yeah, I know that I can always use structures for tuples, but sometimes
it seems to be too much machinery.  After all, an element of a Cartesian
product differs from (and is simpler than?) a function mapping symbols
into a union.  I prefer to use different mechanisms for different data
structures -- I want to stay as far as I can from the APL
everything-is-an-array mind-set.

I also consider a difference of seriousness:  If the information
structure is an integral part of my map from problem to representation
then I use a structure (if not an object); it's good for documentation
if nothing else.  But if I need a throw-away data structure for
impedance-matching between components then the tuple seems right.

 -- Bill Wood

Posted on the users mailing list.