Are the final #asArray conversions always needed ? If not, it would be more efficient not to do them every time, no ? On 14 Mar 2014, at 22:19, Pharo4Stef <pharo4Stef@free.fr> wrote:
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}