Save a handful of tokens and fix indentation. #2
@ -22,7 +22,6 @@ function names(root)
|
||||
end
|
||||
|
||||
function _doall(x)
|
||||
|
||||
for n in names(x) do
|
||||
for mod in all(modules) do
|
||||
local f=mod[n]
|
||||
@ -32,13 +31,12 @@ function _doall(x)
|
||||
end
|
||||
|
||||
-- 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}
|
||||
function shellsort(a)
|
||||
for gap in all(gaps) do
|
||||
for i=gap+1,#a do
|
||||
local x=a[i]
|
||||
local j=i-gap
|
||||
local x,j=a[i],i-gap
|
||||
while j>=1 and a[j].key>x.key do
|
||||
a[j+gap]=a[j]
|
||||
j-=gap
|
||||
|
Loading…
Reference in New Issue
Block a user