<palomer>
I've been asked to write a theorem prover in sml
<palomer>
I think ill do it in ocaml
<palomer>
Hashtbl takes a comparator?
<palomer>
like, umm, how would I create this hashtbl?
<Demitar>
let my_hash = Hashtbl.create <expected size of hashtbl>
<palomer>
how will it know what key to take?
<palomer>
and how to compare those keys?
<Demitar>
It will infer the type as soon as you use the hash. And it uses structural equality iirc. (And cheats a bit to be able to create the hash on any object.)
<palomer>
what about comparison?
<Demitar>
What do you mean?
<mrvn>
Map is probably O(log n) while Hash should be O(1)
<async_>
unless you have a HashMap :)
<palomer>
erm, yeah, how does it know what hash function to use?
<Demitar>
palomer, as I said. It cheats. Using a C hash function. :)
<mrvn>
It probably just takes the bit pattern of the key as big integer % hash size.
<palomer>
so two objects which are structurally equal have the same hash code?
<palomer>
heck, what do I care, I'm using ints
<mrvn>
Given that you can only put one type of object into a hash those would be identical.
<Demitar>
palomer, the hash only determines what list to store the item in.
<Demitar>
Check the docs for exact details on collission handling (add shadows the previous, replace removes the previous but raises and exeption if no previous was found, etc)
buggs has quit [Read error: 232 (Connection reset by peer)]
<async_>
do external val's in a .mli file have to be a c function?
<mrvn>
just need c calling conventions.
<async_>
can you specify an external function that is just an ocaml function in a different file?
<mrvn>
That wouldn't be external.
<Smerdyakov>
async, why would you want to do that?
<async_>
well i have 2 files and i want to write one interface for both of those files
<async_>
and i'd like to avoid creating another .ml which just does mapping
<Smerdyakov>
I don't think that's possible, and I also don't see why it would be an issue.
<Smerdyakov>
What's wrong with two separate interfaces?
<async_>
because the two .ml files call functions from each other (they're mutually inclusive)
<async_>
:)
<Smerdyakov>
That's rather unorthodox. SML doesn't even allow that.
<async_>
neither does ocaml
<async_>
hehe
<async_>
which is why i need to make a big container file
<Smerdyakov>
No, OCaml does, or some readily available extension does.
<mrvn>
Smerdyakov: it gives a linker error
shawn_ has quit [Read error: 104 (Connection reset by peer)]
<Smerdyakov>
mrvn, I know there is a version of OCaml available with a recursive module system.
<async_>
Smerdyakov: or you could just make a container interface
<async_>
which combines both interfaces into one larger interface, and each file uses that big interface