caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Differences between Array and Strings
@ 2011-04-29 11:51 louis.jachiet
  2011-04-29 14:36 ` David Allsopp
  2011-04-30 14:06 ` Philippe Wang
  0 siblings, 2 replies; 6+ messages in thread
From: louis.jachiet @ 2011-04-29 11:51 UTC (permalink / raw)
  To: caml-list

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

^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <fa.YVp+LBcZBn2VVSqyBV+/Bw0Mb/I@ifi.uio.no>]

end of thread, other threads:[~2011-04-30 23:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-29 11:51 [Caml-list] Differences between Array and Strings louis.jachiet
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).