From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 8E4B5BC75 for ; Tue, 15 Feb 2005 02:17:50 +0100 (CET) Received: from stag.seas.upenn.edu (stag.seas.upenn.edu [158.130.70.79]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j1F1HnmM006776 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Tue, 15 Feb 2005 02:17:50 +0100 Received: from [192.168.2.100] (dhcp0642.grt.resnet.group.upenn.edu [165.123.143.14]) (authenticated bits=0) by stag.seas.upenn.edu (8.12.10/8.12.10) with ESMTP id j1F1GpWw002465 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT); Mon, 14 Feb 2005 20:16:51 -0500 Message-ID: <42114D83.5000905@cis.upenn.edu> Date: Mon, 14 Feb 2005 20:16:51 -0500 From: Aaron Bohannon User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] String to list to string References: <420ac293.30127b31.1fa8.0b02@smtp.gmail.com> <200502100341.46451.jon@jdh30.plus.com> In-Reply-To: <200502100341.46451.jon@jdh30.plus.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 42114DBD.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; upenn:01 caml-list:01 wrote:01 char:01 char:01 iter:01 iter:01 trivial:01 upenn:01 revive:98 arbitrary:01 arbitrary:01 strings:01 functions:01 functions:01 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: Sorry to revive an old thread, but I have to add my $.02 here. Jon Harrop wrote: > Outrageously, the core library fails to provide an arbitrary number of > arbitrary functions. This exact question came up recently. The answer was > essentially: Why string -> char list and not string -> char array? Why string > -> char list and not string -> string list? And so on. Instead of adding one of these functions, I would much rather see a "fold" function on strings in the String module. The Array module has both "iter" and "fold" functions. Why, then, would the String module provide an "iter" but no "fold"--in a functional language?? The addition of a fold function would very often eliminate the need to convert a string to a char list or to introduce imperative-style programming into an otherwise purely functional section of code (not to mention that writing "char_list_of_string" would become trivial if it ever were necessary to do so). I acknowledge the fact that I can write my own fold function, but I just wanted to point out that this seems to be the most logical addition to the String module. Aaron -- Aaron Bohannon http://www.cis.upenn.edu/~bohannon/