Thu, 20 Dec 2001 15:53:31 +0000
Quoting Law <firstname.lastname@example.org>:
> 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
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.
NORTHEASTERLY BACKING WESTERLY 4, INCREASING 5 TO 7 PERHAPS GALE 8
LATER. OCCASIONAL RAIN LATER. GOOD