[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-beginners
Subject: Re: [Haskell-beginners] doing state right
From: Floptical Logic <flopticalogic () gmail ! com>
Date: 2009-04-24 19:07:28
Message-ID: dc457d550904241207ld8f9d70x5f5c86878fcfee88 () mail ! gmail ! com
[Download RAW message or body]
Bah! I completely forgot arrays were constant in lookup.
Thanks
On Thu, Apr 23, 2009 at 3:05 AM, Chaddaï Fouché
<chaddai.fouche@gmail.com> wrote:
> On Thu, Apr 23, 2009 at 10:03 AM, Chaddaï Fouché
> <chaddai.fouche@gmail.com> wrote:
>>
>> main = quick_ppm "foo.ppm" (\i j -> isPrime ((i-1)*limit+j)) limit limit
>> where
>> isPrime n = primeSieve ! n
>> primeSieve :: UArray Int Bool
>> primeSieve = accumArray (\_ _ -> True) False (0,limit*limit) $ zip
>> primes (repeat ())
>>
>
> That should read as "zip (takeWhile (<= limit*limit) primes) (repeat
> ())" of course.
>
> --
> Jedaï
>
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic