systems changed the topic of #ocaml to: http://icfpcontest.cse.ogi.edu/ -- OCaml wins | http://www.ocaml.org/ | http://caml.inria.fr/oreilly-book/ | http://icfp2002.cs.brown.edu/ | SWIG now supports OCaml| Early releases of OCamlBDB and OCamlGettext are available | Caml Weekly news http://pauillac.inria.fr/~aschmitt/cwn/
mattam has quit ["zZz"]
__DL__ has quit [Read error: 104 (Connection reset by peer)]
Smerdyakov has quit ["br[?]b.... sharing phone line"]
docelic is now known as docelic|sleepo
Smerdyakov has joined #ocaml
stefp has quit [Read error: 110 (Connection timed out)]
Riastrad1 is now known as Riastradh
lsr has quit [Read error: 54 (Connection reset by peer)]
Vincenz has quit []
lament has joined #ocaml
lament has left #ocaml []
Smerdyakov has quit ["bye bye MackTheKnife"]
Kinners has joined #ocaml
kjs3 has joined #ocaml
Kinners has left #ocaml []
kjs3 has left #ocaml []
Yurik__ is now known as Yurik
firstein has joined #ocaml
wax has quit [Remote closed the connection]
wax has joined #ocaml
firstein_ has joined #ocaml
firstein has quit [Read error: 60 (Operation timed out)]
docelic|sleepo is now known as docelic|away
d-bug has joined #ocaml
Yurik_ has joined #ocaml
Yurik has quit [Read error: 104 (Connection reset by peer)]
Yurik_ is now known as Yurik
firstein__ has joined #ocaml
firstein_ has quit [Read error: 60 (Operation timed out)]
mattam has joined #ocaml
kosmikus has joined #ocaml
mattam_ has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
rhil has quit ["Lost terminal"]
rhil has joined #ocaml
karryall has quit ["brb"]
karryall has joined #ocaml
drlion_ has joined #ocaml
drlion has quit [Read error: 110 (Connection timed out)]
gene9 has joined #ocaml
docelic|away is now known as docelic
mrvn_ has joined #ocaml
drlion_ has quit [Read error: 110 (Connection timed out)]
mrvn has quit [Read error: 110 (Connection timed out)]
systems has joined #ocaml
systems has left #ocaml []
Riastradh has quit [calvino.freenode.net irc.freenode.net]
reltuk has quit [calvino.freenode.net irc.freenode.net]
Riastradh has joined #ocaml
Yurik_ has joined #ocaml
Yurik has quit [Read error: 54 (Connection reset by peer)]
reltuk has joined #ocaml
Smerdyakov has joined #ocaml
firstein_ has joined #ocaml
lus|wazze has joined #ocaml
docelic is now known as docelic|away
firstein__ has quit [Read error: 60 (Operation timed out)]
gorgias has joined #ocaml
<gorgias> Hi guys, I've got a question regarding Bigarray.maf_file: how do I unmap a file?
<Smerdyakov> I'm not familiar with this at all, but: if what that function does is return you an array of the file contents, I bet it's "unmapped" when that array is garbage collected.
gene9 has quit []
drlion has joined #ocaml
lus|wazze has quit ["Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Univ]
lus|wazze has joined #ocaml
__DL__ has joined #ocaml
d-bug has quit ["bye"]
<gorgias> Sorry Smerdyakov, for the delay
<gorgias> I just got a mail that needed quick answering (nonmaskable interrupt)
<gorgias> ;-)
<gorgias> In my case, garbage collected unmapping does not really help
<gorgias> I would like to map pages for an index structure on disk, and sometimes I will have to add pages
<gorgias> So I would like to unmap, add something to the file and than re-map
<Smerdyakov> You can't add something to the file while it's mapped?
<gorgias> Yes, I can,
<gorgias> but I would like the array to grow too
<gorgias> But your question is right
<gorgias> I should test more deeply before bothering this channel
stefp has joined #ocaml
<gorgias> I just hoped that someone had already run into that problem
<gorgias> and could give me a one-line-howto :-D
<Smerdyakov> I think one would hope that garbage collection would handle any problems like this.
<Smerdyakov> You should be able to map the same file twice and rely on GC to free memory if you go over a limit determined by some policy.
<gorgias> OK. I will test all that
<gorgias> I'll be back in some weeks (as I should really worry about getting the index going in the first place)
<gorgias> Cheers (gorgias trots off to tuareg)
Smerdyakov has quit ["eat"]
gorgias has quit ["Client exiting"]
<mrvn_> How do I mmap in ocaml?
<mrvn_> and more importantly how do I get the GC to allocate objects in an mmpaed region?
reltuk has quit []
karryall has quit ["tcho"]
<__DL__> mrvn : look to the bigarray library
<__DL__> but I don't believe you can do the last one...
firstein__ has joined #ocaml
Smerdyakov has joined #ocaml
phubuh has joined #ocaml
<phubuh> hey guys
<phubuh> what's most efficient for storing small (<100 elements) arrays of 32-bit integers? how about 8-bit?
<phubuh> the int32 types with friends are all warned to be slow and big, but i see no such warnings for bigarray
<lus|wazze> bigarrays are meant for doing just that
<lus|wazze> i would use strings for storing small amounts of 8-bit unsigned integers, i.e. bytes, though
<phubuh> ah, okay. thanks!
<phubuh> are int literals automatically converted to int32 when used as such?
<lus|wazze> nope
<lus|wazze> you have to use Int32.of_int
<phubuh> oh, okay
firstein_ has quit [Connection timed out]
<phubuh> ugh. i want a bigarray of unsigned int32s :/
<lus|wazze> ah yes the usage of the bigarray library can be a bit confusing at first
<phubuh> yeah :)
<lus|wazze> # Array1.create;;
<lus|wazze> - : ('a, 'b) Bigarray.kind ->
<lus|wazze> 'c Bigarray.layout -> int -> ('a, 'b, 'c) Bigarray.Array1.t
<lus|wazze> ok the kind argument specifies the element type
<phubuh> yeah, but there is no int32_unsigned
<lus|wazze> there are several predefined constants for this in the Bigarray module
<lus|wazze> ah
<lus|wazze> yes int32`s are always signed
<lus|wazze> hm
<lus|wazze> as int32`s are supposed to be in 2's complement form anyway it shouldn't make a difference except for multiplication
<lus|wazze> yeah there is no unsigned int32 type so there is accordingly no such bigarray member type :(
docelic|away is now known as docelic
<mrvn_> Why not just use ints? Thats only 50% waste.
<mrvn_> And way faster and comforatble than Int32
<mrvn_> .oO( Or do you ahve one of those old 32 Bit cpus with tiny ints? )
<phubuh> i was going to implement sha1, which would be very ugly without 32 bit integers
<mrvn_> phubuh: don't, use openssl
<phubuh> oh, there's an o'caml binding? does openssl have sha1?
<mrvn_> Message Digest commands (see the `dgst' command for more details)
<mrvn_> md2 md4 md5 rmd160 sha
<mrvn_> sha1
<mrvn_> phubuh: Its way easier tpo make ocaml bindings for openssl than to implement sha1.
<phubuh> heh.
<mrvn_> And send them my way when you have them. I'm going to need them too.
kosmikus has quit ["leaving"]
systems has joined #ocaml
docelic has quit ["Client Exiting"]
docelic has joined #ocaml
mattam_ is now known as mattam
systems has quit ["Client Exiting"]
Smerdyakov has quit ["I am gone!"]
<mrvn_> Whats the best way to test a Hashtbl for emptyness?
systems has joined #ocaml
<Riastradh> mrvn, perhaps: let hashtbl_empty = Hashtbl.fold (fun _ _ _ -> false) true
<mattam> i'd say its the most elegant way currently
<Riastradh> I don't think it's that inelegant, anyways.
giedi has joined #ocaml
Smerdyakov has joined #ocaml
lus|wazze has quit ["Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Univ]
systems has left #ocaml []
<mrvn_> let hashtbl_empty tbl = try Hashtbl.fold (fun _ _ _ -> raise Non_empty) tbl true with Non_empty -> false
<mrvn_> Does that look ok?
<Riastradh> Why don't you use my solution?
<mrvn_> Hashtbl.fold takes too long for full hashtables without the raise.
<Riastradh> I suppose.
<Riastradh> ...this is where call/cc would make things clearer!
<Riastradh> Cleaner, even.
<mrvn_> And I'm talking about 100K - 10M elements.
<Riastradh> Yes, I see.
<Smerdyakov> Cleaner still would be a function in Hashtbl to check for emptyness....
<Riastradh> Well, yeah, but it'd be nice in general to have call/cc, too.
<mrvn_> Riastradh: I miss that quite a lot
<Smerdyakov> Maybe, but it's hella painful to implement it efficiently.
<mrvn_> Smerdyakov: You only have to drop the concept of a Stack.
<Riastradh> CPS!
<Riastradh> With CPS, all calls become tail-recursive, too.
<mrvn_> The bigger problem with call/cc is type safety but there are papers written about that.
<Smerdyakov> mrvn_, ..., which is hard to implement efficiently.
<Riastradh> Type safety? CPS-transform it, and then the types will be as ordinary function types.
<mrvn_> Riastradh: How do you optimize currying with CPS transformed code?
<Riastradh> Oh.
* Riastradh forgot about currying.
<Riastradh> Damn.
<mrvn_> Riastradh: CPS is easily curried but you want uncurried functions when possible for speed reasons.
<mrvn_> You have to not CPS local loops and functions.
<Riastradh> ...but what if they use call/cc?
<mrvn_> Riastradh: And as for type safety call/cc can mix up types between the save and the restorce of the call/cc if your not carefull.
<Smerdyakov> SML/NJ has a quite safe callcc.
<mrvn_> Riastradh: call/cc function calls aren't local
<Smerdyakov> But it doesn't use stacks and produces much slower code than MLton or OCaml.
<Riastradh> Or you could have a call/cc1 -- single-shot, only non-local exit, continuations.
<Riastradh> Those are much easier to optimize.
<Riastradh> And they'd work for a hashtbl_empty function.
<Riastradh> As well as many other places in which one might use call/cc.
<mrvn_> Nah, you just count the number of inserts and removes to a hashtbl and if it zeroes out its empty.
<mrvn_> Hashtbl probably already counts them so it can resize when needed.
<Riastradh> It's odd that there isn't even a size function in Hashtbl.
<Smerdyakov> Well, it's quite easy to write your own version tha keeps track.
<mrvn_> Hastbl seems to have empty slots. Should size return the real size or the used size?
d-bugd has joined #ocaml
<Riastradh> The used size.
<mrvn_> I probably need a different datastructure anyway.
<Riastradh> Though there might also be a real size function.
<mrvn_> I have mappings from (a, b) -> c and I need to keep record of the maximum c for each (a, b) that appeared.
<mrvn_> It would also be nice if I could iterate fast over all (a, _) keys for a given a.
<mrvn_> Is there anything prebuild that would do that?
firstein_ has joined #ocaml
firstein__ has quit [Read error: 60 (Operation timed out)]
rhil has quit [Read error: 110 (Connection timed out)]
jao has joined #ocaml
d-bugd has quit ["night folks"]
docelic has quit [Read error: 110 (Connection timed out)]
simon_ has joined #ocaml
docelic has joined #ocaml
Slackwarrior has joined #ocaml
karryall has joined #ocaml
<Slackwarrior> hello
<Smerdyakov> Welcome.
TachYon has joined #ocaml
rhil has joined #ocaml
firstein_ has quit [Read error: 60 (Operation timed out)]
firstein_ has joined #ocaml
simon_ has quit ["No Reason"]
mrvn_ is now known as mrvn
giedi has quit ["Client exiting"]
Smerdyakov has quit ["reconnect"]
Smerdyakov has joined #ocaml
Smerdyakov has quit ["I'm in 0!"]
async has quit [calvino.freenode.net irc.freenode.net]
liyang has quit [calvino.freenode.net irc.freenode.net]
firstein__ has joined #ocaml
liyang has joined #ocaml
async has joined #ocaml
async has quit [calvino.freenode.net irc.freenode.net]
async has joined #ocaml
firstein_ has quit [Success]
TachYon has quit ["Client Exiting"]
jao has quit ["leaving"]
Smerdyakov has joined #ocaml