Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
# (sort xs) is the ordered list of all elements in list xs.
|
||||
# This version preserves duplicates.
|
||||
\sort==
|
||||
(\xs
|
||||
xs [] \x\xs
|
||||
append (sort; filter (gt x) xs); # all the items less than x
|
||||
cons x; append (filter (eq x) xs); # all the items equal to x
|
||||
sort; filter (lt x) xs # all the items greater than x
|
||||
)
|
||||
|
||||
# (unique xs) is the ordered list of unique elements in list xs.
|
||||
\unique==
|
||||
(\xs
|
||||
xs [] \x\xs
|
||||
append (unique; filter (gt x) xs); # all the items less than x
|
||||
cons x; # x itself
|
||||
unique; filter (lt x) xs # all the items greater than x
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue