Browse thread
[Caml-list] One question
-
Alexander S. Usov
-
Samuel Mimram
- Alexander S. Usov
- Remi Vanicat
-
Samuel Mimram
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Alexander S. Usov <A.S.Usov@K...> |
| Subject: | Re: [Caml-list] One question |
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