Re: [m-users.] lists and sets, unordered or ordered.
Volker Wysk <[email protected]>
| Newsgroups | gmane.comp.lang.mercury.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, Sean Your message suddenly stops in the middle of a sentence. Volker Am Dienstag, dem 03.10.2023 um 21:39 +0100 schrieb Sean Charles (emacstheviking): > I've just completed a generic typeclass based collision detection system and learned quite a bit doing it! > > 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. > > 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. > > 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. > > There seems to be no way to get an unordered, deduplicated list from a set, I can use set_unordlist but that leaves duplicates. > > > 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! > > I just wondered what the reasons were for not having the ability to get an unsorted > _______________________________________________ > users mailing list > [email protected] > https://lists.mercurylang.org/listinfo/users _______________________________________________ users mailing list [email protected] https://lists.mercurylang.org/listinfo/users
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmUcf2cACgkQ+K4ydFOs HoU1qA//dTKuWOklmSwfC0HIrQbX6l6XWFbmiBuwvkHFGI1x2qziV+0c3rApRzng o2aZIGSKnimiuYmJFucdS+Vhp8h0vRWEATuJr3sQi+5o3AFWBmGRqH7LMnQDt/T+ EsKEXY/lRGhLAo9PuFFxNas8rTUVim62jaXcBTbIIpWOXFHaiIIU6LX5hSvD2lJ7 DkMnIWGlqVy1oKrsj/AvEFcfTtTumoKwlXwYfZz5a1sVr3R0ije8+FoCkkYjdnE/ xAmJ8EXjfykJxbdpudLiXPZlQw0MeiLCBbTfxJKaYSmhYjCbILHLIdf93xBhK539 d/Xi4Gv0DDJ6bO1P5Guyi+OZMrjgBf7F9HHm/IlpEaqaDWJBN8F3Ak0Ud5R7xYVK jMMZeN1MGn8kvTg9l3ygXZOutWpdtkE1P2l1OhXypzUE0k5j+0kABt/j5mXQyQHP 5bNGhaZLNvl4SkAT/kh8ASidQflpP1/T6svhibdJl03VpaVekx750qrYRWfJfvXg 3MlGDEXoU0sx21WnmkUjZygpixcNBNsU2fjVHggrCqmFs2rIYHC/tJtefg1q0Y8M mwyeRC74hj2yiSaRTPcJWv2LT75raagjvNmtpl4MUfv1WPhr3IcQVRR+Y234hLiF lmmJT2iq4Vrvg/74Lje/6M8kBwQW5B8kyiB0KG3RXUtrKZS4iVI= =+WVK -----END PGP SIGNATURE-----