I'm totally new to OCaml, but I think it's really neat that the Array module supports functional operations on arrays. One thing I sort of missed which I think can be quite useful is a functional reverse (in the style of List.rev), which I've simply defined below in terms of Array.copy and Array.rev_inplace.
let array_rev array =
let copy = Array.copy array in
Array.rev_inplace copy;
copy
Is there good reason something like this shouldn't be in the Array module?
I'm totally new to OCaml, but I think it's really neat that the
Array
module supports functional operations on arrays. One thing I sort of missed which I think can be quite useful is a functional reverse (in the style ofList.rev
), which I've simply defined below in terms ofArray.copy
andArray.rev_inplace
.Is there good reason something like this shouldn't be in the
Array
module?