Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/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. Re:  Why does this list comprehension return an empty list?
      (Kim-Ee Yeoh)
   2. Re:  Why does this list comprehension return an empty list?
      (Kim-Ee Yeoh)
   3. Re:  Shorten this code (Nadav Chernin)


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

Message: 1
Date: Wed, 24 Jul 2013 07:52:14 +0700
From: Kim-Ee Yeoh <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Why does this list comprehension
        return an empty list?
Message-ID:
        <CAPY+ZdTUQzyLuLxxGE7JKEvP3w7FWxnkLm=8fmsodpg66_o...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Wed, Jul 24, 2013 at 7:47 AM, Kim-Ee Yeoh <[email protected]> wrote:

> Try:  [(a,b) | a <- f xs | b <- g xs]
>

Oops, that'll only work if you define g xs = [[]], not []. So yes, you've
basically got a zip.

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130724/f417f670/attachment-0001.html>

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

Message: 2
Date: Wed, 24 Jul 2013 08:07:00 +0700
From: Kim-Ee Yeoh <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Why does this list comprehension
        return an empty list?
Message-ID:
        <capy+zdqag-uc_75sagplpptwaomjzcya54xkzfmg-7ytxqb...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Tue, Jul 23, 2013 at 3:53 PM, Costello, Roger L. <[email protected]>wrote:

> I have a list comprehension that extracts the singletons from xs using f
> and g, and creates a pair from their output:
>
>         [(a,b) | a <- f xs, b <- g xs]
>
> I executed this and the result is the empty list:
>
>         []
>
> That is odd. Why is the empty list the result?
>

For the same reason that the cartesian product of any set with the empty
set is the empty set.

Also,

> I have a list of singletons:
>        xs = [("a")]

is immediately suspect, since you have xs:: [String], whereas "a list of
singletons" appears to lean quite a lot more toward [Char], which is just
String.

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130724/3cd35bb2/attachment-0001.html>

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

Message: 3
Date: Wed, 24 Jul 2013 09:58:52 +0300
From: Nadav Chernin <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Shorten this code
Message-ID:
        <CAE80G0L-N6sDcsoTsGq=4m95ron8rylfo_rc4iclnlvdtqs...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi, the target of this program is to encode string of [A..Z] characters by
method of Polybius http://en.wikipedia.org/wiki/Polybius_square.
Additionally, most short code will receive more points.

Nadav


On Wed, Jul 24, 2013 at 3:36 AM, Kim-Ee Yeoh <[email protected]> wrote:

>
> On Tue, Jul 23, 2013 at 5:41 PM, Nadav Chernin <[email protected]>wrote:
>
>> Please try to shorten it:
>>
>
> What would you achieve by doing so?
>
> -- Kim-Ee
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20130724/6852c7f6/attachment-0001.html>

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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 61, Issue 28
*****************************************

Reply via email to