>>>>> On Mon, 15 May 2000 13:47:15 -0400 (EDT), Hongwei Xi <hwxi@ECECS.UC.EDU> said:
> What I had in mind is actually something pretty simple (since it
> won't be very useful if it is not simple :-))
> Is it possible to have something like the following in the library:
I propose something more like:
Array.init_with_array: int -> (int -> (int -> 'a) -> 'a) -> 'a Array
let Array.init_with_array n f =
let a = Array.create n in
for i = 0 to n - 1 do
a.(i) <- f i (fun j -> if j<i then
a.(i)
else raise ``initialization error'')
done
The second parameter could instead be a version of the array but with
the bound limited to 0..i, but this would allow the function f to save
that version somewhere which might not be good.
This would solve an additional subset of the cases... but is NOT a
complete solution (personally, I'm fine with the initial value).
../Dave
This archive was generated by hypermail 2b29 : Tue May 16 2000 - 10:26:02 MET DST