Re: table.sort: invalid order function for sorting
'Lars Müller' via lua-l <[email protected]> Sun, 26 Apr 2026 21:32:08 +0200
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
How so? There is no meaningful difference between "a < b" and "a <= b" as convention for a comparator, because "a <= b" is equivalent to "not (b < a)". It is just a convention, and a pretty reasonable one at that. - Lars On Sun, Apr 26 2026 at 13:18:38 +02:00:00, Philippe Verdy <[email protected]> wrote: > If you want stability, suitable for mitlkey sort, or sorts in > multiple passes, and the minimum of swaps for duplicate values, or > for NaN values), using the comparator (a<b) does not work at all, but > (a<=b) does. > > Lua made the worst decision for its binary comparator used in > table.sort! > > As a conséquence you always need to rewrite it. > > Le ven. 24 avr. 2026, 21:19, 'Martin Eden' via lua-l > <[email protected] <mailto:[email protected]>> a écrit : >> On 2026-04-24 21:13, Roberto Ierusalimschy wrote: >> >> [...] Have you ever met the case when you need to code effective >> >> sorting in practice? >> > I really don't think this information is relevant to this list. >> Let us >> > avoid allowing arguments to get too personal. Thanks. >> > >> > -- Roberto >> >> I agree here. Let's consider it as rhetorical question. >> >> But I still want to discuss three-way vs two-way partitioning. >> Current Lua uses two-way as a given fact. I want to evaluate >> alternatives. >> >> -- Martin >> >> -- >> You received this message because you are subscribed to the Google >> Groups "lua-l" group. >> To unsubscribe from this group and stop receiving emails from it, >> send an email to [email protected] >> <mailto:lua-l%[email protected]>. >> To view this discussion visit >> <https://groups.google.com/d/msgid/lua-l/9f0e3d7f-574f-4825-bb0c-642823cf60d0%40disroot.org>. > -- > You received this message because you are subscribed to the Google > Groups "lua-l" group. > To unsubscribe from this group and stop receiving emails from it, > send an email to [email protected] > <mailto:[email protected]>. > To view this discussion visit > https://groups.google.com/d/msgid/lua-l/CAGa7JC0DZUOMFTr1a0WVa24itOtws9zTgtRGq-0ULe%2BqMYtRrw%40mail.gmail.com > <https://groups.google.com/d/msgid/lua-l/CAGa7JC0DZUOMFTr1a0WVa24itOtws9zTgtRGq-0ULe%2BqMYtRrw%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "lua-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/KX84ET.RFJ2CC94A1N2%40gmx.de.