From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=AWL,DNS_FROM_RFC_POST, HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 7BC41BBC4 for ; Sat, 4 Apr 2009 11:26:56 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnsCADvF1knRVdulmGdsb2JhbACCJDGTEj8BAQEBAQgJDAcRplyPZgEDAQOEDAaGCw X-IronPort-AV: E=Sophos;i="4.39,323,1235948400"; d="scan'208";a="23933859" Received: from mail-ew0-f165.google.com ([209.85.219.165]) by mail2-smtp-roc.national.inria.fr with ESMTP; 04 Apr 2009 11:26:46 +0200 Received: by ewy9 with SMTP id 9so1300232ewy.27 for ; Sat, 04 Apr 2009 02:26:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type; bh=n+Y/+JPUjRcse8Ku8Vd5awycD1DfJSyJh1dah4jGaUg=; b=cndyOkiVCYydK2t2Yw690foec5LjYbnpwM7M+qwoay9/KTs67D8itVzIO/ILrj4rrr 8nbc4OZxVlYifoiBl7KIDP8llo1+2Ptv8sXeisiCXiB4pLxNSDX2Wni5lCYih1xL7DPX dZYaNud/FxsCMjW8Xf2FGg4S4ElDcdW0P4r9s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=ebeJI/INQVkQvvdORtj7vR4MEi5lfY9eB0W0dBoeoH93LiqwdpjQ3JR/bkI1KhKACr d/dKQzc0shE076jVzudUGjMZBm2vTDYpYXN5CnZpY/uKVsKW5CNVWvi6vzRXDGt6lDL5 +MU7JtxlrTf0DU7tsuVqyDzq8kJybssRti9Cw= MIME-Version: 1.0 Sender: alpmestan@gmail.com Received: by 10.210.115.15 with SMTP id n15mr1209803ebc.95.1238837206391; Sat, 04 Apr 2009 02:26:46 -0700 (PDT) In-Reply-To: <1238836474.6250.11.camel@Blefuscu> References: <200904031256.33357.jon@ffconsultancy.com> <1238836474.6250.11.camel@Blefuscu> Date: Sat, 4 Apr 2009 11:26:46 +0200 X-Google-Sender-Auth: c1c545fe70b86ccd Message-ID: Subject: Re: [Caml-list] Strings From: Alp Mestan To: David Rajchenbach-Teller , caml-list@yquem.inria.fr Content-Type: multipart/alternative; boundary=0015174c1bb89f1bd20466b743a1 X-Spam: no; 0.00; ens-lyon:01 mutable:01 ocaml:01 haskell's:01 ocaml's:01 lacks:01 ens-lyon:01 mutable:01 ocaml:01 haskell's:01 ocaml's:01 lacks:01 2009:98 2009:98 wrote:01 --0015174c1bb89f1bd20466b743a1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Sat, Apr 4, 2009 at 11:14 AM, David Rajchenbach-Teller < David.Teller@ens-lyon.org> wrote: > I personally can't remember the last time I've needed mutable strings in > OCaml. Neither do I. > On the other hand, I can remember a handful of times where, to > return a constant string, I had to make a function that would rebuild > the string at every call. Which is both needlessly slow and awkward for > what looks like a constant. > I think providing both capabilities is the best solution. However, let's study Haskell's strings. They simply are a list of characters. This let the ability to use heavily list-related functions (take, takeWhile, drop, dropWhile, map, etc.). On the other hand, OCaml's standard library lacks of many functions for strings ! I think this is too much imperative oriented. Maybe we could try to implement (for Batteries or in a separate project) string lists and then use the power of Batteries' list module with many (really many... that's a real pleasure to read its documentation) functions to work with. I think with a bit of internal laziness, we could get a great immutable string type with many functions to manipulate it. But I guess there are many cons to do so, otherwise it would have been "standardized". -- Alp Mestan --0015174c1bb89f1bd20466b743a1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Sat, Apr 4, 2009 at 11:14 AM, David Rajchenba= ch-Teller <David.Teller@ens-lyon.org> wrote:
I personally can't remember the last time I've needed mutable strin= gs in
OCaml.

Neither do I.
=A0
On the other hand, I can remember= a handful of times where, to
return a constant string, I had to make a function that would rebuild
the string at every call. Which is both needlessly slow and awkward for
what looks like a constant.

I think providing both capabilities is the best solu= tion.
However, let's study Haskell's strings.
They simply are= a list of characters. This let the ability to use heavily list-related fun= ctions (take, takeWhile, drop, dropWhile, map, etc.). On the other hand, OC= aml's standard library lacks of many functions for strings ! I think th= is is too much imperative oriented. Maybe we could try to implement (for Ba= tteries or in a separate project) string lists and then use the power of Ba= tteries' list module with many (really many... that's a real pleasu= re to read its documentation) functions to work with. I think with a bit of= internal laziness, we could get a great immutable string type with many fu= nctions to manipulate it.

But I guess there are many cons to do so, otherwise it would have been = "standardized".


--
Alp Mestan
--0015174c1bb89f1bd20466b743a1--