Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Empty list (Shishir Srivastava)
   2. Re:  Empty list (Norbert Melzer)
   3.  Monoids and Groups (Shishir Srivastava)
   4. Re:  Empty list (Brandon Allbery)
   5. Re:  Monoids and Groups (Brandon Allbery)
   6. Re:  Empty list (Mike Meyer)
   7. Re:  Empty list (Joel Williamson)


----------------------------------------------------------------------

Message: 1
Date: Wed, 25 Mar 2015 13:55:11 +0000
From: Shishir Srivastava <[email protected]>
To: beginners <[email protected]>
Subject: [Haskell-beginners] Empty list
Message-ID:
        <cale5rtvbkq3rypxl2awabxroxy_ofssahq899buu1kzsd1s...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi,

Can someone please explain why this results in error -

[] `elem` [1,2,3]

Shouldn't the empty set by definition be the element of all sets including
a non-empty set ?

I am assuming 'Lists' are different from 'Sets' in Haskell, if yes, is
there a separate module for dealing/working with sets ?

Thanks,
Shishir Srivastava
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150325/dbaed094/attachment-0001.html>

------------------------------

Message: 2
Date: Wed, 25 Mar 2015 15:00:02 +0100
From: Norbert Melzer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Empty list
Message-ID:
        <ca+bcvsu9do3_z6kzw6d4vbjynqz1og7nhfw8j_nf9rj9ion...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

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
Am 25.03.2015 14:55 schrieb "Shishir Srivastava" <
[email protected]>:

> Hi,
>
> Can someone please explain why this results in error -
>
> [] `elem` [1,2,3]
>
> Shouldn't the empty set by definition be the element of all sets including
> a non-empty set ?
>
> I am assuming 'Lists' are different from 'Sets' in Haskell, if yes, is
> there a separate module for dealing/working with sets ?
>
> Thanks,
> Shishir Srivastava
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> 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/6de1bf19/attachment-0001.html>

------------------------------

Message: 3
Date: Wed, 25 Mar 2015 14:02:34 +0000
From: Shishir Srivastava <[email protected]>
To: beginners <[email protected]>
Subject: [Haskell-beginners] Monoids and Groups
Message-ID:
        <CALe5RTu8pd8y1F=pukuec-r2uefkczzrhkcqgocpvfb9ugg...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi,

Reading about Monoids it seems they derive a lot on the algebraic
structures of 'Groups' ?

Is it then correct to assume that Monoids can be used to represent 'Groups'
?

If not are there any standard haskell libraries which represent algebraic
structures such as 'Groups' , 'Fields' etc.

Thanks,
Shishir Srivastava
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150325/e0f7efdd/attachment-0001.html>

------------------------------

Message: 4
Date: Wed, 25 Mar 2015 10:03:29 -0400
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Empty list
Message-ID:
        <CAKFCL4V4HeUSnEJhoeWo8BcqenFgcmr=pQifjkimzMa7=cc...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Wed, Mar 25, 2015 at 10:00 AM, Norbert Melzer <[email protected]>
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
[email protected]                                  [email protected]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150325/df63ef58/attachment-0001.html>

------------------------------

Message: 5
Date: Wed, 25 Mar 2015 10:07:17 -0400
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Monoids and Groups
Message-ID:
        <CAKFCL4WjR0hkd5VCvc57dYgOPfisbYGwgfwNpMdPep2mjXZE=a...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Wed, Mar 25, 2015 at 10:02 AM, Shishir Srivastava <
[email protected]> wrote:

> Reading about Monoids it seems they derive a lot on the algebraic
> structures of 'Groups' ?
>

A monoid is a semigroup with an identity element, and as such inherits much
of its behavior from semigroups.

For historical reasons, a Haskell Monoid is not based on a notional Haskell
Semigroup. There are packages that add semigroups and other algebraic
structures, and even alternative Preludes that provide a reasonably
complete set of algebraic structures. Every so often you'll see
bikeshedding in the Haskell community over whether the default Prelude
should provide some or all of these. :)

-- 
brandon s allbery kf8nh                               sine nomine associates
[email protected]                                  [email protected]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150325/acebffe1/attachment-0001.html>

------------------------------

Message: 6
Date: Wed, 25 Mar 2015 09:07:16 -0500
From: Mike Meyer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Empty list
Message-ID:
        <CAD=7u2a2zx1vbdikahanz7857h5fpyzjusk0drgopl-ltza...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Wed, Mar 25, 2015 at 8:55 AM, Shishir Srivastava <
[email protected]> wrote:

> Hi,
>
> Can someone please explain why this results in error -
>
> [] `elem` [1,2,3]
>
> Shouldn't the empty set by definition be the element of all sets including
> a non-empty set ?
>

Norbert gave you the information about Lists and Data.Set, but you're wrong
about the properties of the empty set. The empty set is a SUBSET of all
sets. But it's only a MEMBER of supersets of {{}}.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150325/18b6c450/attachment-0001.html>

------------------------------

Message: 7
Date: Wed, 25 Mar 2015 14:10:05 +0000
From: Joel Williamson <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Empty list
Message-ID:
        <CAJGxSeqLbLHY7nVb3++YWWrGVpP+HaA6zDRq=bCJKGguuty=7...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

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 <[email protected]> wrote:

> On Wed, Mar 25, 2015 at 10:00 AM, Norbert Melzer <[email protected]>
> 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
> [email protected]
> [email protected]
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>  _______________________________________________
> Beginners mailing list
> [email protected]
> 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.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 81, Issue 59
*****************************************

Reply via email to