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 QAA20485; Fri, 9 Apr 2004 16:57:01 +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 QAA20578 for ; Fri, 9 Apr 2004 16:56:59 +0200 (MET DST) Received: from sark.cc.gatech.edu (sark.cc.gatech.edu [130.207.7.23]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i39EuwYM020857 for ; Fri, 9 Apr 2004 16:56:58 +0200 Received: from gaia.cc.gatech.edu (gaia.cc.gatech.edu [130.207.3.8]) by sark.cc.gatech.edu (8.12.10/8.12.8) with ESMTP id i39Eus8E015002; Fri, 9 Apr 2004 10:56:54 -0400 (EDT) Received: (from fernando@localhost) by gaia.cc.gatech.edu (8.12.10/8.12.8) id i39EuqXX028238; Fri, 9 Apr 2004 10:56:52 -0400 (EDT) Date: Fri, 9 Apr 2004 10:56:52 -0400 From: Fernando Alegre To: Jean-Christophe Filliatre Cc: fis@wiwi.hu-berlin.de, Oliver Bandel , caml-list@inria.fr Subject: Re: [Caml-list] String.map => Question to the OCaml-team Message-ID: <20040409145652.GB27343@gaia.cc.gatech.edu> References: <20040409110138.GA1333@first.in-berlin.de> <16502.38522.179048.194250@gargle.gargle.HOWL> <16502.42309.605598.795600@gargle.gargle.HOWL> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16502.42309.605598.795600@gargle.gargle.HOWL> User-Agent: Mutt/1.4.2.1i X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; alegre:01 gatech:01 caml-list:01 ocaml-team:01 2004:99 filliatre:01 for':99 char:01 char:01 blit:01 ocaml:01 0200,:01 string:03 string:03 wrote:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 218 On Fri, Apr 09, 2004 at 03:29:41PM +0200, Jean-Christophe Filliatre wrote: > Note there is a `for' construct in ocaml: > > ====================================================================== > let string_map (f: char -> char) (s: string) : string = > let t = String.copy s in > for i = 0 to String.length s - 1 do t.[i] <- f s.[i] done; > t > ====================================================================== > > and this is slightly faster than your implementation (by 10%). Why not just use String.blit, as provided by the standard library? Fernando ------------------- 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