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.  Build HTTP package error (Alexander _)
   2.  reverse [1..] (Emanuel Koczwara)
   3. Re:  reverse [1..] (Emmanuel Touzery)
   4. Re:  reverse [1..] (Alexander _)
   5. Re:  reverse [1..] (Jonathan Rioux)
   6. Re:  reverse [1..] (Emanuel Koczwara)
   7. Re:  Parsec,      comma sperated list with special last element
      (Christian Maeder)
   8. Re:  reverse [1..] (Felipe Almeida Lessa)
   9. Re:  reverse [1..] (Tom Davie)


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

Message: 1
Date: Tue, 18 Dec 2012 19:58:39 +0600
From: Alexander _ <[email protected]>
Subject: [Haskell-beginners] Build HTTP package error
To: [email protected]
Message-ID:
        <cafpzw89cmkqlmwohkmcokr-extdxxchgooz0dg2fbqtosqc...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello,

I try to install HTTP package. I make:

cabal install HTTP and got error:

[ 1 of 18] Compiling Network.HTTP.Base64 ( Network/HTTP/Base64.hs,
dist/build/Network/HTTP/Base64.o )
[ 2 of 18] Compiling Network.HTTP.MD5Aux ( Network/HTTP/MD5Aux.hs,
dist/build/Network/HTTP/MD5Aux.o )
[ 3 of 18] Compiling Paths_HTTP ( dist/build/autogen/Paths_HTTP.hs,
dist/build/Paths_HTTP.o )

dist/build/autogen/Paths_HTTP.hs:21:13: Not in scope: `catch'

dist/build/autogen/Paths_HTTP.hs:22:13: Not in scope: `catch'

dist/build/autogen/Paths_HTTP.hs:23:14: Not in scope: `catch'

dist/build/autogen/Paths_HTTP.hs:24:17: Not in scope: `catch'
cabal: Error: some packages failed to install:
HTTP-4000.2.6 failed during the building phase. The exception was:
ExitFailure 1

How can i install it correctly?

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20121218/3fecd793/attachment-0001.htm>

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

Message: 2
Date: Tue, 18 Dec 2012 15:24:56 +0100
From: Emanuel Koczwara <[email protected]>
Subject: [Haskell-beginners] reverse [1..]
To: "[email protected]" <[email protected]>
Message-ID: <1355840696.18660.2.camel@emanuel-Dell-System-Vostro-3750>
Content-Type: text/plain; charset="UTF-8"

Hi,

  When I run this code in ghci:

    reverse [1..]

  I get:

    <interactive>: out of memory (requested 2097152 bytes)

  Can anyone explain this behaviour?

Emanuel





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

Message: 3
Date: Tue, 18 Dec 2012 15:28:07 +0100
From: Emmanuel Touzery <[email protected]>
Subject: Re: [Haskell-beginners] reverse [1..]
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed


> Hi,
>
>    When I run this code in ghci:
>
>      reverse [1..]
>
>    I get:
>
>      <interactive>: out of memory (requested 2097152 bytes)
>
>    Can anyone explain this behaviour?
>

It is an infinite list you are trying to reverse. This cannot terminate. 
Which is the first element you would expect to see in the result?

Those two will finish:

reverse $ take 100 [1..]
reverse [1..100]

Emmanuel



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

Message: 4
Date: Tue, 18 Dec 2012 20:30:00 +0600
From: Alexander _ <[email protected]>
Subject: Re: [Haskell-beginners] reverse [1..]
To: [email protected]
Message-ID:
        <CAFPzW88TNut=ahyz0ertphf2hfdyp3rcevc+fctc+kh-4cl...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello,

Here you try to reverse infinite list. What do you expect to get?


2012/12/18 Emanuel Koczwara <[email protected]>

> Hi,
>
>   When I run this code in ghci:
>
>     reverse [1..]
>
>   I get:
>
>     <interactive>: out of memory (requested 2097152 bytes)
>
>   Can anyone explain this behaviour?
>
> Emanuel
>
>
>
> _______________________________________________
> 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/20121218/4c005bee/attachment-0001.htm>

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

Message: 5
Date: Tue, 18 Dec 2012 09:33:49 -0500
From: Jonathan Rioux <[email protected]>
Subject: Re: [Haskell-beginners] reverse [1..]
To: Emanuel Koczwara <[email protected]>
Cc: "[email protected]" <[email protected]>
Message-ID:
        <CAH3N84VdoXxB61TJ0127vjp=tmwqarma5oytxp7xluznmjr...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello Emanuel,

Here's the excerpt of the "reverse" function in GHC-List   (

-- | 'reverse' @xs@ returns the elements of @xs@ in reverse order.--
@xs@ must be finite.reverse                 :: [a] -> [a]#ifdef
USE_REPORT_PRELUDEreverse                 =  foldl (flip (:))
[]#elsereverse l =  rev l []  where    rev []     a = a    rev (x:xs)
a = rev xs (x:a)#endif

Reversing an infinite list, Haskell will try to reach the end of the
list until it runs out of memory.
I don't thing it's doable lazily.




On Tue, Dec 18, 2012 at 9:24 AM, Emanuel Koczwara <[email protected]
> wrote:

> Hi,
>
>   When I run this code in ghci:
>
>     reverse [1..]
>
>   I get:
>
>     <interactive>: out of memory (requested 2097152 bytes)
>
>   Can anyone explain this behaviour?
>
> Emanuel
>
>
>
> _______________________________________________
> 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/20121218/bc4664f7/attachment-0001.htm>

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

Message: 6
Date: Tue, 18 Dec 2012 15:35:06 +0100
From: Emanuel Koczwara <[email protected]>
Subject: Re: [Haskell-beginners] reverse [1..]
To: Alexander _ <[email protected]>
Cc: [email protected]
Message-ID: <1355841306.18660.4.camel@emanuel-Dell-System-Vostro-3750>
Content-Type: text/plain; charset="UTF-8"

Hi,

Dnia 2012-12-18, wto o godzinie 20:30 +0600, Alexander _ pisze:
> Hello,
> 
> 
> 
> Here you try to reverse infinite list. What do you expect to get?
> 

  I was trying to build infinite list from -inf to +inf.

Emanuel






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

Message: 7
Date: Tue, 18 Dec 2012 15:42:23 +0100
From: Christian Maeder <[email protected]>
Subject: Re: [Haskell-beginners] Parsec,        comma sperated list with
        special last element
To: [email protected]
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed

Hi,

you should not distinguish last or other cells.
Do you really want to discard the last cell in your result?

You could use:

   cell = many1 $ noneOf "\n,"

   endBy cell (oneOf "\n,")

This would give you all cells of a file.

To get all cells of a single line use:

   line = sepBy cell (char ',')

and skip the final newline. To get all lines of a file
use:

   endBy line (char `\n')

HTH Christian


you wrote: 2012-12-18 08:58:45 GMT

I tried

file = do
   res <- endBy (try cell) (char ',')
   l   <- lastCell
   eof
   return res

cell = many1 (noneOf ",")
lastCell = many1 (noneOf "\n")

But that does not work because cell succeeds on the last cell.
I can replace the endBy by

many (try $ do {a <- cell; string ","; return a})

Nathan



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

Message: 8
Date: Tue, 18 Dec 2012 13:13:13 -0200
From: Felipe Almeida Lessa <[email protected]>
Subject: Re: [Haskell-beginners] reverse [1..]
To: Emanuel Koczwara <[email protected]>
Cc: beginners <[email protected]>
Message-ID:
        <CANd=oggg_jznz6uwk9gpp9x3kjn0w6m_djyawe1viwfz3da...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

If you don't care about the order, you may use:

allNumbers = 0 : merge [1,2..] [-1,-2..]
  where merge (x:xs) ys = x : merge ys xs

Cheers,

On Tue, Dec 18, 2012 at 12:35 PM, Emanuel Koczwara
<[email protected]> wrote:
> Hi,
>
> Dnia 2012-12-18, wto o godzinie 20:30 +0600, Alexander _ pisze:
>> Hello,
>>
>>
>>
>> Here you try to reverse infinite list. What do you expect to get?
>>
>
>   I was trying to build infinite list from -inf to +inf.
>
> Emanuel
>
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners



-- 
Felipe.



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

Message: 9
Date: Tue, 18 Dec 2012 15:16:08 +0000
From: Tom Davie <[email protected]>
Subject: Re: [Haskell-beginners] reverse [1..]
To: Emanuel Koczwara <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii


On 18 Dec 2012, at 14:35, Emanuel Koczwara <[email protected]> wrote:

> Hi,
> 
> Dnia 2012-12-18, wto o godzinie 20:30 +0600, Alexander _ pisze:
>> Hello,
>> 
>> 
>> 
>> Here you try to reverse infinite list. What do you expect to get?
>> 
> 
>  I was trying to build infinite list from -inf to +inf.

What would you expect the number after -inf to be?

Bob



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

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


End of Beginners Digest, Vol 54, Issue 26
*****************************************

Reply via email to