Jim Pryor scripsit:

> Lists are *a* basic functional programming structure.

Yes, of course.  What I meant was, "As between lists and pairs, it is
lists that are the fundamental data structure."  As you say, pairs are
just a special case of tuples which happen to be used to implement lists
in Lisp/Scheme.

> Conceptually, a list is type-homogeneous,

I don't agree here: see below.

> If you map some function that accepts either ints or bools as arguments
> over your list, then the list can be regarded as homogeneously having
> a union type, int-or-bool.  In statically-typed functional languages,
> you'd have to express that explicitly, by boxing the elements inside
> an Either-type.

That's the fundamental difference between mainstream FPLs and something
like Typed Racket: an "Either string integer" type is not a supertype of
"string" or "integer", whereas the Typed Racket equivalent "(U string
integer)" is.  So there is no need to unbox in Typed Racket: once you know
what type you have using the STRING? or INTEGER? predicates, you can just
use the ordinary operations on strings or integers as the case may be.

Lisp/Scheme can, however, handle more complicated things that even
Typed Racket can't (AFAIK) express, such as "an alternating list of
symbols and arbitrary objects", also known as a property list.  This is
a special case of the truism that statically typed systems can and do
reject programs (or make them impossible to express) that are entirely
type-safe, because of the complexity of the types they use.

First known example of political correctness:   John Cowan
After Nurhachi had united all the other         http://www.ccil.org/~cowan
Jurchen tribes under the leadership of the      co...@ccil.org
Manchus, his successor Abahai (1592-1643)
issued an order that the name Jurchen should       --S. Robert Ramsey,
be banned, and from then on, they were all           The Languages of China
to be called Manchus.

Chicken-users mailing list

Reply via email to