2008/4/1, Bruno Carnazzi <[EMAIL PROTECTED]>:
> Because I don't know anything about arrays in Haskell. Thank you for
> pointing this, I have to read some more Haskell manuals :)
A good place to learn about Haskell's array (which come in many
flavours) is this wiki page :
http://www.haskell.org/ha
2008/4/1, Chaddaï Fouché <[EMAIL PROTECTED]>:
> 2008/3/31, Bruno Carnazzi <[EMAIL PROTECTED]>:
>
> >Dears Haskellers,
> >
> > As an Haskell newbie, I'm learning Haskell by trying to resolve Euler
> > Project problems (http://projecteuler.net/ ). I'm hanging on problem
> > 14 (Collatz pro
chaddai.fouche:
> 2008/3/31, Bruno Carnazzi <[EMAIL PROTECTED]>:
> >Dears Haskellers,
> >
> > As an Haskell newbie, I'm learning Haskell by trying to resolve Euler
> > Project problems (http://projecteuler.net/ ). I'm hanging on problem
> > 14 (Collatz problem).
> >
> > I've written the fol
2008/3/31, Bruno Carnazzi <[EMAIL PROTECTED]>:
>Dears Haskellers,
>
> As an Haskell newbie, I'm learning Haskell by trying to resolve Euler
> Project problems (http://projecteuler.net/ ). I'm hanging on problem
> 14 (Collatz problem).
>
> I've written the following program... Which does not
On Mon, Mar 31, 2008 at 6:00 PM, Bruno Carnazzi <[EMAIL PROTECTED]> wrote:
> I've done this modification with no more success :
>
> import qualified Data.List as List
> import qualified Data.Map as Map
>
> f :: Integer -> Integer
>
> f n | even n = n `div` 2
> | otherwise = 3 * n + 1
>
> ch
I've done this modification with no more success :
import qualified Data.List as List
import qualified Data.Map as Map
f :: Integer -> Integer
f n | even n = n `div` 2
| otherwise = 3 * n + 1
chain m n =
let chain' cn cm | Map.member cn m = Map.map (+ (m Map.! cn)) cm
"Bruno Carnazzi" <[EMAIL PROTECTED]> writes:
> The program ends for values up to 40 :
Wild guess here - I know nothing about the problem, and haven't
examined your program in detail - but could it be that you default to
Int, and that it wraps silently at some power of two, thereby making
your
The program ends for values up to 40 :
*Main> :set +s
*Main> maxChain 1000
(871,179)
(0.09 secs, 3697648 bytes)
*Main> maxChain 1
(6171,262)
(0.73 secs, 31560008 bytes)
*Main> maxChain 10
(77031,351)
(9.31 secs, 347122064 bytes)
*Main> maxChain 20
(156159,383)
(19.32 secs, 70930370
Hello Bruno,
Monday, March 31, 2008, 7:51:43 PM, you wrote:
> I've written the following program... Which does not end in a reasonable time
> :(
> My algorithm seems ok to me but I see that memory consumption is gigantic...
> Is this a memory problem with Data.Map ? Or an infinite loop ? (Where
Dears Haskellers,
As an Haskell newbie, I'm learning Haskell by trying to resolve Euler
Project problems (http://projecteuler.net/ ). I'm hanging on problem
14 (Collatz problem).
I've written the following program... Which does not end in a reasonable time :(
My algorithm seems ok to me but I
10 matches
Mail list logo