From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id C8D6DD179 for ; Wed, 27 Jul 2005 17:06:15 +0200 (CEST) Received: from ash25e.internode.on.net (ash25e.internode.on.net [203.16.214.182]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j6RF6DON023776 for ; Wed, 27 Jul 2005 17:06:15 +0200 Received: from rosella (ppp6-113.lns1.syd3.internode.on.net [59.167.6.113]) by ash25e.internode.on.net (8.12.9/8.12.6) with ESMTP id j6RF5xXf017259; Thu, 28 Jul 2005 00:36:03 +0930 (CST) (envelope-from skaller@users.sourceforge.net) Subject: Re: [Caml-list] How to do this properly with OCaml? From: skaller To: Brian Hurt Cc: Stephane Glondu , caml-list@yquem.inria.fr In-Reply-To: References: <200507241623.13705.Stephane.Glondu@crans.org> <1122251570.9027.362.camel@localhost.localdomain> <200507242345.13152.Stephane.Glondu@crans.org> <1122291335.6766.33.camel@localhost.localdomain> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-859OblfZ+2LB0IBJOhGV" Date: Thu, 28 Jul 2005 01:05:59 +1000 Message-Id: <1122476759.6768.10.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 X-Miltered: at nez-perce with ID 42E7A2E5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 arrays:01 ocaml:01 indirection:01 stl:01 2005,:98 wrote:01 wrote:01 sourceforge:01 sourceforge:01 supported:01 data:02 tricky:02 tricky:02 X-Attachments: type="application/pgp-signature" name="signature.asc" X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 --=-859OblfZ+2LB0IBJOhGV Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2005-07-25 at 19:47 -0500, Brian Hurt wrote: >=20 > On Mon, 25 Jul 2005, skaller wrote: > > On Sun, 2005-07-24 at 23:45 -0700, Stephane Glondu wrote: > > > > Well, basically the real topic is how to implement variable > > length arrays. This is easy enough in C and C++: why should > > it be very hard or even impossible in Ocaml? >=20 > It is, in fact, neither- *IF* you don't mind a little bit of inefficiency= . But I do. There is already an indirection due to boxing, however that cost isn't always paid (for example reversing the elements of an array doesn't require examining them) and it is a fundamental property of Ocaml:=20 nevertheless even this inefficiency cannot be tolerated in numerical programs, and there are officially supported special optimisations and array types to solve that problem. > It's insisting that it be done without options that's tricky. It isn't tricky, it just requires use of Obj.magic. Given that there is a simple requirement for a simple efficient data structure (analogous to C++ STL Vector) but it needs magic to do properly, the varray is best supplied by INRIA magicians. --=20 John Skaller --=-859OblfZ+2LB0IBJOhGV Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQBC56LVsRp8/9aGVGsRAoHnAJ46pckBj/BrQZzFrfbZhSncaMdXgACfduLH mule8+Q9bwrh7P32zPj2ydA= =/M3M -----END PGP SIGNATURE----- --=-859OblfZ+2LB0IBJOhGV--