initialization of arrays

From: David Monniaux (David.Monniaux@ens-lyon.fr)
Date: Tue Apr 29 1997 - 22:08:15 MET DST


Date: Tue, 29 Apr 1997 22:08:15 +0200 (MET DST)
From: David Monniaux <David.Monniaux@ens-lyon.fr>
To: Caml-list <caml-list@inria.fr>
Subject: initialization of arrays

[en français: l'initialisation de tableaux n'est pas pratique pour les
types mutables...]

Hi,

creating an array initializes all the cells to the same physical content.
That is not very handy when the content is a mutable record. Of course,
one can initialize the cells with copies of a given record. There we run
into another problem: the only way I know of, given a record, produce
another record of the same content, is to write the following kind of
code:
{ field1=a.field1; field2=a.field2 ...}
This is quite cumbersome.

Wouldn't it be handy to have a function of type 'a->'a that duplicates
physically a piece of data, and functions that create vectors or
matrices with copy?

I feel it's now doable somehow with the Obj module (I'm testing it), but
using undocumented features is cumbersome and unsafe...

Thanks.



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:10 MET