ocamlだとこんな感じかな?
let rec qsort = function
| [] -> []
| pivot :: tail ->
let smaller, rest = List.partition ((>) pivot) tail in
qsort smaller @ pivot :: qsort rest

>>424 scala比較のためそのままコピペ
def qsort(list: List[Int]): List[Int] = list match
case Nil => Nil
case pivot :: tail =>
val (smaller, rest) = tail.partition(_ < pivot)
qsort(smaller) ::: pivot :: qsort(rest)

scalaすごい頑張ってると思うわ