[Haskell-beginners] Empty list

Joel Williamson joel.s.williamson at gmail.com
Wed Mar 25 14:10:05 UTC 2015


Shishir, you need to distinguish between membership (1 is an element of
[1,2,3], [] is not) and subsets (both [1] and [] are subsets of [1,2,3]).
elem checks the first property, intersection checks the second.

On Wed, 25 Mar 2015 10:03 Brandon Allbery <allbery.b at gmail.com> wrote:

> On Wed, Mar 25, 2015 at 10:00 AM, Norbert Melzer <timmelzer at gmail.com>
> wrote:
>
>> You are correct, a list is not a set. A list is a list of things, that
>> can be there multiple times. A set is a set of things, where nothing can be
>> twice. So take a look at Data.Set
>>
>
> Note that this won't actually solve the original problem; Haskell is an
> implementation of a strongly typed lambda calculus, not of number theory,
> and Haskell collections cannot (easily) contain elements of different types
> --- so the empty set is not an element of a set, and the empty list is not
> an element of a list.
>
> --
> brandon s allbery kf8nh                               sine nomine
> associates
> allbery.b at gmail.com
> ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>  _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150325/a5187d43/attachment-0001.html>


More information about the Beginners mailing list