From: WatchDog <watchdog@free.fr>
To: caml-list@inria.fr, pierre.weis@inria.fr
Subject: [Caml-list] Problem in modifying a mutable element in an array
Date: Sat, 15 Feb 2003 23:47:53 +0100 [thread overview]
Message-ID: <3E4EC399.20200@free.fr> (raw)
Hello !
My problem has first appeared in a CamlLight implementation, but I have
then tried to do the same on O'Caml and the problem remained equal. But
I'm sure you'll be able to provide some help, won't you ?
In Caml Light :
#open "random";;
type agent = { mutable initial : int ; mutable courant : int ;
mutable longueur : float ; mutable liste_parcourue : int
list ;
à_visiter : int vect } ;;
let agent_init = { initial = 0 ; courant = 0 ; longueur = 0. ;
liste_parcourue = [] ;
à_visiter = make_vect n 1 } ;;
let f = make_vect m agent_init ;;
let set_f () = for p = 0 to (m-1) do
begin
f.(p).initial <- (int n) ;
f.(p).courant <- (int n) ;
f.(p).liste_parcourue <- [(int n)] ;
f.(p).à_visiter.(int n) <- 0
end
done
;;
And then set_f() doesn't work properly : it seems Caml refuses to modify
one element (for instance f.(5).initial) without modifying automatically
all its brothers, e.g. all the f.(i).initial ; for i from 0 to (m-1).
The fact is that I'd like to modify it element-by-element, and not all
at the same time.
Your help would be a real relief !!
Thanks
JB, from Paris.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next reply other threads:[~2003-02-15 22:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-15 22:47 WatchDog [this message]
2003-02-15 23:07 ` Samuel Mimram
2003-02-17 3:29 ` Issac Trotts
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=3E4EC399.20200@free.fr \
--to=watchdog@free.fr \
--cc=caml-list@inria.fr \
--cc=pierre.weis@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;
as well as URLs for NNTP newsgroup(s).