I have created a help function (insertinorder) inorder for the function insertionsort to go through all of the elements, but I can’t still get the functions working correct.

Can someone assist me in what I am doing wrong?

```
let rec insertinorder(array,end) =
let temp = array.(end) in
if array.(end-1) > temp
then array.(end) = array.(end-1)
array.(end-1) = temp
if end > 1
then insertinorder(array,end-1)
else ();;
let rec insertionsort (array, current) =
if current > array.length-1
then ()
else insertinorder(array, current)
insertionsort(array, current +1);;
```