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 XAA12056 for caml-redistribution; Wed, 12 Jan 2000 23:07:05 +0100 (MET) 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 QAA17487 for ; Wed, 12 Jan 2000 16:47:22 +0100 (MET) Received: from heplix4.ikp.physik.tu-darmstadt.de (heplix4.ikp.physik.tu-darmstadt.de [130.83.24.139]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id QAA05710 for ; Wed, 12 Jan 2000 16:47:20 +0100 (MET) Received: (from ohl@localhost) by heplix4.ikp.physik.tu-darmstadt.de (8.9.3/8.9.3) id QAA25233; Wed, 12 Jan 2000 16:45:42 +0100 Date: Wed, 12 Jan 2000 16:45:42 +0100 Message-Id: <200001121545.QAA25233@heplix4.ikp.physik.tu-darmstadt.de> X-Authentication-Warning: heplix4.ikp.physik.tu-darmstadt.de: ohl set sender to ohl@heplix4.ikp.physik.tu-darmstadt.de using -f From: Thorsten Ohl To: caml-list@inria.fr Subject: Immutable arrays (modest Feature request) Reply-to: ohl@hep.tu-darmstadt.de Sender: weis I've always wondered why O'Caml has no notion of immutable arrays or vectors. (Mutable) Arrays are often inconvenient because callers and callees must negotiate who is doing the copying. A conservative approach will do too many copies. Semantically, a vector of size n would be a record with labels 0,...,n-1 and with O(1) access. One would initialize them from a constant (e.g. let v = [{ 42; 137; 1789 }]), a list, an array, or a function. Updates would be requested by [{ v with 2 = 2000 }] and most of the Array and List library is useful for vectors. I admit that this is theoretically not very exciting (except for the question when the `with' must copy and when not), but rather useful. Cheers, -Thorsten -- Thorsten Ohl, Physics Department, TU Darmstadt -- ohl@hep.tu-darmstadt.de http://heplix.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]