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 @@
{def stoogesort
{def stoogesort.r
{lambda {:a :i :j}
{let { {:a {if {< {A.get :j :a} {A.get :i :a}}
then {A.swap! :i :j :a}
else :a}}
{:i :i} {:j :j}
{:t {floor {/ {+ :j {- :i} 1} 3}}}
} {if {> {- :j :i} 1}
then {stoogesort.r :a :i {- :j :t}}
{stoogesort.r :a {+ :i :t} :j}
{stoogesort.r :a :i {- :j :t}}
else }} }}
{lambda {:a}
{stoogesort.r :a 0 {- {A.length :a} 1}} :a}}
-> stoogesort
{def A {A.new 9 1 3 10 13 4 2}}
-> A
{stoogesort {A}}
-> [1,2,3,4,9,10,13]