<tehdeuce>
I'm not sure that this is the greatest place to ask, but what would the best way to implement a sort of bi-directional hash table (that's probably not the right term). I have a bunch of pairs of values, and I want to be able to use either term to look up the other. I have a couple ideas of how I could do it, but I thought it might be a good idea to ask and make sure there isn't some better way to do it that I don't know of
<lucca>
this problem appears a lot in databases;
<lucca>
wanting multiple indexed columns into a table, for example
<lucca>
optimality depends on usage... is it static data or will there be updates? do you need cursors? etc
<lucca>
trees are a good approach
<lucca>
multiple hashes can work
<tehdeuce>
There will be updates, but I don't need cursors. How exactly could I use trees to do this?
<lucca>
pick a primary key (not necessarily either of your two main things you want, but possibly)
<lucca>
have a tree mapping that key to your records
<lucca>
for each indexed column (direction of hashing in your original question)
<lucca>
keep another tree mapping that value to a primary key in the main tree
<lucca>
each time you add a record, drop it in the main tree and add nodes to the index trees as per its values
<lucca>
similar for delete/modify
<tehdeuce>
Ah. Thanks for the help.
<lucca>
things get more interesting if you need to implement two-phase commits
<lucca>
e.g. for a distributed transaction manager
<lucca>
enjoy...
<tehdeuce>
heh, I doubt I'll have the need for that any time soon
tehdeuce has left #ocaml []
malc_ has quit ["leaving"]
slipstream has joined #ocaml
slipstream-- has quit [Read error: 110 (Connection timed out)]
mikeX has quit ["leaving"]
bebui has quit [Read error: 110 (Connection timed out)]
<mbishop>
Hmm, so could JoCaml become the solution to concurrency in Ocaml? (and I do mean "the" solution)
TaXules has quit [Read error: 110 (Connection timed out)]
slacker403 has joined #ocaml
<slacker403>
yoooooo
<slacker403>
looks like ocaml is getting more and more popular
bebui has joined #ocaml
TaXules has joined #ocaml
bebui has quit [Read error: 104 (Connection reset by peer)]
TaXules has quit [Read error: 104 (Connection reset by peer)]
bebui has joined #ocaml
TaXules has joined #ocaml
<kelaouchi>
rwmjones did you get mod_caml working ?
<kelaouchi>
did you make a package ?
smithzv has quit [Read error: 113 (No route to host)]
slacker403 has left #ocaml []
jao has quit []
Riesz has quit ["Leaving.."]
G has quit [Remote closed the connection]
G has joined #ocaml
Submarine has joined #ocaml
scode has quit [Read error: 104 (Connection reset by peer)]
scode has joined #ocaml
haelix has quit [Remote closed the connection]
haelix has joined #ocaml
mattam has quit [Remote closed the connection]
mattam has joined #ocaml
joshcryer has quit [Nick collision from services.]
joshcryer has joined #ocaml
Submarine has quit [Remote closed the connection]
kelaouchi has quit ["leaving"]
smimou has joined #ocaml
kelaouchi has joined #ocaml
jeberle has joined #ocaml
smimou has quit ["bli"]
love-pingoo has joined #ocaml
jeberle has quit ["leaving"]
ygrek has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
EliasAmaral has joined #ocaml
jao has joined #ocaml
love-pingoo has joined #ocaml
rwmjones_away is now known as rwmjones
noteventime has joined #ocaml
jao has quit []
slipstream has quit [Read error: 110 (Connection timed out)]
zmdkrbou_ has joined #ocaml
zmdkrbou has quit [Nick collision from services.]
zmdkrbou_ is now known as zmdkrbou
noteventime has quit [Remote closed the connection]
noteventime has joined #ocaml
gim_ has joined #ocaml
_ke has joined #ocaml
<_ke>
hi
noteventime has quit ["Leaving"]
noteventime has joined #ocaml
Riesz has joined #ocaml
Sparkles has joined #ocaml
Sparkles has quit [Client Quit]
noteventime has quit ["Leaving"]
_ke has quit ["umount /mnt/me"]
jao has joined #ocaml
love-pingoo has quit [Read error: 111 (Connection refused)]
love-pingoo has joined #ocaml
pango has quit [Remote closed the connection]
Riesz_ has joined #ocaml
Riesz has quit [Read error: 104 (Connection reset by peer)]
bluestorm_ has joined #ocaml
pango has joined #ocaml
love-pingoo has quit ["Leaving"]
jao has quit [Success]
jacobian_wrk has joined #ocaml
<jacobian_wrk>
how do you load pcre from the interactive session?
<jacobian_wrk>
I tried #load "pcre/pcre.cma";;
<jacobian_wrk>
which works without error, yet there is no pcre module
<rwmjones>
jacobian_wrk, what do you mean "yet there is no pcre module"?
<jacobian_wrk>
# open Pcre;;
<jacobian_wrk>
Unbound module Pcre
<rwmjones>
ok, it's a path issue
<rwmjones>
either do: ocaml -I +pcre
<rwmjones>
or #directory "+pcre" before doing the #load