loop through the list...
Fredrik Petersson
fredde@x-web.se
Mon, 11 Aug 2003 00:55:43 +0200
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