I have tried several things. Can I simply not match with less than? The exception is redundant, to enable the matching loop. I can imagine all sorts of things are wrong and this bit of code. It would be nice if the vague less-than-you-less-than-me concept worked. I admit I am frustrated. Why do I get an error at j < k every time, no matter where I improve or edit? Is that simply against the rules? I was just looking at Array Length > Array Length as my while condition, that will have to change. Also, none of the Array Sorting methods seem to me to work in the smallest upwards routine as I understand the 0(n^2). Can this code implement Array.for_all as a sorting algorithm? UPDATE
let i = Array.length arr in
let sort (arr : array) (j : int) (k : int) =
Array.make n x = unsorted(arr : array) (n : int) (x : int)
while i > 0
match j < k with
| true -> a.(n) <- j
| false -> failwith (Printf.sprintf "Exception Found (%d)" i)
i - 1
;;
That was a lot of questions. Thank you.
UPDATE: I appreciate the help very much. I know I need two arrays, not one. The finished code should read an array, and then give an array back. So, when k points to a smallest j the purpose of the algorithm is to kick j out of the first array, from wherever it it is, put it into the second array, and append every j after that one into the second array. The job is done when the first array is empty. I see plenty of information about lists out there but not much about arrays. How can I remove the j_n-th element of an array? This is a nice looking example of recursion used to search and delete an element from a list, can that work in an array? Thank you again