From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p3TBpfKJ023200 for ; Fri, 29 Apr 2011 13:51:41 +0200 X-IronPort-AV: E=Sophos;i="4.64,287,1301868000"; d="scan'208";a="107072326" Received: from walapai.inria.fr ([128.93.30.24]) by mail1-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 29 Apr 2011 13:51:36 +0200 Received: from walapai.inria.fr (localhost [127.0.0.1]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p3TBpa1l023197 for ; Fri, 29 Apr 2011 13:51:36 +0200 Received: (from sympa@localhost) by walapai.inria.fr (8.13.6/8.12.10/Submit) id p3TBpa50023196 for caml-list@inria.fr; Fri, 29 Apr 2011 13:51:36 +0200 Date: Fri, 29 Apr 2011 13:51:36 +0200 X-Authentication-Warning: walapai.inria.fr: sympa set sender to sympa@inria.fr using -f To: caml-list@inria.fr From: louis.jachiet@ens.fr In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: [Caml-list] Differences between Array and Strings Hi, I'am failing to understand the behavior of the code below. Why the string is not regenerated ? Why strings and array have not the same behavior ? > let l () = "1" ;; > (l ()).[0] <- '2';; > l ();; > l()==l();; > let l () = [|1|] ;; > (l ()).(0) <- 2;; > l ();; > l() == l() ;; # val l : unit -> string = # - : unit = () # - : string = "2" # - : bool = true # val l : unit -> int array = # - : unit = () # - : int array = [|1|] # - : bool = false Louis Jachiet