juan_gandhi: (Default)
Juan-Carlos Gandhi ([personal profile] juan_gandhi) wrote2010-01-29 08:30 pm

how to say in Haskell...


pairwise :: [a] →  [(a, a)]
pairwise [] = []
pairwise (x:y:rest) = (x,y) : pairwise rest

is there something that does it already? Could not figure out.

[identity profile] ivan-gandhi.livejournal.com 2010-02-01 12:12 am (UTC)(link)
Вот! Не слыхал про unfold раньше, но это то, что должно было вертеться на языке.