What is the difference between empty list [] and list with one unit
element [()]?
Or, yet:
():[()] --is legal
10:[()] --is not
One list can contain elements of a
single type. Since the type of () is
() (element constructors and types
are allowed to have the same name),
a list of type [()]
"Daryoush Mehrtash" <[EMAIL PROTECTED]> writes:
> What is the difference between empty list [] and list with one unit
> element [()]?
Prelude> :m + Data.List
Prelude Data.List> []\\[()]
[]
or, for completeness, the difference between a list with one
unit element and the empty list:
On Fri, 10 Oct 2008 00:24:08 -0400, John Dorsey <[EMAIL PROTECTED]>
wrote:
>> dmehrtash:
>> >What is the difference between empty list [] and list with one unit
>> >element [()]?
>>
>> Prelude> length []
>> 0
>> Prelude> length [()]
>> 1
>
>Also, they differ in type.
>
>[(