triangulate (x:a:b:xs) = scanl (\(x, a, b) n -> (x, b, n)) xs (x, a, b)
main = print $ triangulate $ [1, 2, 3, 4, 5, 6, 7]