slipstream-- has quit [Remote closed the connection]
<m3ga>
joelr1 : nice!
slipstream has joined #ocaml
asbeta has joined #ocaml
mnemonic has joined #ocaml
holo has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
mnemonic has quit [Read error: 110 (Connection timed out)]
Itkovian has joined #ocaml
Itkovian has quit []
slipstream has quit [Remote closed the connection]
Itkovian has joined #ocaml
slipstream has joined #ocaml
holo has left #ocaml []
Itkovian has quit []
slipstream-- has joined #ocaml
slipstream-- has quit [Client Quit]
slipstream has quit ["leaving"]
slipstream has joined #ocaml
Itkovian has joined #ocaml
slipstream has quit ["leaving"]
rillig has joined #ocaml
slipstream has joined #ocaml
Smerdyakov has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
Itkovian has quit []
finelemo1 has joined #ocaml
finelemon has quit [Read error: 110 (Connection timed out)]
svref has joined #ocaml
<svref>
I'm debugging. How do I print a list of objects?
<svref>
(yes, I'm sooper newbie)
Itkovian has joined #ocaml
<pango>
svref: print from toplevel, debugger, or printing from the program itself ?
<svref>
the program itself, e.g. function isn't doing what I want, I want to print out a list halfway through to see what its thinking about
<svref>
like in LISP, you can just call (print X), and it doesn't matter the type of X, it just gets printed.
<zmdkrbou>
ocaml *cares* for types :)
<svref>
Allright, what does the toplevel call after you tell it something? That's what I wanna call.
<zmdkrbou>
you can try with the Marshal module
<pango>
compiled programs don't contain the toplevel
<svref>
I can arrange to call my buggy function through the toplevel, too. :)
dmitri83 has joined #ocaml
<dmitri83>
hello
<svref>
hi
<pango>
toplevel seems to know how to print objects' signature, but probably not value (never used objects...)
<pango>
# object method x = "hello" end ;;
<pango>
- : < x : string > = <obj>
<dmitri83>
I am a newbie in ocaml, could anybody tell me whether there is an unsigned 32-bit integer type in ocaml?
<zmdkrbou>
yep
<zmdkrbou>
module Int32
<pango>
dmitri83: there's no unsigned type
<zmdkrbou>
oups
<dylan>
I thought int32 was signed
<zmdkrbou>
unsigned :p
<zmdkrbou>
my mistake
<dmitri83>
no, i tried it, it's signed :)
<dmitri83>
so, what should I do? :/
<zmdkrbou>
dmitri83: but you can do unsigned arthmetic with the signed module
<zmdkrbou>
other solution is to bind with C :)
<svref>
pango: surely there's a method I can define on my objects that changes the way they print, right? :)
<dylan>
or use a int64 and write a wrapper to emulate unsigned 32bit
<pango>
svref: yes, call it print or display ;)
<dmitri83>
dylan: that was my first thought
<dmitri83>
dylan: but that's very space-inefficient
<dmitri83>
dylan: I have big arrays of 32-bit uints
<dylan>
Only on 32bit machines, right?
<zmdkrbou>
dmitri83: the most efficient way is to bind to C
<dmitri83>
and what if I define a new type -- a vector of booleans --- and define arithmetical operations on it?
<svref>
what's the shortest expression to test if a list is empty?
<dmitri83>
would a vector of booleans of length 32 occupy 4 bytes?
<zmdkrbou>
dmitri83: this won't be efficient at all :)
<zmdkrbou>
i don't think so
<pango>
svref: there's no predefined method, so you're free to make one
<pango>
svref: then List.map (fun o -> o#print) objects
<pango>
List.iter even
<pango>
dmitri83: each boolean will use a word, but you can use Bitv module (see ocaml hump)
<pango>
svref: e = []
<svref>
ah...well the tutorials never say that! ;)
<pango>
dmitri83: but indeed it will be much slower
<dmitri83>
pango: ... than using int64
<svref>
dmitri83: can I intrest you in some 30-bit unsigned ints?
<pango>
dmitri83: even if int64s are not blazing fast, they'll probably be much faster than doing your own arithmetic on bit vectors :)
<dmitri83>
svref: no, I need 32-bit uints
<dmitri83>
pango: anyway, thanks for the ref to Bitv
<pango>
dmitri83: in fact 32 bits values are difficult to get efficiently in ocaml :/
<zmdkrbou>
dmitri83: you can use Int32 and make wrappers to have unsigned 32bis arithmetic
<zmdkrbou>
so you'll use exactly 32bits
* pango
nods
<zmdkrbou>
you just have to take care of some cases, i think
<svref>
(by the way, if Ocaml is so incredibly strongly typed, why does it need a 1-bit tag for everything?)
<pango>
svref: for gc
<dylan>
and for efficient unboxed types
<pango>
svref: gc being unaware of types (well, only basic types) has proven to be more efficient
<svref>
hm...
<dmitri83>
what's this 1-bit tags business?
<dmitri83>
my signed int32-s actually take 5 bytes??!
<svref>
prolly more like 8 bytes
<dmitri83>
omg
<pango>
dmitri83: prolly more like 12 bytes, at best
<dylan>
omg ponies!
<svref>
If you're lucky, then that's not the case when they're stored in arrays
<dmitri83>
and if I have a vector of them
<dmitri83>
?
<dmitri83>
ah
<pango>
svref: mmh why not ?
<svref>
Well I don't know about ocaml, but in LISP good implementations store the type of the array in the array header, so that they don't have to box the array contents.
<pango>
svref: ocaml only does that in few specific cases (arrays of floats, mainly)