sponge45 changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/
SooW has quit ["Quitte"]
malc_ has quit ["leaving"]
ramenboy has joined #ocaml
trisiak has joined #ocaml
ramenboy has quit [Remote closed the connection]
love-pingoo has quit ["Connection reset by pear"]
mnemonic has quit ["leaving"]
Mr_Awesome has quit ["...and the Awesome level drops"]
jlouis has quit [Read error: 60 (Operation timed out)]
joshcryer has joined #ocaml
dark_light has quit [Connection timed out]
mikeX has quit ["leaving"]
joshcryer has quit [Client Quit]
joshcryer has joined #ocaml
pants1 has quit ["Leaving."]
Smerdyakov has quit ["Leaving"]
Submarine has joined #ocaml
johnnowak has quit [Read error: 145 (Connection timed out)]
johnnowak has joined #ocaml
Submarine has quit [Remote closed the connection]
joshcryer has quit [Read error: 110 (Connection timed out)]
johnnowak has quit [Read error: 145 (Connection timed out)]
johnnowak has joined #ocaml
johnnowak has quit [Read error: 145 (Connection timed out)]
johnnowak has joined #ocaml
Hadaka has quit [Read error: 110 (Connection timed out)]
jacobian__ has joined #ocaml
johnnowak has joined #ocaml
love-pingoo has joined #ocaml
david_koontz has quit [Read error: 104 (Connection reset by peer)]
jacobian has quit [Read error: 110 (Connection timed out)]
johnnowak has quit [Read error: 145 (Connection timed out)]
diffbavis has joined #ocaml
david_koontz has joined #ocaml
david_koontz has left #ocaml []
slipstream-- has joined #ocaml
slipstream has quit [Read error: 60 (Operation timed out)]
slipstream has joined #ocaml
slipstream-- has quit [Read error: 60 (Operation timed out)]
slipstream-- has joined #ocaml
slipstream has quit [Read error: 60 (Operation timed out)]
clog has joined #ocaml
<mahasamoot>
what are the advantages of ocaml?
ikaros has quit ["segfault"]
ikaros has joined #ocaml
love-pingoo has quit ["Leaving"]
<Smerdyakov>
If you can't find an answer to that question on the web, then someone should certainly create a web page about it... but I'm not going to answer it right here.
Oatmeat|umn has quit [Read error: 104 (Connection reset by peer)]
ocaml_newbie has quit ["using sirc version 2.211+KSIRC/1.3.12"]
bzzbzz has quit ["leaving"]
diffbavis has quit [Read error: 104 (Connection reset by peer)]
mnemonic has joined #ocaml
<mnemonic>
hi
diffbavis has joined #ocaml
smimou has joined #ocaml
love-pingoo has joined #ocaml
<postalchris>
Is it safe to modify a hashtable inside Hashtbl.iter?
benny has joined #ocaml
_JusSx_ has joined #ocaml
benny__ has quit [Read error: 110 (Connection timed out)]
pango has quit [Remote closed the connection]
pango has joined #ocaml
mahasamoot has quit ["Chatzilla 0.9.77 [Firefox 2.0.0.1/2006120418]"]
<mattam>
postalchris: if it's not in the spec... look in the source :) That may indicate a bad design on your side though
<flux->
it's still a good question, though, I'd like to know that too :)
<flux->
functional data structures have their advantages, that question would never arise..
<mattam>
you can't do anything safely, it does:
<mattam>
| Cons(k, d, rest) ->
<mattam>
f k d; do_bucket rest in
<mattam>
let d = h.data in
<mattam>
for i = 0 to Array.length d - 1 do
<mattam>
do_bucket d.(i)
<mattam>
done
<mattam>
so if you add an element and it can go in a bucket before or after so you don't know if you'll see it
<mattam>
s/and it/ it/
pango has quit [Remote closed the connection]
pango has joined #ocaml
cmvjk has quit [Read error: 60 (Operation timed out)]
<flux->
mattam, hm, are bucket contents ordered somehow?
<flux->
hmm. so the buckets are a linked list
<mattam>
probably
<flux->
did you look at the add-function?
<flux->
it seems safe to me to Hashtbl.add while iterating
<flux->
or maybe I should read the whole code and not just snippets :)
<mattam>
it just adds to the front
bluestorm has joined #ocaml
<pango>
that will make your code very implementation dependant...
<mattam>
funny, there is are 3 unfoldings of find_rec in find, wonder how much that buys in terms of performance :)
<pango>
you could create lists of elements to add and remove as you go, then modify the content of the hash table as a last step
<pango>
or rebuild a new hash table... depends how much elements change
<mattam>
yep that seems much cleaner
Nutssh has joined #ocaml
<pango>
mattam: hash table resize their base when there's more than two elements per bucket on average... So by unrolling three level of find, I guess there's some hidden hypothesis that the recursive call should almost never happen, or something like that...
<mattam>
ok
<pango>
that's my own guess :) But I wonder too, how much that wins ;)
<pango>
personally I'd prefer an API change, so that find returns enough information to allow for element insertion/removal without a second lookup :)
<Nutssh>
I wouldn't worry about it. Once you've paid the cache miss for the find, the insert/removal is cheap.
<pango>
you still have the hash function computation
<Nutssh>
True. There is that.
<pango>
s/you/there's/
<pango>
oups :) shouldn't be doing two things at the same time :)
mikeX has joined #ocaml
<Nutssh>
three. :)
bluestorm has quit ["Konversation terminated!"]
bluestorm has joined #ocaml
<postalchris>
Thanks for the comments, folks. I agree that my initial idea was the wrong approach. I've sidestepped the modify-during-iter problem.
Submarine has joined #ocaml
jlouis has joined #ocaml
Oatmeat|umn has joined #ocaml
pants1 has joined #ocaml
malc_ has joined #ocaml
david_koontz has joined #ocaml
david_koontz has quit [Read error: 104 (Connection reset by peer)]
postalchris has quit [Read error: 110 (Connection timed out)]
david_koontz has joined #ocaml
a-priori_ has joined #ocaml
a-priori has quit [Read error: 104 (Connection reset by peer)]