<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">I did some benchmarks years ago to figure out when it was worth sorting</div><div class="gmail_default" style="font-family:monospace,monospace">lists in order to do set operations on them  , and when it was OK to keep</div><div class="gmail_default" style="font-family:monospace,monospace">them unordered.  It has been a long time, but I was shocked at how tiny</div><div class="gmail_default" style="font-family:monospace,monospace">the crossover point was.  The takeaway lesson was that there was just</div><div class="gmail_default" style="font-family:monospace,monospace">no point in using unordered lists for sets.  If your data were so small</div><div class="gmail_default" style="font-family:monospace,monospace">that unordered lists were good enough, they were too small for the cost</div><div class="gmail_default" style="font-family:monospace,monospace">of sorting to be worth bothering about.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 4 Oct 2023 at 10:16, Sean Charles (emacstheviking) <<a href="mailto:objitsu@gmail.com">objitsu@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">It doesn't need to be unsorted, I just didn't want to waste time sorting something that can function unsorted that's all.<br>
<br>
> With the the set_c234.to_sorted_list/1<br>
<br>
<br>
^^^^^^ That's sorted though, by it's very name and the power of Greyskull etc?<br>
<br>
<br>
<br>
> On 3 Oct 2023, at 22:13, Volker Wysk <<a href="mailto:post@volker-wysk.de" target="_blank">post@volker-wysk.de</a>> wrote:<br>
> <br>
> Am Dienstag, dem 03.10.2023 um 22:07 +0100 schrieb Sean Charles<br>
> (emacstheviking):<br>
>> In my detection, the same missile might hit more than one object if they<br>
>> are close: thus I only wanted to process it once even of it hits five<br>
>> things, so I wanted deduped list just to save setting the hit flag five<br>
>> times if that makes sense.<br>
>> <br>
>> I checked out all the others sets, the only one I saw that looked good was<br>
>> set_unordlist but is says 'may contain duplicates'.<br>
>> <br>
>> How do I get an unsorted deduped list from a set then, educate me, i sure<br>
>> as hell need it!<br>
> <br>
> With the the set_c234.to_sorted_list/1 function, for instance. I still don't<br>
> know why your set needs to be unsorted.<br>
> <br>
> V.<br>
> <br>
>> <br>
>> HAHA It's possible I have missed it in the melee, like 'cirle' not 'circle' las week, it's late, I'm tired<br>
>> :D<br>
>> <br>
>>> On 3 Oct 2023, at 22:04, Volker Wysk <<a href="mailto:post@volker-wysk.de" target="_blank">post@volker-wysk.de</a>> wrote:<br>
>>> <br>
>>> Hi<br>
>>> <br>
>>> You can get a sorted de-duped list from a set. Why do you need an unsorted<br>
>>> one? If it's efficiency, you need to have it sorted, unless you have only a<br>
>>> few elements.<br>
>>> <br>
>>> But be aware that there is the "set" module and five "set_*" modules. The<br>
>>> "set" is using ordered lists. That's inefficient for large sets. Use the<br>
>>> other modules when you have a big set.<br>
>>> <br>
>>> Cheers,<br>
>>> Volker<br>
>>> <br>
>>> Am Dienstag, dem 03.10.2023 um 21:55 +0100 schrieb Sean Charles<br>
>>> (emacstheviking):<br>
>>>> Indeed. nothing in my drafts folder and I swear it was complete before I hit send... well,<br>
>>>> basically,<br>
>>>> is there a reason you can't get an unsorted de-duped list from a set?<br>
>>>> <br>
>>>> That's all...   :D<br>
>>>> <br>
>>>>> On 3 Oct 2023, at 21:53, Volker Wysk <<a href="mailto:post@volker-wysk.de" target="_blank">post@volker-wysk.de</a>> wrote:<br>
>>>>> <br>
>>>>> Hi, Sean<br>
>>>>> <br>
>>>>> Your message suddenly stops in the middle of a sentence.<br>
>>>>> <br>
>>>>> Volker<br>
>>>>> <br>
>>>>> Am Dienstag, dem 03.10.2023 um 21:39 +0100 schrieb Sean Charles<br>
>>>>> (emacstheviking):<br>
>>>>>> I've just completed a generic typeclass based collision detection system and learned quite a bit doing it!<br>
>>>>>> <br>
>>>>>> As I was reading the module docs, it seems that there is no 'unordered set without duplicates' unless I missed it, which is entirely reasonable.<br>
>>>>>> <br>
>>>>>> The output from the collision detection  is two sets of integers, these are the identifiers of the missiles and the things that were hit at the moment. I now want to take this list and then set the '^hit' flag for every missile in that list, for example, the existing code will then no longer render it and remove it on the next iteration.<br>
>>>>>> <br>
>>>>>> I used sets because they de-dupe as you go, meaning that my checking process is simply iterating two loops, m x n, m missiles and n moving targets, for now it is naive and will probably always be fine given the limited numbers of things on screen at any one time.<br>
>>>>>> <br>
>>>>>> There seems to be no way to get an unordered, deduplicated list from a set, I can use set_unordlist but that leaves duplicates.<br>
>>>>>> <br>
>>>>>> <br>
>>>>>> For now I've decided to use set_unordlist, at the cost of maybe updating the same missile record more than once poost-collision detection, it's not going to kill anything really but mentally, and from a purity point of view it feels 'less optimal' than I wanted. Failing that I might just usr  list.member and use lists for everything like I did!<br>
>>>>>> <br>
>>>>>> I just wondered what the reasons were for not having the ability to get an unsorted <br>
>>>>>> _______________________________________________<br>
>>>>>> users mailing list<br>
>>>>>> <a href="mailto:users@lists.mercurylang.org" target="_blank">users@lists.mercurylang.org</a><br>
>>>>>> <a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer" target="_blank">https://lists.mercurylang.org/listinfo/users</a><br>
>>>>> <br>
>>>>> _______________________________________________<br>
>>>>> users mailing list<br>
>>>>> <a href="mailto:users@lists.mercurylang.org" target="_blank">users@lists.mercurylang.org</a><br>
>>>>> <a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer" target="_blank">https://lists.mercurylang.org/listinfo/users</a><br>
>>>> <br>
>>> <br>
>>> _______________________________________________<br>
>>> users mailing list<br>
>>> <a href="mailto:users@lists.mercurylang.org" target="_blank">users@lists.mercurylang.org</a><br>
>>> <a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer" target="_blank">https://lists.mercurylang.org/listinfo/users</a><br>
>> <br>
> <br>
<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.mercurylang.org" target="_blank">users@lists.mercurylang.org</a><br>
<a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer" target="_blank">https://lists.mercurylang.org/listinfo/users</a><br>
</blockquote></div>