Archiving a bunch of old stuff
This commit is contained in:
3
oldstuff/scala/official-by-example/byx/build.sbt
Normal file
3
oldstuff/scala/official-by-example/byx/build.sbt
Normal file
@@ -0,0 +1,3 @@
|
||||
name := "byx"
|
||||
|
||||
version := "0.1.0"
|
@@ -0,0 +1,12 @@
|
||||
object sort {
|
||||
def sort(xs: Array[Int]): Array[Int] = {
|
||||
if (xs.length <= 1) xs
|
||||
else {
|
||||
val pivot = xs(xs.length / 2)
|
||||
Array.concat(
|
||||
sort(xs filter (pivot >)),
|
||||
xs filter (pivot ==),
|
||||
sort(xs filter (pivot <)))
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user