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 SAA00439; Sun, 23 Feb 2003 18:29:13 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA00395 for ; Sun, 23 Feb 2003 18:29:12 +0100 (MET) Received: from KVIW14.KVI.nl (KVIW14.KVI.nl [129.125.15.46]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h1NHTBH07492 for ; Sun, 23 Feb 2003 18:29:11 +0100 (MET) Received: from KVIR52.KVI.nl ("port 2356"@KVIR52.KVI.nl [129.125.37.116]) by KVI.nl (PMDF V6.2 #30688) with ESMTP id <01KSSCGPG0VWC3SI0M@KVI.nl> for caml-list@inria.fr; Sun, 23 Feb 2003 18:28:54 +0100 (MET) Received: from KVIW15.KVI.nl by KVIR52.KVI.nl (AvMailGate-2.0.1.10) id 06921-70294E11; Sun, 23 Feb 2003 18:28:52 +0100 Received: from KVIP88.KVI.nl ("port 33490"@KVIP88.KVI.nl [129.125.15.152]) by KVI.nl (PMDF V6.2 #30688) with ESMTP id <01KSSCGBC2UUC3SI0M@KVI.nl>; Sun, 23 Feb 2003 18:28:34 +0100 (MET) Date: Sun, 23 Feb 2003 18:28:31 +0100 From: "Alexander S. Usov" Subject: Re: [Caml-list] One question In-reply-to: <20030223181203.6cf41436.Samuel.Mimram@ens-lyon.fr> To: Samuel Mimram Cc: OCaml mailing list Message-id: <1046021311.12770.12.camel@kvip88.KVI.nl> Organization: KVI MIME-version: 1.0 X-Mailer: Ximian Evolution 1.2.1- (1.2.1-alt3) Content-type: text/plain Content-transfer-encoding: 7BIT References: <1046017748.12274.14.camel@kvip88.KVI.nl> <20030223181203.6cf41436.Samuel.Mimram@ens-lyon.fr> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sun, 2003-02-23 at 18:12, Samuel Mimram wrote: > Hello. > > I think you are confusing the operators = and ==. = is used to check > if two objects have the same "logical" contents whether == checks if > two objects are exactly the same in memory. > When you type a = insert a "word", the function insert returns a new > lex_tree which has the same contents as the variable a but is another > object in memory. That is why I think you wanted to write : > > let a = insert [] "word" > in > a = insert a "word" ;; > > which effectively returns true. It is important to understand that the > variable a and the result returned by the function insert are logically > the same but not physically. Yes, I understand that == checks for a physical equality. But in case the word is already present in tree I return the same dictionary (note "raise Already" in insert). The idea was to make shure that the dictionary won't be modified if we do not change anything in it. -- Best regards, Alexander. ------------------- 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