<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-06-16 14:16 GMT+02:00 Levente Uzonyi <span dir="ltr"><<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, 16 Jun 2017, Nicolai Hess wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Does this even work ?<br>
Set does not preserve ordering.<br>
</blockquote>
<br></span>
The receiver is not a Set but a SequenceableCollection, so yes, it does work:<br>
<br>
        | set |<br>
        set := Set new.<br>
        #(1 1 2 1 2 3 1 2 3 4) select: [ :each | set addNewElement: each ]<br>
<br>
        "==> #(1 2 3 4)"<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Ah, of course :)<br></div><div>Set is only used for the select.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
<br>
Levente</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Item was added:<br>
+ ----- Method: SequenceableCollection>>withou<wbr>tDuplicates (in category 'copying') -----<br>
+ withoutDuplicates<br>
+       "Answer a copy of the receiver that preserves order but eliminates any duplicates."<br>
+       | seen |<br>
+       seen := Set new: self size.<br>
+       ^self select: [:each|<br>
+                                 (seen includes: each)<br>
+                                       ifTrue: [false]<br>
+                                       ifFalse: [seen add: each. true]]!<br>
<br>
<br>
</blockquote>
</div></div><br><br>
<br></blockquote></div><br></div></div>