Python from Wise Guy's Viewpoint
Dirk Thierbach
dthierbach at gmx.de
Mon Nov 3 06:00:14 EST 2003
prunesquallor at comcast.net wrote:
> Joachim Durchholz <joachim.durchholz at web.de> writes:
>> I'm still hoping for an explanation on the practical relevance of that
>> black hole device.
> Neel Krishnaswami had a wonderful explanation in article
> <slrnbplpv6.ikr.neelk at gs3106.sp.cs.cmu.edu>
And note that his example for practical relevance includes a datatype.
Haskell doesn't support recursive types directly, but a recursive
datatype for lists is easy:
data List a = Nil | Cons a (List a)
Since Haskell is lazy, that's already a lazy list, but even if Haskell
was eager, you could write a similar datatype for lazy lists.
(And of course Haskell lists are essentially just given by the above
datatype, together with some syntactic sugar).
It's very natural for a relevant application of recursive types to
be coupled with data.
- Dirk
More information about the Python-list
mailing list