musicallyut has quit [Read error: 110 (Connection timed out)]
musicallyut has joined #ocaml
bluestorm has joined #ocaml
bluestorm has quit ["Konversation terminated!"]
musically has quit [Read error: 110 (Connection timed out)]
nuncanada has quit ["Leaving"]
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
musically has joined #ocaml
musicallyut has quit [Connection timed out]
musicallyut has joined #ocaml
musically has quit [Read error: 110 (Connection timed out)]
ygrek has joined #ocaml
musically has joined #ocaml
filp has joined #ocaml
filp has quit [Client Quit]
musically_ut has joined #ocaml
musicallyut has quit [Read error: 110 (Connection timed out)]
asmanur has joined #ocaml
seafood has quit []
musicallyut has joined #ocaml
musically has quit [Connection timed out]
musically_ut has quit [Connection timed out]
seafood has joined #ocaml
filp has joined #ocaml
filp has quit [Client Quit]
musicallyut has quit [Connection timed out]
Ched- has left #ocaml []
<flux>
how do people usually generate unique ids?
<flux>
I've most of the time just picked int64 and incremented it, with the potential problem of it wrapping around at some time
<flux>
(although it is usually quite unlikely..)
<asmanur>
there's a unique () function in extLib but I think it uses the naive implementation.
<asmanur>
flux: do you need so much ids ?
<flux>
who knows, the program is not supposed to be stopped ;)
<flux>
I would be wary of picking plain int, though
<asmanur>
you could use Big_int if you really want an infinite suite :}
<asmanur>
(actually it's not infinite, because the computer will run out of memory someday)
<flux>
with plain int on a 32-bit platform I need to generate only less than 100 ids per second and the wraparound would be within a year
<flux>
but I just did the math (probably again) and noticed that no, int64 is not going to wrap around :)
<flux>
however, another option I played with yesterday: have int ref as the id, and have their finalizer put the int back to a free list
<flux>
but perhaps that's just lost performance for no gain
<asmanur>
what do you use theses ids for ?
<flux>
well, in the latest instance I need to associate n objects with m objects
Jedai has joined #ocaml
<flux>
so I have a map from n objects to an id, and a map from that id to a a set of objects
<flux>
I need an id so I can efficiently remove the association from the data structure, otherwise I could just put the sets inside the map
<flux>
another thing with ids is that generating them thread-safely is horribly non-performant. and a quick fix would be to implement them in C, which gets exclusivity very efficiently..
<flux>
I don't need threading support with this particular case, but perhaps it would be nice to do it properly once and for all
hkBst has joined #ocaml
dabd has joined #ocaml
musically_ut has joined #ocaml
rwmjones has joined #ocaml
seafood has quit []
Jedai has quit [Connection reset by peer]
Jedai has joined #ocaml
Snark has joined #ocaml
OChameau has joined #ocaml
Yoric[DT] has joined #ocaml
seafood has joined #ocaml
musically_ut has quit [Connection timed out]
petchema has joined #ocaml
love-pingoo has joined #ocaml
tomh has joined #ocaml
Jedai has quit [Read error: 113 (No route to host)]
Jedai has joined #ocaml
filp has joined #ocaml
filp has quit [Client Quit]
<jlouis>
flux, assume you generate a new unique id once every millisecond (or your preferred granularity). Then calculate when the 64bit counter wraps around. When i did it it came around 200 years or something
<jlouis>
I think the logic is sure to outlast the hardware by then :)
<flux>
but if you have bunch that can generate unique ids in batches, you could run into a problem within just a few years :)
<flux>
s/bunch/bunch of code/
<flux>
(assuming your numbers are correct)
dabd has quit [Read error: 110 (Connection timed out)]
<jlouis>
I think you are worrying about a problem before it becomes one ;)
<flux>
actually in my application I could probably just do: let rec main () = try real_main () with IdOverflow -> log "ID overflow; restarting"; main () ;-)
<jlouis>
oh, hehe
<jlouis>
you could also think about cryptographic checksums and go probalistic on the problem
dabd has joined #ocaml
RobertFischer has joined #ocaml
qwr has quit [Remote closed the connection]
RobertFischer has quit [Remote closed the connection]
RobertFischer has joined #ocaml
RobertFischer has quit [Read error: 104 (Connection reset by peer)]
RobertFischer has joined #ocaml
RobertFischer has quit [Remote closed the connection]
ppsmimou has quit [Read error: 60 (Operation timed out)]
ppsmimou has joined #ocaml
aeolist has quit [Nick collision from services.]
kotarak has joined #ocaml
gim has quit [Remote closed the connection]
gim has joined #ocaml
Jedai has quit [leguin.freenode.net irc.freenode.net]
OChameau has quit [leguin.freenode.net irc.freenode.net]
Morphous_ has quit [leguin.freenode.net irc.freenode.net]
ikatz has quit [leguin.freenode.net irc.freenode.net]
Mr_Awesome has quit [leguin.freenode.net irc.freenode.net]
pattern has quit [leguin.freenode.net irc.freenode.net]
Jedai has joined #ocaml
OChameau has joined #ocaml
Morphous_ has joined #ocaml
Mr_Awesome has joined #ocaml
pattern has joined #ocaml
ikatz has joined #ocaml
asmanur_ has joined #ocaml
asmanur has quit [Read error: 110 (Connection timed out)]
ggadolin has joined #ocaml
pango has quit [Remote closed the connection]
ggadolin has quit [Remote closed the connection]
ggadolin has joined #ocaml
<ggadolin>
i have written structure for representing partial order, used abstract type, how can I say ocaml to use int as my abstract type? http://pastebin.com/d739cecea
<Yoric[DT]>
"type v = int"
seafood has quit []
<Yoric[DT]>
(but in the interface of your module, just keep "type v")
pango has joined #ocaml
<ggadolin>
i have tried this, just double checked, my module is called Traph, what i do: 1. #use ... 2. open Traph 3. type v = int
<Yoric[DT]>
Unless I'm direly mistaken, the way you have written Traph, type v does not have any inhabitant.
<ggadolin>
"let s = create 4" is ok but "add_vertex s 4" not, since he expects Traph.v to be second arg
<Yoric[DT]>
If you want to parametrize Traph upon a type, you need functors.
<Yoric[DT]>
I remember someone suggesting a Cmalp4 extension to make things a bit easier.
<Yoric[DT]>
But it's not standard.
<ggadolin>
is there more straightforward to achieve what i want and leave user with choice
<Yoric[DT]>
Perhaps with "type 'a v = 'a"
<ggadolin>
i created record vertex "type vertex = {pos:int; value:v }" which force me to define abstract type v
<Yoric[DT]>
(you'll need to propagate this 'a so you'll also have "type 'a vertex = ...")
<Yoric[DT]>
etc
<flux>
yes, either functors or type variables; in this case I'd probably go with the latter
<ggadolin>
yes, that did the thing, thanks!
<Yoric[DT]>
Our pleasure.
<flux>
bloom filters truly are a neat and simple construct, but I don't know if I can find any use for them, even after all the hyping on programming.reddit ;)
al-maisan has joined #ocaml
al-maisan has left #ocaml []
kotarak has quit ["Xaide, 4ao."]
al-maisa1 has joined #ocaml
asmanur_ has quit [Remote closed the connection]
al-maisa1 has left #ocaml []
Linktim has joined #ocaml
guillem has joined #ocaml
al-maisan has joined #ocaml
al-maisan has left #ocaml []
RobertFischer has joined #ocaml
bluestorm has joined #ocaml
asmanur has joined #ocaml
smimou has quit ["bli"]
jlouis has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
asmanur has quit [Remote closed the connection]
Snark has quit ["Ex-Chat"]
Linktim_ has joined #ocaml
filp has joined #ocaml
vpalle has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
palomer has joined #ocaml
ofaurax has joined #ocaml
Linktim_ has quit [Remote closed the connection]
filp has quit ["Bye"]
dabd has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
jeremiah has joined #ocaml
tomh has joined #ocaml
smimou has joined #ocaml
bluestorm has quit ["Konversation terminated!"]
jeremiah has quit [Read error: 104 (Connection reset by peer)]
palomer has quit [Read error: 110 (Connection timed out)]