Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
{def bubblesort
|
||||
{def bubblesort.swap!
|
||||
{lambda {:a :n :i}
|
||||
{if {> :i :n}
|
||||
then :a
|
||||
else {bubblesort.swap! {if {> {A.get :i :a} {A.get {+ :i 1} :a}}
|
||||
then {A.set! :i {A.get {+ :i 1} :a}
|
||||
{A.set! {+ :i 1} {A.get :i :a} :a}}
|
||||
else :a}
|
||||
:n
|
||||
{+ :i 1}} }}}
|
||||
{def bubblesort.r
|
||||
{lambda {:a :n}
|
||||
{if {<= :n 1}
|
||||
then :a
|
||||
else {bubblesort.r {bubblesort.swap! :a :n 0}
|
||||
{- :n 1}} }}}
|
||||
|
||||
{lambda {:a}
|
||||
{bubblesort.r :a {- {A.length :a} 1}}}}
|
||||
-> bubblesort
|
||||
|
||||
{bubblesort {A.new 0 3 86 20 27 67 31 16 37 42 8 47 7 84 5 29}}
|
||||
-> [0,3,5,7,8,16,20,27,29,31,37,42,47,67,84,86]
|
||||
Loading…
Add table
Add a link
Reference in a new issue