From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA02331 for caml-redistribution; Tue, 6 May 1997 09:33:51 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA08556 for ; Tue, 29 Apr 1997 22:08:22 +0200 (MET DST) Received: from cri.ens-lyon.fr (cri.ens-lyon.fr [140.77.1.32]) by nez-perce.inria.fr (8.8.5/8.7.3) with ESMTP id WAA04767 for ; Tue, 29 Apr 1997 22:08:19 +0200 (MET DST) Received: from terreaux (terreaux [140.77.191.109]) by cri.ens-lyon.fr (8.8.5/8.8.1) with ESMTP id WAA21057 for ; Tue, 29 Apr 1997 22:08:19 +0200 (MET DST) Date: Tue, 29 Apr 1997 22:08:15 +0200 (MET DST) From: David Monniaux X-Sender: dmonniau@terreaux To: Caml-list Subject: initialization of arrays Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: weis [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.