Decorate-sort-undecorate idiom: Difference between revisions
Content added Content deleted
Line 623: | Line 623: | ||
chrestomathy programming Rosetta Code site is a</pre> |
chrestomathy programming Rosetta Code site is a</pre> |
||
{{incorrect|Lua|recalculates length on every comparison}} |
|||
However, for this same reason, there is no point doing the decorate, sort, undecorate in practice. You can simply do this: |
However, for this same reason, there is no point doing the decorate, sort, undecorate in practice. You can simply do this: |
||
<syntaxhighlight lang="lua">function lengthOrder (a, b) |
<syntaxhighlight lang="lua">function lengthOrder (a, b) |