Assume this is hugely faster than the otherwise trivial implementation? `let intersect (a: 'T seq) (b: 'T seq): 'T seq = Set.intersect (Set.ofSeq a) (Set.ofSeq b) :> 'T seq`
That's a good thought. The downside is that you are allocating memory for the Set collection. In this scenario I am not wanting any extra allocations so I avoided the use of additional collections. Set is also slow compared to doing something similar with a HashSet.
Code in initial comment doesn't require your original sequences to be sorted or contain unique values. So it's more convenient. On the other hand you must rename your function to reflect that it accepts only sorted unique values.
One thing to add here as a best practice is to use the `use` keyword on your enumerators. IEnumerator implements the IDisposable interface. `for` loops do this automatically.
It seems to me that i would probably have reached for a reduction before a computation expression. However the post is enlightening for other reasons so thanks!