From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA29115; Sat, 15 Feb 2003 23:54:00 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA29104 for ; Sat, 15 Feb 2003 23:53:59 +0100 (MET) Received: from smtp.noos.fr (nan-smtp-04.noos.net [212.198.2.73]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h1FMrwf11202 for ; Sat, 15 Feb 2003 23:53:58 +0100 (MET) Received: (qmail 28849368 invoked by uid 0); 15 Feb 2003 22:53:58 -0000 Received: from unknown (HELO free.fr) ([81.66.86.49]) (envelope-sender ) by 212.198.2.73 (qmail-ldap-1.03) with SMTP for ; 15 Feb 2003 22:53:58 -0000 Message-ID: <3E4EC399.20200@free.fr> Date: Sat, 15 Feb 2003 23:47:53 +0100 From: WatchDog User-Agent: Mozilla/5.0 (Windows; U; Win98; fr-FR; rv:0.9.4) Gecko/20011019 Netscape6/6.2 X-Accept-Language: fr-fr MIME-Version: 1.0 To: caml-list@inria.fr, pierre.weis@inria.fr Subject: [Caml-list] Problem in modifying a mutable element in an array Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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