fork download
  1. import Control.Arrow
  2. triangulate (x:a:b:xs) = scanl (curry (snd *** id)) (a, b) xs
  3. main = print $ triangulate $ [1, 2, 3, 4, 5]
Success #stdin #stdout 0.02s 3592KB
stdin
Standard input is empty
stdout
[(2,3),(3,4),(4,5)]