From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA25892; Sun, 27 Apr 2003 23:35:31 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA25920 for ; Sun, 27 Apr 2003 23:35:29 +0200 (MET DST) Received: from eposta.kablonet.com.tr ([62.248.102.66]) by concorde.inria.fr (8.11.1/8.11.1) with SMTP id h3RLZRH08364 for ; Sun, 27 Apr 2003 23:35:28 +0200 (MET DST) Received: (qmail 24012 invoked by uid 0); 27 Apr 2003 21:42:49 -0000 Received: from unknown (HELO 195.174.169.185) (exa@195.174.169.185) by 0 with SMTP; 27 Apr 2003 21:42:49 -0000 From: Eray Ozkural Reply-To: erayo@cs.bilkent.edu.tr Organization: Bilkent University CS Dept. To: OCaml List Subject: [Caml-list] Looking for a real array Date: Mon, 28 Apr 2003 00:34:25 +0300 User-Agent: KMail/1.5.9 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200304280034.25569.exa@kablonet.com.tr> X-Spam: no; 0.00; eray:01 ozkural:01 neglected:01 pointers:01 indirection:01 val:01 initialized:01 predicate:01 erayo:01 bilkent:01 ankara:01 kde:01 malfunction:01 ariza:01 arrays:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I knew this all along but looks like I neglected that an array is in fact an array of pointers rather than an array of contiguous storage blocks in memory. Is there a way to get real FORTRAN/C arrays for people who might not want this extra level of indirection? val make : int -> 'a -> 'a array Array.make n x returns a fresh array of length n, initialized with x. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time. Regards, -- Eray Ozkural (exa) Comp. Sci. Dept., Bilkent University, Ankara KDE Project: http://www.kde.org www: http://www.cs.bilkent.edu.tr/~erayo Malfunction: http://mp3.com/ariza GPG public key fingerprint: 360C 852F 88B0 A745 F31B EA0F 7C07 AE16 874D 539C ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners