sponge45 changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/
bluestorm_ has quit ["Konversation terminated!"]
cjeris has quit [Read error: 104 (Connection reset by peer)]
mnemonic has joined #ocaml
ikaros has quit ["Leaving"]
postalchris has quit [Read error: 110 (Connection timed out)]
love-pingoo has quit ["Connection reset by pear"]
smimou has quit ["bli"]
ikaros has joined #ocaml
joshcryer has quit [Connection timed out]
joshcryer has joined #ocaml
malc_ has quit ["leaving"]
postalchris has joined #ocaml
postalchris has quit [Client Quit]
pantsd has quit [Read error: 110 (Connection timed out)]
mnemonic has quit ["leaving"]
joshcryer has quit [Connection timed out]
a-priori has quit [Remote closed the connection]
a-priori has joined #ocaml
mefyl has quit [Read error: 110 (Connection timed out)]
jeffs has joined #ocaml
Mr_Awesome has quit ["...and the Awesome level drops"]
b00t has joined #ocaml
diffbavis has quit [Read error: 104 (Connection reset by peer)]
ludwig- has quit [Read error: 110 (Connection timed out)]
Submarine has joined #ocaml
malc_ has joined #ocaml
joshcryer has joined #ocaml
joshcryer has quit [Connection reset by peer]
Smerdyakov has quit ["Leaving"]
a-priori has quit [zelazny.freenode.net irc.freenode.net]
benny_ has quit [zelazny.freenode.net irc.freenode.net]
descender has quit [zelazny.freenode.net irc.freenode.net]
Oatmeat|umn has quit [zelazny.freenode.net irc.freenode.net]
gim has quit [zelazny.freenode.net irc.freenode.net]
ppsmimou has quit [zelazny.freenode.net irc.freenode.net]
gunark has quit [zelazny.freenode.net irc.freenode.net]
eradman has quit [zelazny.freenode.net irc.freenode.net]
a-priori has joined #ocaml
benny_ has joined #ocaml
descender has joined #ocaml
Oatmeat|umn has joined #ocaml
gim has joined #ocaml
ppsmimou has joined #ocaml
gunark has joined #ocaml
eradman has joined #ocaml
slipstream has quit [Read error: 104 (Connection reset by peer)]
gunark has quit [Connection timed out]
gunark has joined #ocaml
slipstream has joined #ocaml
malc_ has quit ["leaving"]
Saparok has joined #ocaml
Saparok has quit ["NO CARRIER"]
smimou has joined #ocaml
bluestorm has joined #ocaml
<cmvjk>
i'm looking at this C binding code for ocaml, and there's a function in here that takes this enum type, then uses a case statement to return the exact number of each of the values, and then calls Int_val on that...
<cmvjk>
is that necessary? I'm not familiar enough with C to know if enums are actually Ints, but wouldn't it be acceptable to just call Int_val directly on an enum type?
slipstream has quit [Read error: 104 (Connection reset by peer)]
<cmvjk>
or rather, Val_int I mean.
<flux->
cmvjk, maybe it wants to use same (stable) numbers even if the C implementation changes
slipstream has joined #ocaml
<flux->
I'm assuming they eventually end up to an ocaml enumeration type
<flux->
and not just used as an opaque type that comes out and goes in to the library
<cmvjk>
yeah, the return value becomes an ocaml enum type.
<flux->
so changing the order of enums in C won't break the bindings
<flux->
it might also want a warning from the compiler if it handle all the enumerations
<cmvjk>
hmm. that's a good point.
<flux->
+doesn't
slipstream has quit [Read error: 110 (Connection timed out)]
<flux->
wish there were Hashtbl.change : ('a, 'b) t -> 'a -> ('b -> 'b) -> unit, it would save my half the hashing
<flux->
hm, with a default argument for 'not found'
smimou has quit ["bli"]
slipstream has joined #ocaml
<flux->
hmm.. how fast is Set.split?
<flux->
O(log n) best case, how about worst case?
slipstream has quit [Read error: 110 (Connection timed out)]
a-priori has quit [Remote closed the connection]
gunark has quit [Remote closed the connection]
gunark has joined #ocaml
a-priori has joined #ocaml
love-pingoo has joined #ocaml
jlouis_ has quit [Remote closed the connection]
bluestorm has quit [Remote closed the connection]
ludwig- has joined #ocaml
<love-pingoo>
I've got questions about portability... it'd be perfect if there was somebody on a powerpc around.
<love-pingoo>
Are OCaml ints always 31 bits and little endian ?
<love-pingoo>
I've got some code translating two chars (read as little endian signed short int) into an int, and I'm wondering how portable it is..
<flux->
I don't think they are ever _smaller_ than 31 bits
<love-pingoo>
flux-: I'm bothered by 64bit archs
<flux->
but endianess, no. but how do you detect endianess in ocaml?
<flux->
does the code use Obj.magic?
<love-pingoo>
for example I used to do (0x7fff0000 lor i) to add the highest bits to i (which is the sum of the two bytes)
<love-pingoo>
it wouldn't work for 63bit ints
<love-pingoo>
flux-: Printf "%x\n" i ?
<flux->
love-pingoo, how do you determine endianess from that?
<love-pingoo>
Actually I don't care about the internal representation, I just want to be sure that the operations that I used have a portable meaning.
<love-pingoo>
flux-: I don't.. but I'd see if the int is 63bits
<flux->
love-pingoo, maybe you should use Int32.t and Int64.t if you 'abuse' their representation ;)
<flux->
but they are boxed..
<love-pingoo>
that's not a bad idea
<love-pingoo>
flux-: what's your architecture ?
<flux->
I'm on 32-bit x86
<love-pingoo>
(I mean, what's the architecture of your computer, no offense)
<flux->
:-)
<love-pingoo>
I'm not even sure about what test I should run..
<flux->
I have access to 64-bit sparcv9 though
<flux->
and it has ocamlc/ocamlopt
<love-pingoo>
what's sparc endianness
<love-pingoo>
my co-worker on amd64 is back so I already have 64bits little-endian
<flux->
sun machines are, like the internet, big endian
<flux->
I can copy/paste some ocamlc commands in if you want
<flux->
make that ocaml, not ocamlc..
<love-pingoo>
Printf.printf "%x" (-1) ?
<flux->
hm, it says 7fffffff- : unit = ()
<flux->
I wonder if ocaml is compiled to be 64 bit
<ppsmimou>
# Printf.printf "%x" (-1);;
<ppsmimou>
7fffffffffffffff- : unit = ()
<ppsmimou>
on my 64LE
<love-pingoo>
good
<flux->
ocamlopt says the same
<love-pingoo>
ppsmimou: can you confirm that (-1) lxor 0xffff = -1 ?
<love-pingoo>
that seems stupid...
* love-pingoo
goes lunch
<ppsmimou>
love-pingoo: raté !
<flux->
I wonder how I should fix that compilation
<ppsmimou>
# (-1) lxor 0xffff;;
<ppsmimou>
- : int = -65536
<flux->
./configure -cc 'gcc -m64' is apparently a step to the right direction
<flux->
I wonder if it's worth the trouble, though :)
<flux->
it will break the byte code compatibility, right?
<flux->
with 32-bit archs
pstickne has quit [Read error: 145 (Connection timed out)]
ramkrsna has quit [Read error: 113 (No route to host)]
ikaros has quit ["segfault"]
jlouis has joined #ocaml
<love-pingoo>
ppsmimou: I actually get the same...
<love-pingoo>
I meant land
<love-pingoo>
no
<love-pingoo>
I did a stupid simplification
<love-pingoo>
(-1 lxor 0xffff) lor 0xffff
<love-pingoo>
which is now trivial
pstickne has joined #ocaml
ramkrsna has joined #ocaml
ikaros_ has joined #ocaml
b00t has quit [Remote closed the connection]
pango_ has quit [Remote closed the connection]
pango has quit [Remote closed the connection]
pango has joined #ocaml
pango_ has joined #ocaml
cmvjk has quit [Read error: 110 (Connection timed out)]
cmvjk has joined #ocaml
diffbavis has joined #ocaml
postalchris has joined #ocaml
cwenner has joined #ocaml
cwenner has left #ocaml []
paciek has joined #ocaml
Submarine has quit ["Leaving"]
cjeris has joined #ocaml
Smerdyakov has joined #ocaml
<postalchris>
There's no string hash function in the standard library... what do you all do when you need one?
<Smerdyakov>
The generic hash function does _something_.
<postalchris>
You mean Hashtbl.hash?
<flux->
yes
<postalchris>
Stupid. I didn't look there...
<flux->
I recently tried to implement cuckoo hashing in ocaml, but it requires two different hashes, and I didn't manage to produce those with the standard hashing functinos..
<postalchris>
I've made that mistake in the past too... :-[
<flux->
and it's be pretty inconvenient to require the user to provide that
<flux->
s/s/d/
ocaml_newbie has joined #ocaml
<Smerdyakov>
Good, the expert is here now. You can ask him.
<ocaml_newbie>
Smerdyakov: What do you mean?
love-pingoo has quit ["Leaving"]
benny has joined #ocaml
<ocaml_newbie>
could someone please explain to me the package/module system of ocaml. i installed ounit which works fine (at least make test tells me so). how do i have to compile a simple file (e.g. test.ml) which only contains "open OUnit" and another line with assert_failure "some text"'
<ocaml_newbie>
if i run 'ocamlc test.ml', i will get a syntax error
<ocaml_newbie>
the open clause seems to be alright, but assert_failure produces the syntax error
<jeffs>
could you post it?
<ocaml_newbie>
open OUnit
<ocaml_newbie>
assert_failure "some text"
<ocaml_newbie>
that's all
<ocaml_newbie>
actually there's a new line between the both lines
<jeffs>
that's fine
<ocaml_newbie>
jeffs, should it work that easily by running 'ocamlc test.ml'?
<jeffs>
so you compile it something like....
<jeffs>
ocamlc ounit.cma test.ml ?
<jeffs>
i'm not sure what ounit is
<jeffs>
not that it matters, just as long as it's there
<ocaml_newbie>
i don't get it :-(
<ocaml_newbie>
what os are you using, jeffs?
<ocaml_newbie>
i'm using debian.
<jeffs>
right now i'm in windows, but i also use macos x
<ocaml_newbie>
if you install a library, how do you use that?
<ocaml_newbie>
or do you use the sources themselves?
<jeffs>
you can compile from either
benny_ has quit [Read error: 110 (Connection timed out)]
<jeffs>
try putting ;; after "open OUnit"
<jeffs>
open OUnit;; assert_failure "some text"
<jeffs>
well if the library is compiled and in my path I just do