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 JAA20911; Mon, 3 Mar 2003 09:50:59 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 JAA20990 for ; Mon, 3 Mar 2003 09:50:55 +0100 (MET) Received: from beaune.inria.fr (beaune.inria.fr [128.93.8.3]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h238orH27014; Mon, 3 Mar 2003 09:50:53 +0100 (MET) Received: by beaune.inria.fr (8.8.8/1.1.22.3/14Sep99-0328PM) id JAA0000025232; Mon, 3 Mar 2003 09:50:53 +0100 (MET) From: Luc Maranget Message-Id: <200303030850.JAA0000025232@beaune.inria.fr> Subject: Re: [Caml-list] Strings as arrays or lists... To: xavier.leroy@inria.fr (Xavier Leroy) Date: Mon, 3 Mar 2003 09:50:53 +0100 (MET) Cc: brogoff@speakeasy.net, oliver@first.in-berlin.de (Oliver Bandel), caml-list@inria.fr (caml-list@inria.fr) In-Reply-To: <20030302193437.A6487@pauillac.inria.fr> from "Xavier Leroy" at mar 02, 2003 07:34:37 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; caml-list:01 haskell:01 coercions:01 char:01 regexps:01 recursion:01 --luc:01 arrays:01 -bit:01 ocaml:01 caml:01 lazy:02 maranget:02 module:03 string:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > > > in Haskell, strings are lists of chars. > > > > And what a horrible design decision that is! > > Agreed. Well, it's a great way to multiply the memory requirements > for your strings by a factor of 12 (on 32-bit platforms) or 24 (on > 64-bit platforms), while at the same time losing constant-time > indexing :-) > > Actually, the list representation of strings is so repugnant that I > don't even want to include "explode" and "implode" coercions between > string and char list in the standard library. A standard library > should steer users away from algorithmically-inefficient code. By not > having implode and explode in the library, I hope OCaml programmers > will come to the realization that the proper way to operate on strings > is either via block operations (the String module, regexps, etc), or > by recursion on integer indices. > > - Xavier Leroy > Xavier is right, of course. However, in a lazy context, seeing strings as list of chars has some advantages. This is not relevant to Caml anyway. --Luc ------------------- 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