let realise_value_list vl =
let realise_value = fun v -> match v with
| Vec (size, vec) ->
let memory_hashtbl = Hashtbl.create size in
let new_vec = fun i ->
if i >= 0 && i < size then
(
if Hashtbl.mem memory_hashtbl i then
Hashtbl.find memory_hashtbl i
else
let result = vec i in
let () = Hashtbl.add memory_hashtbl i result in
result
)
else raise (Invalid_argument "vector overflow.")
in
return_Vec (size, new_vec)
| _ -> v
in
List.map realise_value vl