Don't think this `-` is a good candidate for std.

  1. It silently draws sets in deps.
  2. For "algorithms which work a lot with differences" it's probably better to 
keep the sets around, not recreate them on each operation.
  3. The `-` name is ambiguous, it's ok for sets, but for arrays explicit 
`difference` is better.
  4. We arleady have `filter` for openArrays
  5. Setting length beforehand may be preferable in many cases, but for general 
usage more conservative approach (growing as we go) is probably better.



For `var seq` there's 
[keepIf](https://nim-lang.org/docs/sequtils.html#keepIf%2Cseq%5BT%5D%2Cproc%28T%29)
 already (which should have been named `retain`)
    
    
    import sequtils, sets, sugar
    
    let a = [1, 2, 5, 2, 9, 7, 0]
    let b = [7, 4, 1, 10, 7]
    
    let bSet = b.toHashSet()
    echo a.filter((x) => x notin bSet)
    
    
    Run

Reply via email to