something like that 

diffs: aCollection
        "Answer the set theoretic differences of two collections. The first 
element of the result is the difference from the perspective of the receiver 
and the second element the difference from the perspective of the argument."

        "#(a b c d e f) diffs:  #(a b z k)  #(#a #b #c #d #e #f)
        { #(#f #d #e #c) .  #(#k #z)} 
        "
        "{ self difference: aCollection .  aCollection difference: self }"
        
        | receiver another |  
        receiver := self asSet. 
        another := aCollection asSet.  
        self do: [ :each | 
                                        (another includes: each)
                                                ifTrue: [ receiver remove: each.
                                                                 another 
remove: each ]].
        ^ { receiver asArray . another asArray}




Reply via email to