Last active
          May 7, 2016 16:17 
        
      - 
      
- 
        Save lukaskollmer/2f8149ff862d340e340740064eae6732 to your computer and use it in GitHub Desktop. 
    Swift SequenceType exclude
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | extension SequenceType where Generator.Element : Equatable { | |
| /// Returns `self`, excluding `element` | |
| @warn_unused_result | |
| public func excluding(element: Self.Generator.Element) -> [Self.Generator.Element] { | |
| return self.filter({$0 != element}) | |
| } | |
| public func excluding(element: [Self.Generator.Element]) -> [Self.Generator.Element] { | |
| return self.filter({!(element.contains($0))}) | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment