Save a handful of tokens and fix indentation.

This commit is contained in:
Kistaro Windrider 2022-12-17 15:49:13 -08:00
parent 11e33d0109
commit ed62ae1b77
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -22,7 +22,6 @@ function names(root)
end end
function _doall(x) function _doall(x)
for n in names(x) do for n in names(x) do
for mod in all(modules) do for mod in all(modules) do
local f=mod[n] local f=mod[n]
@ -32,13 +31,12 @@ function _doall(x)
end end
-- source: https://www.lexaloffle.com/bbs/?pid=78990 -- source: https://www.lexaloffle.com/bbs/?pid=78990
gaps={57,23,10,4,1} gaps=split"57,23,10,4,1"
--{701,301,132,57,23,10,4,1} --{701,301,132,57,23,10,4,1}
function shellsort(a) function shellsort(a)
for gap in all(gaps) do for gap in all(gaps) do
for i=gap+1,#a do for i=gap+1,#a do
local x=a[i] local x,j=a[i],i-gap
local j=i-gap
while j>=1 and a[j].key>x.key do while j>=1 and a[j].key>x.key do
a[j+gap]=a[j] a[j+gap]=a[j]
j-=gap j-=gap