(* Baseline: quicksort over a list, returns sum of sorted result *) let rec quicksort lst = match lst with | [] -> [] | pivot :: rest -> let smaller = List.filter (fun x -> x < pivot) rest in let larger = List.filter (fun x -> x >= pivot) rest in List.append (quicksort smaller) (pivot :: quicksort larger) ;; let sorted = quicksort [3; 1; 4; 1; 5; 9; 2; 6; 5; 3; 5] ;; List.fold_left (fun a b -> a + b) 0 sorted