* [Caml-list] Use of Hashtbl
@ 2001-11-26 10:13 Francois Thomasset
2001-11-26 10:34 ` Nicolas George
0 siblings, 1 reply; 3+ messages in thread
From: Francois Thomasset @ 2001-11-26 10:13 UTC (permalink / raw)
To: caml-list; +Cc: Francois Thomasset
Hi
I can't explain the following behavior of add in module Hashtbl.
What I would like to have is an implementation of a set of strings: insertion,
test for membership, print funtion of the set. I know I could use the Set
module, but I don't really need to be applicative. Anyway I wonder what's
wrong with the code below.
module T = Hashtbl ;;
let hashtable : (string,unit) T.t = T.create 128 ;;
# T.add hashtable "un" ();;
- : unit = ()
# T.add hashtable "deux" ();;
- : unit = ()
# T.mem hashtable "un";;
- : bool = true
# T.mem hashtable "deux";;
- : bool = true
# T.clear hashtable;;
- : unit = ()
Fine. Now I add my strings all in one shot:
# T.add hashtable "un" ();; T.add hashtable "deux" ();;
- : unit = ()
# T.mem hashtable "un";;
- : bool = true
# T.mem hashtable "deux";;
- : bool = false
I must have missed something... Where is "deux"?
François Thomasset.
INRIA (A3)
Tel: +33 (1) 39-63-54-75
Fax: +33 (1) 39-63-53-30 ou +33 (1) 39-63-59-95
Email: Francois.Thomasset@inria.fr
Smail: INRIA, Rocquencourt, BP 105, 78153 Le Chesnay Cedex, France
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Use of Hashtbl
2001-11-26 10:13 [Caml-list] Use of Hashtbl Francois Thomasset
@ 2001-11-26 10:34 ` Nicolas George
0 siblings, 0 replies; 3+ messages in thread
From: Nicolas George @ 2001-11-26 10:34 UTC (permalink / raw)
To: caml-list
Le sextidi 6 frimaire, an CCX, Francois Thomasset a écrit :
> # T.add hashtable "un" ();; T.add hashtable "deux" ();;
It has nothing to do with Hashtbl:
# prerr_endline "one";; prerr_endline "two";;
one
- : unit = ()
# prerr_endline "one";; + syntax error;;
one
- : unit = ()
Obviously, the toplevel stops parsing after the first ;;.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Use of Hashtbl
@ 2001-11-26 10:20 Damien Doligez
0 siblings, 0 replies; 3+ messages in thread
From: Damien Doligez @ 2001-11-26 10:20 UTC (permalink / raw)
To: caml-list
>I can't explain the following behavior of add in module Hashtbl.
Nothing to do with hash tables. This is the old toplevel bug of
ignoring everything after the first ";;".
Objective Caml version 3.03 ALPHA + 1
# 1+2 ;; !@#$%^^&**((
- : int = 3
#
-- Damien
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-11-26 10:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-26 10:13 [Caml-list] Use of Hashtbl Francois Thomasset
2001-11-26 10:34 ` Nicolas George
2001-11-26 10:20 Damien Doligez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox