Review my F# BubbleSort Program I have written this code for BubbleSort in F#. Can you review and let me know how I can do this in most functional way.

let rec getHighest list = 
    match list with
    | [x] -&gt; x
    | [x; y] when x &gt; y -&gt; x 
    | [x; y] -&gt; y
    | hd1 :: hd2 :: tl when hd1 &gt; hd2 -&gt; getHighest (hd1 :: tl)
    | hd1 :: tl -&gt; getHighest tl
    | _ -&gt; failwith "unknown pattern"

let bubbleSort list = 
    let rec innerBubbleSort sorted = function
    | [] -&gt; sorted
    | l -&gt; 
        let x = getHighest l
        let (a, b) = List.partition (fun i -&gt; i = x) l
        innerBubbleSort (a @ sorted) b
    innerBubbleSort [] list

[&lt;EntryPoint&gt;]
let main args = 
    let input = [10; 7; 1; 0; -1; 9; 33; 12; 6; 2; 3; 33; 34;]
    let output = bubbleSort input
    printfn "%s" (List.fold (fun acc x -&gt; acc + " " + x.ToString()) "" output)
    0
The first part could be rewritten as

match list with
| hd1 :: hd2 :: tl when hd1 &gt; hd2 -&gt; getHighest (hd1 :: tl)
| hd1 :: hd2 :: tl -&gt; getHighest (hd2::t1)
| hd1 :: [] -&gt; hd1
| _ -&gt; failwith "unknown pattern"


which is significantly simpler