Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,25 @@
|
|||
{def sort
|
||||
|
||||
{def sort.i
|
||||
{lambda {:x :a}
|
||||
{if {A.empty? :a}
|
||||
then {A.new :x}
|
||||
else {if {<= :x {A.first :a}}
|
||||
then {A.addfirst! :x :a}
|
||||
else {A.addfirst! {A.first :a} {sort.i :x {A.rest :a}}} }}}}
|
||||
|
||||
{def sort.r
|
||||
{lambda {:a1 :a2}
|
||||
{if {A.empty? :a1}
|
||||
then :a2
|
||||
else {sort.r {A.rest :a1} {sort.i {A.first :a1} :a2}} }}}
|
||||
|
||||
{lambda {:a}
|
||||
{sort.r :a {A.new}} }}
|
||||
-> sort
|
||||
|
||||
{def A {A.new 4 65 2 -31 0 99 83 782 1}}
|
||||
-> A
|
||||
|
||||
{sort {A}}
|
||||
-> [-31,0,1,2,4,65,83,99,782]
|
||||
Loading…
Add table
Add a link
Reference in a new issue