Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,50 @@
/* NetRexx */
options replace format comments java crossref savelog symbols binary
import java.util.List
i1 = ArrayList(Arrays.asList([Integer(3), Integer(3), Integer(1), Integer(2), Integer(4), Integer(3), Integer(5), Integer(6)]))
say i1.toString
say gnomeSort(i1).toString
return
method isTrue public constant binary returns boolean
return 1 == 1
method isFalse public constant binary returns boolean
return \isTrue
method gnomeSort(a = String[], sAsc = isTrue) public constant binary returns String[]
rl = String[a.length]
al = List gnomeSort(Arrays.asList(a), sAsc)
al.toArray(rl)
return rl
method gnomeSort(a = List, sAsc = isTrue) public constant binary returns ArrayList
sDsc = \sAsc -- Ascending/descending switches
ra = ArrayList(a)
i_ = 1
j_ = 2
loop label i_ while i_ < ra.size
ctx = (Comparable ra.get(i_ - 1)).compareTo(Comparable ra.get(i_))
if (sAsc & ctx <= 0) | (sDsc & ctx >= 0) then do
i_ = j_
j_ = j_ + 1
end
else do
swap = ra.get(i_)
ra.set(i_, ra.get(i_ - 1))
ra.set(i_ - 1, swap)
i_ = i_ - 1
if i_ = 0 then do
i_ = j_
j_ = j_ + 1
end
end
end i_
return ra