mfp changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.11.2 released | Inscription for OCaml Meeting 2010 is opened http://wiki.cocan.org/events/europe/ocamlmeetingparis2010
fraggle_ has joined #ocaml
bmp has quit [Ping timeout: 268 seconds]
bmp has joined #ocaml
myu2 has quit [Remote host closed the connection]
Modius_ has quit [Ping timeout: 276 seconds]
fraggle_ has quit [Ping timeout: 248 seconds]
myu2 has joined #ocaml
fraggle_ has joined #ocaml
jakedouglas has quit [Quit: Leaving.]
myu2 has quit [Remote host closed the connection]
jakedouglas has joined #ocaml
middayc has joined #ocaml
middayc has quit [Client Quit]
middayc has joined #ocaml
middayc has quit [Client Quit]
myu2 has joined #ocaml
<rovar_> isn't there a way to treat a var as a constant in a pattern?
Tianon has quit [Quit: going down]
myu2 has quit [Remote host closed the connection]
bmp has quit [Remote host closed the connection]
bmp has joined #ocaml
elehack has joined #ocaml
myu2 has joined #ocaml
fraggle_ has quit [Ping timeout: 240 seconds]
fraggle_ has joined #ocaml
myu2 has quit [Remote host closed the connection]
maskd has quit [Quit: leaving]
caligula_ has joined #ocaml
fraggle_ has quit [Ping timeout: 248 seconds]
caligula__ has quit [Ping timeout: 264 seconds]
fraggle_ has joined #ocaml
myu2 has joined #ocaml
fraggle_ has quit [Ping timeout: 260 seconds]
elehack has left #ocaml []
fraggle_ has joined #ocaml
Morphous has quit [Ping timeout: 245 seconds]
fraggle_ has quit [Ping timeout: 276 seconds]
fraggle_ has joined #ocaml
fraggle_ has quit [Ping timeout: 260 seconds]
fraggle_ has joined #ocaml
Morphous has joined #ocaml
rovar_ has quit [Ping timeout: 265 seconds]
fraggle_ has quit [Ping timeout: 240 seconds]
fraggle_ has joined #ocaml
fraggle_ has quit [Ping timeout: 260 seconds]
segmond has quit [Ping timeout: 252 seconds]
fraggle_ has joined #ocaml
fraggle_ has quit [Ping timeout: 240 seconds]
fraggle_ has joined #ocaml
Mr_Awesome has quit [Ping timeout: 265 seconds]
fraggle_ has quit [Ping timeout: 240 seconds]
valross has joined #ocaml
fraggle_ has joined #ocaml
enthymeme has joined #ocaml
fraggle_ has quit [Ping timeout: 276 seconds]
fraggle_ has joined #ocaml
Mr_Awesome has joined #ocaml
joewilliams is now known as joewilliams_away
fraggle_ has quit [Ping timeout: 240 seconds]
fraggle_ has joined #ocaml
myu2 has quit [Remote host closed the connection]
Associat0r has quit [Quit: Associat0r]
jeddhaberstro has quit [Quit: jeddhaberstro]
fraggle_ has quit [Ping timeout: 276 seconds]
fraggle_ has joined #ocaml
myu2 has joined #ocaml
fraggle_ has quit [Ping timeout: 248 seconds]
fraggle_ has joined #ocaml
fraggle_ has quit [Ping timeout: 248 seconds]
bmp has quit [Quit: bmp]
amadan has joined #ocaml
fraggle_ has joined #ocaml
<amadan> Hi, can someone help me with existential types?
bmp has joined #ocaml
bmp has quit [Quit: bmp]
fraggle_ has quit [Ping timeout: 276 seconds]
fraggle_ has joined #ocaml
fraggle_ has quit [Ping timeout: 276 seconds]
jonafan_ has joined #ocaml
fraggle_ has joined #ocaml
jonafan has quit [Ping timeout: 240 seconds]
fraggle_ has quit [Ping timeout: 240 seconds]
fraggle_ has joined #ocaml
fraggle_ has quit [Ping timeout: 248 seconds]
fraggle_ has joined #ocaml
ulfdoz has quit [Quit: reboot]
fraggle_ has quit [Ping timeout: 276 seconds]
fraggle_ has joined #ocaml
mattam has quit [Ping timeout: 248 seconds]
ulfdoz has joined #ocaml
fraggle_ has quit [Ping timeout: 248 seconds]
fraggle_ has joined #ocaml
fraggle_ has quit [Ping timeout: 260 seconds]
fraggle_ has joined #ocaml
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
amadan has quit [Quit: amadan]
fraggle_ has quit [Ping timeout: 276 seconds]
fraggle_ has joined #ocaml
fraggle_ has quit [Ping timeout: 276 seconds]
fraggle_ has joined #ocaml
marteo has joined #ocaml
fraggle_ has quit [Ping timeout: 240 seconds]
myu2 has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
enthymeme has joined #ocaml
ulfdoz has quit [Ping timeout: 248 seconds]
fraggle_ has quit [Ping timeout: 276 seconds]
fraggle_ has joined #ocaml
ygrek has joined #ocaml
fraggle_ has quit [Ping timeout: 240 seconds]
fraggle_ has joined #ocaml
Submarine has quit [Quit: Leaving]
myu2 has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
myu2 has quit [Remote host closed the connection]
myu2 has joined #ocaml
jakedouglas has quit [Quit: Leaving.]
mutew has joined #ocaml
mutew has left #ocaml []
ttamttam has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
fraggle_ has quit [Ping timeout: 276 seconds]
fraggle_ has joined #ocaml
ygrek has joined #ocaml
ttamttam1 has joined #ocaml
ttamttam has quit [Ping timeout: 276 seconds]
valross has quit [Ping timeout: 248 seconds]
ftrvxmtrx_ has joined #ocaml
avsm1 has quit [Quit: Leaving.]
Submarine has joined #ocaml
valross has joined #ocaml
pimmhogeling has joined #ocaml
Yoric has joined #ocaml
f[x] has joined #ocaml
seafood has joined #ocaml
avsm has joined #ocaml
valross has quit [Ping timeout: 240 seconds]
avsm1 has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
lvillani has joined #ocaml
Associat0r has joined #ocaml
ikaros has joined #ocaml
lvillani_ has joined #ocaml
lvillani_ has quit [Remote host closed the connection]
valross has joined #ocaml
sepp2k has joined #ocaml
oc13 has joined #ocaml
th5 has joined #ocaml
myu2 has quit [Remote host closed the connection]
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
thomasga has quit [Quit: Leaving.]
barismetin has joined #ocaml
munga_ has joined #ocaml
spearalot has joined #ocaml
adrien has quit [Quit: leaving]
_unK has joined #ocaml
adrien has joined #ocaml
munga_ has quit [Ping timeout: 246 seconds]
myu2 has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
valross has quit [Quit: Ex-Chat]
mbishop_ has joined #ocaml
Gooffy has joined #ocaml
mbishop has quit [Ping timeout: 265 seconds]
ttamttam1 has quit [Quit: Leaving.]
myu2 has quit [Remote host closed the connection]
pimmhogeling has quit [Ping timeout: 265 seconds]
myu2 has joined #ocaml
avsm has joined #ocaml
avsm1 has quit [Ping timeout: 264 seconds]
pimmhogeling has joined #ocaml
Asmadeus has quit [Remote host closed the connection]
ttamttam has joined #ocaml
M| has quit [Ping timeout: 260 seconds]
M| has joined #ocaml
rwmjones has quit [Ping timeout: 245 seconds]
_andre has joined #ocaml
myu2 has quit [Remote host closed the connection]
rwmjones has joined #ocaml
boscop has joined #ocaml
ikaros has joined #ocaml
ftrvxmtrx_ has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
barismetin has quit [Quit: Leaving...]
barismetin has joined #ocaml
_unK has quit [Remote host closed the connection]
fraggle_ has quit [Ping timeout: 268 seconds]
spearalot has quit [Quit: -arividerchi]
fraggle_ has joined #ocaml
bmp has joined #ocaml
<thelema> rovar: match foo with [x] when x == y -> ...
segmond has joined #ocaml
<companion_cube> is there something as handy as haskell's show typeclass, to print easily various types ?
<Gooffy> print from Batteries maybe useful
<companion_cube> i'm using standard ocaml lib :/
<companion_cube> seems that this kind of things is easier in haskell...
<companion_cube> but thanks
<Gooffy> so, i think you may emulate type classes by implicit pass dictionary with functions, and maybe this already done by somebody else with camlp4 syntax extension :)
_unK has joined #ocaml
<companion_cube> wow, seems overkill in my case :)
<companion_cube> i'm just going to stick with basic stuff
<Gooffy> so, i recommend install batteries -- this package contains many function similliar to haskell's Prelude
<Gooffy> (yes, my english is bad :) )
<companion_cube> maybe i'll give it a try, then :)
<companion_cube> (and i'm not a native speaker either)
<Gooffy> so, thanks to google translate :)
<companion_cube> :D
bmp has quit [Quit: bmp]
Asmadeus has joined #ocaml
fraggle_laptop has joined #ocaml
pimmhogeling has quit [Ping timeout: 245 seconds]
ccasin has joined #ocaml
derdon has joined #ocaml
smimou has quit [Ping timeout: 246 seconds]
smimou has joined #ocaml
boscop has quit [Ping timeout: 260 seconds]
boscop has joined #ocaml
sepp2k has quit [Remote host closed the connection]
marteo has quit [Quit: Debian GNU/Hurd is Good.]
drk-sd has quit [Quit: coming back]
drk-sd has joined #ocaml
jimmyb2187 has left #ocaml []
<thelema> companion_cube: can't do a print like that - code doesn't have access to the inferred types in any way.
<companion_cube> and i think ocaml cannot handle forall 'a. 'a -> string types ?
seafood has quit [Quit: seafood]
<f[x]> sure it can (but that's not what you want apparently)
<f[x]> # let x = object method test : 'a . 'a -> string = fun _ -> "oops" end;;
<f[x]> val x : < test : 'a. 'a -> string > = <obj>
<f[x]> # x#test 2, x#test ();;
<f[x]> - : string * string = ("oops", "oops")
lvillani has left #ocaml []
<companion_cube> yeah, but this is kind of a hack :)
fraggle_laptop has quit [Ping timeout: 276 seconds]
<flux> companion_cube, what is hack about it? btw, 3.12 will support that for plain functions as well
<companion_cube> this is cool
<companion_cube> 3.12 seems to add a lot of features
smimou has quit [Ping timeout: 246 seconds]
smimou has joined #ocaml
pimmhogeling has joined #ocaml
avsm has quit [Quit: Leaving.]
<thelema> companion_cube: there's a bunch of little things that are getting fleshed in for 3.12
fraggle_laptop has joined #ocaml
pimmhogeling has quit [Ping timeout: 265 seconds]
jonafan_ is now known as jonafan
mattam has joined #ocaml
joewilliams_away is now known as joewilliams
Gooffy has quit [Quit: Leaving.]
pimmhogeling has joined #ocaml
jakedouglas has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
barismetin has quit [Quit: Leaving...]
f[x] has quit [Ping timeout: 260 seconds]
matthieu has quit [Remote host closed the connection]
bitbckt has joined #ocaml
ttamttam has quit [Quit: Leaving.]
jimmyb2187 has joined #ocaml
th5 has quit [Quit: th5]
drk-sd has quit [Quit: dodo]
Yoric has quit [Quit: Yoric]
jakedouglas has quit [Quit: Leaving.]
adrien_ has joined #ocaml
rwmjones has quit [*.net *.split]
adrien has quit [*.net *.split]
adrien_ is now known as adrien
rwmjones has joined #ocaml
ulfdoz has joined #ocaml
jakedouglas has joined #ocaml
Submarine has quit [Ping timeout: 248 seconds]
Yoric has joined #ocaml
derdon has quit [Quit: leaving]
M| has quit [Ping timeout: 248 seconds]
M| has joined #ocaml
mbishop_ has quit [Ping timeout: 240 seconds]
Submarine has joined #ocaml
mbishop_ has joined #ocaml
mbishop_ is now known as mbishop
seg_ has joined #ocaml
segmond has quit [Ping timeout: 260 seconds]
Asmadeus_ has joined #ocaml
Asmadeus_ has quit [Client Quit]
joewilliams is now known as joewilliams_away
jakedouglas has quit [Quit: Leaving.]
ccasin has quit [Quit: Leaving]
oc13 has quit [Ping timeout: 252 seconds]
jakedouglas has joined #ocaml
joewilliams_away is now known as joewilliams
ftrvxmtrx has joined #ocaml
sepp2k has joined #ocaml
itewsh has joined #ocaml
Lor has joined #ocaml
_andre has quit [Quit: leaving]
<Lor> Hi folks. Anyone happen to know a splittable (a la Haskell's Random.split) prng for ocaml?
<mfp> splittable?
<Lor> You can split the state of the PRNG into two (or more) so that each new state can produce an independent stream of random numbers.
<Lor> The "independent" bit is the hard one. If you don't care about that, it's pretty trivial to implement.
<mfp> ic, you don't want to get the orig PRNG when you split twice, right?
<Lor> Right.
<Lor> This should be doable thousands of times.
<Lor> I think it's sufficient if the PRNG just supports an "add some bits of entropy into the state" operation.
<Lor> Then you can split by adding a single bit of 0 and 1.
<mfp> so it doesn't have to be pure?
<mfp> I mean, is it OK to alter the state using entropy from /dev/urandom, or should [split prng] always return the same PRNGs?
<Lor> Yeah, this should be completely deterministic.
<Lor> I don't see how any of this would make any sense otherwise.
<Lor> Obviously I can implement this from the scratch if needed.
<Lor> Or I can do a horrible hack and just reseed with a random number that has been mangled in various ways.
<hcarty> Lor: GSL provides a variety of PRNG schemes. I don't know how splittable any of them are though.
<thelema> Lor: is your program multithreaded?
<Lor> Parallelization is my primary motivation in this particular case, yes.
<thelema> so you want one PRNG per thread
<Lor> No.
<thelema> then I don't get it - why wouldn't the get_state/set_state interface be sufficient?
<thelema> or more specifically the Random.State submodule with explicit state management
<Lor> I have a parallelizable job, and each part of the parallelizable job involves random number generation.
<Lor> I want to do this in a reproducible (i.e. deterministic) fashion.
pimmhogeling has quit [Ping timeout: 265 seconds]
<Lor> Independent of the number of threads.
<thelema> I don't see how even split would help with that - wouldn't splitting n times give different streams than splitting n+1 times?
<Lor> So, the job can be split into 1000 parts, and depending on the situation, all parts might be completed by a single thread, or each by its own thread.
<thelema> streams of prandom numbers
<thelema> ah, so the number of parts the job is split into is constant
<thelema> or at least it only has to be deterministic over that number of parts
<Lor> Yes. But the way they are distributed into threads, or processes, or nodes, is not.
<thelema> then give each part its own random state.
<Lor> That's what I'm trying to do. :)
<Lor> But how do I get such a random state for each part?
<Lor> It has to depend on the previous random state that the program is in before the parallilizable part starts.
<thelema> one way would be to init the global generator with a fixed seed, and use the first 1000 numbers to seed the individual generators
<thelema> just the next n values out of the global generator as seeds for the individual generators
<Lor> Yeah, that's the "horrible hack".
<Lor> It's possible, but there's no guarantees anything pretty comes out of it.
<Lor> For instance, suppose that the prn that comes out from the generator is actually its new state in its entirety.
<Lor> Then each of those 1000 new prngs would produce exactly the same numbers, only with different offsets.
<Lor> Obviously ocaml's built-in prng isn't this bad, but funny stuff like this can happen if you aren't careful.
<Lor> If I were to do this, I'd at least take quite a few more numbers to use as a seed.
<Lor> A single 30-bit int wouldn't work very well.
M| has quit [Ping timeout: 252 seconds]
<gildor> Lor: the OCaml PRNG (Random module) doesn't have this property, unfortunately
<Lor> Which property?
<gildor> (the splttable property)
<Lor> Yes, right.
<Lor> What I can do is generate a gazillion bits, and then use half of them as one seed and half of them as another seed.
<gildor> it is actually your best option, indeed
<Lor> Not very efficient, though.
<Lor> (Random.full_init does an MD5 digest for each byte of the seed...)
<Lor> Sorry, each int of the seed.
<gildor> Lor: how many bits will you generate with each of your PRNG ?
<Lor> No idea at this point.
<gildor> you will need to find a balance between generate a lot of PRNG and a lot of data to see your PRNG
<gildor> you need to generate more than 55 * 31 bits with each PRNG
<Lor> Well, I should be having big enough jobs for each prng that the initial seeding shouldn't have a significant effect on the overall performance.
<gildor> on the other hand, you can use ocaml-fastrandom to generate your Random state
munga_ has joined #ocaml
<gildor> there is a FAstRandom.skip to go directly to a a certain point
rovar has quit [Quit: Page closed]
<Lor> What's that?
<Lor> Quick googling doesn't reveal anything.
<gildor> this is the PRNG of OCaml but written in C
<gildor> probably because it is only sitting on my computer ;-)
<Lor> Aahaa.
<gildor> but this is only 3 times faster than OCaml PRNG
<gildor> which is the reason why I don't yet have published it
<Lor> I'm not sure if ocaml's standard prng is so great that it's worth optimizing.
<gildor> I would like to make it faster
<Lor> Of course for some people it's important to be able to reproduce the standard prng's behavior exactly.
<gildor> this is a part of the optimization for parallelizing a data generator base on OCaml PRNG
<gildor> I need to output the same number to be able to generate the same file
<gildor> Interested ?
<gildor> (by its publication)
<Lor> Not really at this point.
<gildor> ok
<Lor> I don't envision any serious performance issues, and I'd rather avoid extra library dependencies.
<Lor> But thanks anyway.
<Lor> Hm. There seems to be some work on jumping forward in a stream of random numbers, but to me that seems of very limited use. Then you only have a finite number of numbers that you can generate from a substream.
<gildor> but I write down the Random.split URL
<gildor> I will probably implement it
<Lor> Can you implement it in a way that produces good prngs?
<gildor> When I will have read the article in the references section, I will answer you ;-)
<Lor> Look at the comment in the definition of stdSplit
ulfdoz has quit [Read error: Operation timed out]
<Lor> gawd, I hadn't realized how utterly simple ocaml's prng is.
<thelema> insufficiently complex for you?
<Lor> :D
<Lor> It just looks like it could lead to all kinds of trouble.
<gildor> Lor: I am not sure to see the comment you are talking about
<thelema> ah, the new code isn't public.
<thelema> err, hasn't been released
<thelema> It was updated just recently to deal with the "simpleness" issue
<Lor> Uh, they are replacing the standard rng with another one?
<thelema> yes.
Yoric has quit [Quit: Yoric]
<Lor> Won't that lead to compatibility issues, since outputs produced with earlier versions are no longer reproducible?
<thelema> only if that was an important thing to keep backwards compatibility on.
<gildor> thelema: well it was for me :(
<Lor> I thought that was the entire... echo.
M| has joined #ocaml
<thelema> I'm sure the loss of backwards compatibility will be mourned by very few, who will be forced to copy the old random.ml into theoir source tree.
<Lor> Why such a minor update, if compatibility is to be broken?
<Lor> Why not switch to mersenne twister or something?
fraggle_ has quit [Ping timeout: 276 seconds]
fraggle_ has joined #ocaml
avsm has joined #ocaml
derdon has joined #ocaml
<derdon> hello
<derdon> I installed ocaml-batteries in ubuntu 10.04 with apt-get
<derdon> but confusingly I cannot access BatStack.create
<derdon> why?
<thelema> derdon: what version of batteries?
Leonidas has quit [*.net *.split]
jlouis has quit [*.net *.split]
schme has quit [*.net *.split]
gildor has quit [*.net *.split]
hyperboreean has quit [*.net *.split]
haelix_ has quit [*.net *.split]
sgnb has quit [*.net *.split]
Ori_B has quit [*.net *.split]
<derdon> thelema: 1.1.0-1
ygrek has quit [Ping timeout: 245 seconds]
<thelema> can you access other batteries stuff?
<derdon> I'll try
Leonidas has joined #ocaml
jlouis has joined #ocaml
schme has joined #ocaml
gildor has joined #ocaml
hyperboreean has joined #ocaml
haelix_ has joined #ocaml
Ori_B has joined #ocaml
sgnb has joined #ocaml
schme has quit [Ping timeout: 276 seconds]
<derdon> thelema: nope, doesn't work either
schme has joined #ocaml
<thelema> ok, does [ocaml] load the batteries banner?
<derdon> no
<derdon> it only says the ocaml version
<derdon> 3.11.2
<thelema> ok. how are you compiling?
itewsh has quit [Quit: There are only 10 kinds of people: those who understand binary and those who don't]
<derdon> thelema: im simply created a *.ml file and evaluated it with ``ocaml myfile.ml``
boscop_ has joined #ocaml
<thelema> try putting the ocamlinit file into your ~/.ocamlinit file
<thelema> good. After that, you should be able to access batteries in the toplevel
boscop has quit [Ping timeout: 240 seconds]
<derdon> ``BatStack.create ();;`` fails
<derdon> "Error: unbound value BatStack.create"
boscop__ has joined #ocaml
jeddhaberstro has joined #ocaml
<derdon> BatRandom does work?!
<derdon> strange
<derdon> BatStack.print works too
boscop has joined #ocaml
boscop_ has quit [Ping timeout: 245 seconds]
<derdon> but not BatStack.create
munga_ has quit [Ping timeout: 264 seconds]
<derdon> thelema: what do I have to write into the *.ml files?
boscop__ has quit [Ping timeout: 276 seconds]
pimmhogeling has joined #ocaml
<thelema> don't use the Bat* modules directly, just use Stack.create
<thelema> BatStack only contains the new functions
<thelema> you should put that code in your ~/.ocamlinit, and the toplevel will auto-load batteries
<thelema> to compile, use [ocamlfind ocamlc -package batteries,threads -linkpkg foo.ml -o foo] or use a ocamlfind-enabled myocamlbuild.ml with ocamlbuild
<derdon> thelema: ~/.ocamlinit is folder containing all the *.ml files which use the batteries?
seafood has joined #ocaml
<derdon> anyway, have to to bed now. bye!
derdon has quit [Read error: Operation timed out]
joewilliams is now known as joewilliams_away
fraggle_laptop has quit [Ping timeout: 260 seconds]
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 264 seconds]
fraggle_laptop has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
bmp has joined #ocaml
bmp has quit [Client Quit]
dark has joined #ocaml