gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
lamawithonel_ has quit [Read error: Connection reset by peer]
lopex has quit []
lamawithonel_ has joined #ocaml
lamawithonel_ has quit [Read error: Connection reset by peer]
lamawithonel_ has joined #ocaml
iratsu has joined #ocaml
lamawithonel_ has quit [Read error: Connection reset by peer]
lamawithonel_ has joined #ocaml
<thelema> does anyone have ideas about the relative costs of calling implicit vs. explicit closures?
<thelema> implicit closures = nested functions
sepp2k has quit [Quit: Leaving.]
lamawithonel_ has quit [Ping timeout: 255 seconds]
iratsu has quit [Quit: Leaving.]
ftrvxmtrx has joined #ocaml
lamawithonel_ has joined #ocaml
khia0 has joined #ocaml
khia0 has left #ocaml []
ztfw has quit [Remote host closed the connection]
lamawithonel_ has quit [Read error: Connection reset by peer]
lamawithonel_ has joined #ocaml
othiym23 has quit [Quit: Linkinus - http://linkinus.com]
lamawithonel_ has quit [Read error: Connection reset by peer]
lamawithonel_ has joined #ocaml
iratsu has joined #ocaml
jamii has quit [Ping timeout: 258 seconds]
lamawithonel_ has quit [Ping timeout: 255 seconds]
joewilliams is now known as joewilliams_away
jamii has joined #ocaml
ulfdoz has joined #ocaml
dnolen_ has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
jamii has quit [Ping timeout: 276 seconds]
larhat has joined #ocaml
larhat1 has joined #ocaml
larhat has quit [Ping timeout: 250 seconds]
edwin has joined #ocaml
bobry1 has joined #ocaml
dnolen_ has quit [Quit: dnolen_]
thomasga has joined #ocaml
StepanKuzmin has joined #ocaml
ikaros has joined #ocaml
ftrvxmtrx has quit [Quit: This computer has gone to sleep]
ikaros has quit [Quit: Ex-Chat]
StepanKuzmin has quit [Read error: Connection reset by peer]
StepanKuzmin has joined #ocaml
ikaros has joined #ocaml
Julien_away is now known as Julien_t
Amorphous has quit [Ping timeout: 240 seconds]
ftrvxmtrx has joined #ocaml
avsm has joined #ocaml
alpounet has quit [Ping timeout: 255 seconds]
rgee has quit [Read error: Connection reset by peer]
clog has quit [Ping timeout: 255 seconds]
clog_ has joined #ocaml
lopex has joined #ocaml
ikaros_ has joined #ocaml
StepanKuzmin has quit [Read error: Connection reset by peer]
clog has quit [Ping timeout: 255 seconds]
ikaros has quit [Ping timeout: 255 seconds]
StepanKuzmin has joined #ocaml
StepanKuzmin has quit [Read error: Connection reset by peer]
StepanKuzmin has joined #ocaml
avsm has quit [Quit: Leaving.]
lamawithonel_ has joined #ocaml
_andre has joined #ocaml
fraggle_ has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
StepanKuzmin has quit [Read error: Connection reset by peer]
StepanKuzmin has joined #ocaml
avsm has joined #ocaml
avsm has quit [Client Quit]
<kerneis> thelema: what do you call explicit closures?
<thelema> kerneis: let f x y z = ... in bar (f x0)
<thelema> vs. let f y z = ... x0 ... in bar f
<kerneis> the first one is a partial application
<kerneis> so it will trigger a GRAB when you invoke it
<kerneis> but then, x will be on your stack, so it might be faster or slower depending on how you use it
<kerneis> the second one will include x0 in the closure, and load it on the stack only when needed
<kerneis> I believe the second one should be faster in most cases, but this is only from my (limited) understanding of the Ocaml VM
<kerneis> so it might not apply to native code at all (I know nothing about it)
<kerneis> and it might be plain wrong if I missed some important detail
lamawithonel_ has quit [Ping timeout: 255 seconds]
<kerneis> on the other hand, once you are inside your function, the first one is probably more cache-efficient
<kerneis> but I doubt you will see any significant different in most cases anyway
<thelema> the important question is native performance, I'm not sure the cost of declaring an enclosed function, maybe it builds the same closure either way
oriba has joined #ocaml
<kerneis> why don't you just benchmark it?
<kerneis> or decompile it
<kerneis> any guess is likely to be flawed
<thelema> fair enough.
<thelema> If I'm going to do an experiment, I should have a hypothesis, and I want to know which way to guess.
avsm has joined #ocaml
avsm has quit [Client Quit]
oriba has quit [Remote host closed the connection]
dnolen_ has joined #ocaml
iratsu has quit [Ping timeout: 250 seconds]
StepanKuzmin has quit [Remote host closed the connection]
ftrvxmtrx has quit [Quit: This computer has gone to sleep]
dnolen_ has quit [Quit: dnolen_]
iratsu has joined #ocaml
clog has joined #ocaml
lopex has quit []
thomasga has quit [Quit: Leaving.]
avsm has joined #ocaml
impy has quit [Ping timeout: 276 seconds]
Cyanure has joined #ocaml
impy has joined #ocaml
agarwal1975 has joined #ocaml
avsm has quit [Quit: Leaving.]
joewilliams_away is now known as joewilliams
ulfdoz has joined #ocaml
sepp2k has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
ulfdoz_ is now known as ulfdoz
_schulte_ has joined #ocaml
<_schulte_> hi, how can I check if a module is loaded/available from within OCaml? Is this possible?
<kerneis> _schulte_: do you want to make a runtime or compile-time check?
<_schulte_> kerneis: compile would be preferable, to avoid compiling a portion of code if a given module is not present
<kerneis> well ocamlfind should be your best clue
<_schulte_> kerneis: the portion to skip is a pattern matching clause which I would be happy to replace with unit or somesuch
<kerneis> hmm, you need some kind of preprocessing, then
<_schulte_> ok, would a runtime check be possible?
<_schulte_> I would just wrap it in try/with but I doubt the compiler would let me get away with that
<kerneis> unfortunately, I think it's impossible indeed
<_schulte_> ok, good to know, thanks I'll pop this logic up to the Makefile
<kerneis> you should probably try to delegate the specific part of your pattern-matching in a separate module
<kerneis> and link it only if the library is available
<kerneis> or something like that
Cyanure has quit [Ping timeout: 252 seconds]
<kerneis> http://martin.jambon.free.fr/cppo.html but not many people have it installed unfortunately
<kerneis> so it might be a too restrictive dependency
Cyanure has joined #ocaml
<_schulte_> oh, good to know that exists thanks
<_schulte_> I think in this case seperate makefile targets and a little code duplication will be the simplest solution
* sgnb oO( cppo is in Debian )Oo
bobry1 has quit [Ping timeout: 255 seconds]
alexyk has joined #ocaml
Plazma-Rooolz has quit [Quit: leaving]
agarwal1975 has quit [Quit: agarwal1975]
Cyanure has quit [Ping timeout: 276 seconds]
sepp2k has quit [Ping timeout: 255 seconds]
petarj has joined #ocaml
iratsu has quit [Ping timeout: 255 seconds]
sepp2k has joined #ocaml
ankit9 has quit [Ping timeout: 246 seconds]
_andre has quit [Quit: leaving]
othiym23 has joined #ocaml
avsm has joined #ocaml
iratsu has joined #ocaml
<_habnabit> is there some in_channel_of_string or equivalent? the ocaml-csv package apparently refuses to operate on strings directly.
<thelema> _habnabit: batteries has an input_string function, but that won't work for ocaml-csv... I don't think the stdlib has an equivalent, but I can check pretty quickly
eb4890 has joined #ocaml
<thelema> you could write your string to a file (or maybe a pipe would suffice), and then you'd have normal file IO
<thelema> yup, the stdlib doesn't provide the functionality you want.
<sgnb> _habnabit: ocaml-csv's in_channel are not Pervasives's ones
<thelema> oh, in that case, you probably can.
<sgnb> it seems so (after a quick look at csv.mli)
<thelema> oh, they're using the object-style IO: good.
<thelema> let in_channel_of_string s = BatIO.in_channel (BatIO.input_string s)
eb4890 has quit [Ping timeout: 255 seconds]
<_habnabit> aha.
eb4890 has joined #ocaml
<gildor> _habnabit: the CSV module use a class to do that, you can probably use ExtLib.IO.in_channel class to do that
<gildor> _habnabit: or more precisel new ExtLib.IO.in_channel (ExtLib.IO.input_string "...")
<gildor> _habnabit: humm, exactly what thelema has said, but for ExtLib
* gildor should read before answering
<thelema> gildor: :)
ulfdoz has quit [Ping timeout: 255 seconds]
ygrek has joined #ocaml
eb4890 has quit [Ping timeout: 255 seconds]
jamii has joined #ocaml
_schulte_ has left #ocaml []
ftrvxmtrx has joined #ocaml
eb4890 has joined #ocaml
lamawithonel_ has joined #ocaml
edwin has quit [Remote host closed the connection]
ftrvxmtrx has quit [Quit: Leaving]
iratsu has quit [Quit: Leaving.]
ski has quit [Read error: Operation timed out]
ygrek has quit [Ping timeout: 250 seconds]
lopex has joined #ocaml
ski has joined #ocaml
eb4890 has quit [Ping timeout: 255 seconds]
alexyk has quit [Quit: alexyk]
joewilliams is now known as joewilliams_away
ikaros_ has quit [Quit: Ex-Chat]
alexyk has joined #ocaml
petarj has left #ocaml []
ftrvxmtrx has joined #ocaml