Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] One question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ 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,

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: