loop through the list...

2003-08-14 Thread Fredrik Petersson
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

SV: loop through the list...

2003-08-11 Thread Fredrik Petersson
sprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Lennart Augustsson Skickat: den 11 augusti 2003 01:03 Till: Fredrik Petersson Kopia: [EMAIL PROTECTED] Ämne: Re: loop through the list... This really sounds a lot like home work. :) -- Lennart Fredrik Petersson wrote:

Re: loop through the list...

2003-08-11 Thread Ketil Z. Malde
"Fredrik Petersson" <[EMAIL PROTECTED]> writes: > something like [if (thenumber < index) then (index,int+1) \and break\ else > (index,int) | (index,int) <- [thelist]] I think you need to write an explicit recursion, instead of using a list comprehension. > Can i use some help-boolean to set it

Re: loop through the list...

2003-08-10 Thread Lennart Augustsson
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),(