I am trying to make a list out of a given array and in my code it returns an empty list. I want to know why this is impossible to do with list. Is it because we are supposed to return something in the third line and the concatenation is not "saved" anywhere?
let arrayTOlist a = let l =[] in
for i=0 to (Array.length a -1) do
[a.(i)]::l (*why does this have type unit?*)
done;
l;;