From: louis.jachiet@ens.fr
To: caml-list@inria.fr
Subject: [Caml-list] Differences between Array and Strings
Date: Fri, 29 Apr 2011 13:51:36 +0200 [thread overview]
Message-ID: <sympa.1304077303.17524.902@inria.fr> (raw)
In-Reply-To:
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 = <fun>
# - : unit = ()
# - : string = "2"
# - : bool = true
# val l : unit -> int array = <fun>
# - : unit = ()
# - : int array = [|1|]
# - : bool = false
Louis Jachiet
next reply other threads:[~2011-04-29 11:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-29 11:51 louis.jachiet [this message]
2011-04-29 14:36 ` David Allsopp
2011-04-30 14:06 ` Philippe Wang
[not found] <fa.YVp+LBcZBn2VVSqyBV+/Bw0Mb/I@ifi.uio.no>
2011-04-30 11:03 ` Radu Grigore
2011-04-30 13:34 ` David Allsopp
2011-04-30 23:10 ` Martin Jambon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sympa.1304077303.17524.902@inria.fr \
--to=louis.jachiet@ens.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox