I am trying to find the index of an integer array element in ocaml. How to do this recursively.
Example code:let a = [|2; 3; 10|];;
suppose I want to return the index of 3 in the array a. Any help appreciated. I am new to OCaml programming
How to find index of an Array element in OCaml
5.7k Views Asked by sudheesh ks At
3
You check each of the elements recursively using an index
that will raise an exception (when n is bigger than the length of the array) in case the element is not part of the array.