Implement except on Seq, Array and List#253
Implement except on Seq, Array and List#253PatrickMcDonald wants to merge 3 commits intodotnet:fsharp4from
Conversation
src/fsharp/FSharp.Core/seq.fsi
Outdated
There was a problem hiding this comment.
It's not exactly a set difference, right?
There was a problem hiding this comment.
Maybe not, what's the 'difference' (oooh pun)
There was a problem hiding this comment.
Ok. Then we should keep it that way. It's just a bit strange to talk about sets when we're actually in Streams or lists...
There was a problem hiding this comment.
I think 'difference' does not necessarily imply that the result is unique elements, whereas 'set difference' [might|does]?
There was a problem hiding this comment.
I thinks it#s exactly the point of https://github.com/Microsoft/visualfsharp/pull/253/files#r25061210
|
I have done some performance testing (code is in this fork) Some results: Iterations = 1000, n = 1000, m = 25, upper = 50Iterations = 1000, n = 1000, m = 25, upper = 100000 |
There was a problem hiding this comment.
Can we rename the args to make it super obvious which one is which?
There was a problem hiding this comment.
I went with array1/array2 as that is what is used elsewhere in the module, I agree it could be more meaningful, am open to suggestions here.
There was a problem hiding this comment.
first/second is meaningless as well. I think that should be improved.
There was a problem hiding this comment.
ignoredItems? itemsToRemove? excludedItems?
|
Could you flip the argument order? I'd like to do |
|
yep that's basically why I asked: #253 (comment) |
5198763 to
646db39
Compare
|
Yes, I would recommend that the arguments be flipped to allow pipelining - at least, that was my intention in suggesting that we look at implementing this. It's one reason why I prefer the name "except" to the name "difference". |
There was a problem hiding this comment.
Don't forget to update SurfaceArea.portable*.fs too
Change itemsToExclude from M(T) to seq<T>
|
LGTM |
|
I guess someone can close the related uservoice issue now. 👍 |
This PR addresses Add 'except' function to core collection modules
The implementation suggested in uservoice is different from the LINQ implementation as LINQ Except removes duplicates from the results. I have gone with the LINQ version for the moment