[Haskell-beginners] doing state right
Floptical Logic
flopticalogic at gmail.com
Fri Apr 24 15:07:28 EDT 2009
Bah! I completely forgot arrays were constant in lookup.
Thanks
On Thu, Apr 23, 2009 at 3:05 AM, Chaddaï Fouché
<chaddai.fouche at gmail.com> wrote:
> On Thu, Apr 23, 2009 at 10:03 AM, Chaddaï Fouché
> <chaddai.fouche at 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ï
>
More information about the Beginners
mailing list