SV: loop through the list...
Fredrik Petersson
fredde@x-web.se
Mon, 11 Aug 2003 09:58:49 +0200
Sure it is!
Our book sux, and a hate sitting for hour after hour with the same sucking
problem.
Sometimes you need a hint to get on...
Like "I think you need to write an explicit recursion" are a nice hits which
i guess would lead me to the right path again.
//FRedde
-----Ursprungligt meddelande-----
Från: haskell-admin@haskell.org [mailto:haskell-admin@haskell.org]För
Lennart Augustsson
Skickat: den 11 augusti 2003 01:03
Till: Fredrik Petersson
Kopia: haskell@haskell.org
Ämne: Re: loop through the list...
This really sounds a lot like home work. :)
-- Lennart
Fredrik Petersson wrote:
>hi again... :)
>
>Ok assume i got this list of tuples [(10,1),(20,2),(30,3)]
>where i in (i,j) is a index,
>i want to go through the list and add a number witch matches the best
index.
>Like 18 should give me [(10,1),(20,3),(30,3)] since 18 are over 10 and
under
>20... aky?
>
>something like [if (thenumber < index) then (index,int+1) \and break\ else
>(index,int) | (index,int) <- [thelist]]
>My problem is that i dont know how to do the break thing! next time the
>value gonna be smaller than the 30 and ++ the int.
>Can i use some help-boolean to set it false when we have counted up once?
>and include that one in the if-stmt?? How do i do that?
>
>I guess your laughing your pants wet right now coz there are of-corz some
>smart built-in functions in haskell to do this kind of silly ting, so
please
>tell me! :)
>
>Respect the rock!
>//Fredde
>
>_______________________________________________
>Haskell mailing list
>Haskell@haskell.org
>http://www.haskell.org/mailman/listinfo/haskell
>
>
>
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell