From: "Julien Peeters" <jj.peeters@gmail.com>
To: "David MENTRE" <dmentre@linux-france.org>, caml-list@inria.fr
Subject: Re: [Caml-list] Hashtbl.remove legal within Hashtbl.iter for the same hash table?
Date: Sun, 11 May 2008 16:44:14 +0200 [thread overview]
Message-ID: <9b73ffc50805110744k6da17eb9yd40231d9e8c31787@mail.gmail.com> (raw)
In-Reply-To: <87tzh5kxhl.fsf@linux-france.org>
[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]
Hi David,
Because the arguments passed to functions could be considered as references
(same memory space), IMHO, if you respect the scope priority it should work.
For instance:
let () =
let h = Hashtbl.create 7 in
let f k v = Hashtbl.remove h k in
Hashtbl.iter f h
Julien.
2008/5/11 David MENTRE <dmentre@linux-france.org>:
> Hello,
>
> Probably a newbie question but anyway: is it allowed to do a
> Hashtbl.remove while doing a Hashtbl.iter on the same hash table?
>
> More precisely, at one point while doing a "Hashtbl.iter f h" my
> function "f" is called with something like "f k v". Can I do a
> "Hashtbl.remove h k" within the body of "f"?
>
> Sincerely yours,
> david
> --
> GPG/PGP key: A3AD7A2A David MENTRE <dmentre@linux-france.org>
> 5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
--
Julien Peeters
Student in engineering
Institut de Formation des Ingénieurs de Paris-Sud
Orsay, France
Website: http://www.dedilabs.com/~jpeeters
[-- Attachment #2: Type: text/html, Size: 2165 bytes --]
prev parent reply other threads:[~2008-05-11 14:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-11 9:20 David MENTRE
2008-05-11 14:42 ` [Caml-list] " Florent Monnier
2008-05-11 14:46 ` Till Varoquaux
2008-05-11 15:10 ` Florent Monnier
2008-05-11 22:45 ` Till Varoquaux
2008-05-11 23:08 ` Martin Jambon
2008-05-12 9:29 ` David MENTRE
2008-05-11 15:07 ` Florent Monnier
2008-05-11 14:44 ` Julien Peeters [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9b73ffc50805110744k6da17eb9yd40231d9e8c31787@mail.gmail.com \
--to=jj.peeters@gmail.com \
--cc=caml-list@inria.fr \
--cc=dmentre@linux-france.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox