[Haskell-cafe] working with lists of couples

Valentin Gjorgjioski valentin.gjorgjioski at ijs.si
Fri Nov 17 13:54:02 EST 2006


On 17.11.2006 19:51 Valentin Gjorgjioski wrote:
> So, this algorithm should work fine for you
>
> buildCouples :: [Int]->Int->[(Int,Int)]
> buildCouples (x:[]) s = [(x,s)]
> buildCouples (x:xs) s = [(x,s)] ++ (buildCouples xs (x+s)).
Please ignore the . at the end, it is a typo :( Sorry again...



More information about the Haskell-Cafe mailing list