[Haskell-beginners] Confused by GLFW and more
Britt Anderson
britt.uwaterloo at gmail.com
Thu Mar 3 17:40:52 CET 2011
This does fix the problem. Thank you. But raises a new question. Since
that list was being constructed like this
where trialList oldps =
[[(h' i) , (p' i)] | i <- [1 ..], i < tn]
it should have only had two elements when tn = 3. So, I assume that I
am getting hit by a laziness issue, but how is it that I should have
known that using mapM_ wouldn't have force thelist to exist in a
finite form?
By the way, I just now use "take (tn -1)" and all is good, but I would
like to understand this issue better so I can avoid similar pitfalls
in the future.
Thx, Britt
On Thu, Mar 3, 2011 at 10:59 AM, Felipe Almeida Lessa
<felipe.lessa at gmail.com> wrote:
> On Thu, Mar 3, 2011 at 3:34 PM, Britt Anderson
> <britt.uwaterloo at gmail.com> wrote:
>> --sequence_ $ map (trialLoop gain tolerance joy) (trialList ps)
>> trialLoop gain tolerance joy ((trialList ps)!!0)
>> trialLoop gain tolerance joy ((trialList ps)!!1)
>
> First of all, instead of "sequence_ $ map ..." use "mapM_ ...", which
> is the same thing but nicer.
>
> Now, have you tried "mapM_ (trialLoop gain tolerance joy) (take 2 $
> trialList ps)"? That should be the same as those two lines you wrote.
> I am suspecting here that your program is hanging only with mapM_
> because of some of the trials that are not the first two.
>
> HTH,
>
> --
> Felipe.
>
More information about the Beginners
mailing list