From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 99A24BC88 for ; Thu, 10 Feb 2005 03:27:42 +0100 (CET) Received: from mail.cs.unm.edu (mail.cs.unm.edu [64.106.20.33]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j1A2Rf1U001068 for ; Thu, 10 Feb 2005 03:27:42 +0100 Received: from localhost (localhost [127.0.0.1]) by mail.cs.unm.edu (Postfix) with ESMTP id 9D841E40F8; Wed, 9 Feb 2005 19:20:35 -0700 (MST) Received: from mail.cs.unm.edu ([127.0.0.1]) by localhost (mail [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 32264-02; Wed, 9 Feb 2005 19:20:35 -0700 (MST) Received: from [192.168.0.2] (pcp09983606pcs.svaley01.nm.comcast.net [68.35.58.177]) by mail.cs.unm.edu (Postfix) with ESMTP id 1BD87E40F5; Wed, 9 Feb 2005 19:20:35 -0700 (MST) In-Reply-To: <420ac293.30127b31.1fa8.0b02@smtp.gmail.com> References: <420ac293.30127b31.1fa8.0b02@smtp.gmail.com> Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Message-Id: Content-Transfer-Encoding: quoted-printable Cc: From: "William D.Neumann" Subject: Re: [Caml-list] String to list to string Date: Wed, 9 Feb 2005 19:27:37 -0700 To: =?ISO-8859-1?Q?Juancarlo_A=F1ez?= X-Mailer: Apple Mail (2.619.2) X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at cs.unm.edu X-Miltered: at concorde with ID 420AC69D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 wrote:01 trivial:01 rec:01 pred:01 pred:01 rec:01 ...:98 strings:01 functions:01 neumann:02 neumann:02 string:03 string:03 let:03 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: On Feb 9, 2005, at 7:10 PM, Juancarlo A=F1ez wrote: > Why aren't there functions in the standard library to convert strings=20= > to > lists of characters and back? Because a) they're not all that useful and b) they're trivial to write=20= for yourself: let explode s =3D let rec exh acc =3D function | -1 -> acc | i -> exh (s.[i]::acc) (pred i) in exh [] (pred (String.length s)) let implode l =3D let s =3D String.create (List.length l) in let rec imh i =3D function | h::t -> s.[i] <- h; imh (succ i) t | [] -> s in imh 0 l William D. Neumann "You've got Rita Marlowe in the palm of your hand." "Palm of my hand? You haven't seen Rita Marlowe..." -- Will Success Spoil Rock Hunter?