Press CTRL+C or CMD+C to copy the selected text and close this dialog.
Tweet
2 people like it. Like the snippet!
Triple version of Seq.pairwise.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
let triplewise (source: seq<_>) = seq { use e = source.GetEnumerator() if e.MoveNext() then let i = ref e.Current if e.MoveNext() then let j = ref e.Current while e.MoveNext() do let k = e.Current yield (!i, !j, k) i := !j j := k } // sample triplewise [1..4] // -> seq [(1, 2, 3); (2, 3, 4)]