[Haskell-beginners] foldr for Nats

Stephen Tetley stephen.tetley at gmail.com
Tue Jan 26 06:05:20 EST 2010


Hi

One hint is that your data type for natural numbers is remarkably like
the data type for lists...

data List a = [] | a : List a

The difference is that List has an element of type 'a' at the non-zero cases.

Best wishes

Stephen


More information about the Beginners mailing list