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,22 @@
procedure main() #: demonstrate various ways to sort a list and string
demosort(stoogesort,[3, 14, 1, 5, 9, 2, 6, 3],"qwerty")
end
procedure stoogesort(X,op,i,j) #: return sorted list ascending(or descending)
local t
if /i := 0 then {
j := *X
op := sortop(op,X) # select how and what we sort
}
if op(X[j],X[i]) then
X[i] :=: X[j]
if j - i > 1 then {
t := (j - i + 1) / 3
X := stoogesort(X,op,i,j-t)
X := stoogesort(X,op,i+t,j)
X := stoogesort(X,op,i,j-t)
}
return X # X must be returned and assigned to sort a string
end