Quoting Law <[EMAIL PROTECTED]>:
> hi, how do I define this function:
> 
> tupleWithf :: [Int] -> [(Int, Int)]
> 
> such that 
> 
> tupleWithf [x1,x2,.....,xn]
> = [ (f x1, x1), (f x2 x2),...., (f xn, xn) ]
                       ^ you wanted a comma there, I guess.

I don't see where you're getting `f' from. I think you want the type
to be:

tupleWithf :: (Int -> Int) -> [Int] -> [(Int, Int)]

Still, you can do this with a trivial list comprehension or map. I
leave the implementation as an exercise for the reader.

-- 
IRISH SEA
NORTHEASTERLY BACKING WESTERLY 4, INCREASING 5 TO 7 PERHAPS GALE 8
LATER. OCCASIONAL RAIN LATER. GOOD

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to