forked from pyrex/chameleonic
Save a handful of tokens and fix indentation.
This commit is contained in:
parent
11e33d0109
commit
ed62ae1b77
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user