<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-06-16 12:38 GMT+02:00 Stéphane Rollandin <span dir="ltr"><<a target="_blank" href="mailto:lecteur@zogotounga.net">lecteur@zogotounga.net</a>></span>:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span class="gmail-"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
<br>
Stéphane, can you live with ifMissingAdd: ?  Chris?<br>
<br>
</blockquote>
<br></span>
Sure. Now "missing" seems to imply that something went wrong and an element is not there while it should (which is why I would prefer #ifAbsentAdd:).<br>
<br>
Plus, the name does not tell that a Boolean is returned (this apply to #ifAbsentAdd: too).<br>
<br>
So what about #ensurePresenceOf: ?<br>
<br>
I would expect this to return true if the element was *not* added, false otherwise, though.<br>
<br>
<br>
Stef<br>
<br></blockquote><div><br>Does this even work ?<br></div><div>Set does not preserve ordering.<br></div><div><br>Item was added:<br>
+ ----- Method: SequenceableCollection>><wbr>withoutDuplicates (in category 'copying') -----<br>
+ withoutDuplicates<br>
+       "Answer a copy of the receiver that <span class="gmail-il">preserves</span> <span class="gmail-il">order</span> but eliminates any duplicates."<br>
+       | seen |<br>
+       seen := <span class="gmail-il">Set</span> new: self size.<br>
+       ^self select: [:each|<br>
+                                 (seen includes: each)<br>
+                                       ifTrue: [false]<br>
+                                       ifFalse: [seen add: each. true]]!</div></div><br></div></div>