flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
<ollehar> I dont have lwt.cmo, but lwt.cmx?
palomer has quit [Ping timeout: 246 seconds]
amirmc has joined #ocaml
montik has joined #ocaml
ollehar has quit [Remote host closed the connection]
osa1 has quit [Ping timeout: 246 seconds]
mye has quit [Quit: mye]
pzv has quit [Ping timeout: 264 seconds]
chrisdotcode has joined #ocaml
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
ollehar has joined #ocaml
montik has quit [Ping timeout: 264 seconds]
pzv has joined #ocaml
ben_zen has joined #ocaml
demonimin has quit [Remote host closed the connection]
q66 has quit [Quit: Leaving]
demonimin has joined #ocaml
weie_ has quit [Quit: Leaving...]
ygrek has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
ollehar has quit [Ping timeout: 246 seconds]
demonimin has quit [Ping timeout: 264 seconds]
wmeyer has joined #ocaml
avsm1 has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
avsm1 has quit [Quit: Leaving.]
ygrek has joined #ocaml
csakatoku has joined #ocaml
avsm1 has joined #ocaml
amirmc has quit [Ping timeout: 256 seconds]
avsm1 has quit [Client Quit]
Zeev has joined #ocaml
chrisdotcode__ has joined #ocaml
chrisdotcode has quit [Read error: Operation timed out]
chrisdotcode has joined #ocaml
chrisdotcode__ has quit [Ping timeout: 268 seconds]
wmeyer has quit [Ping timeout: 246 seconds]
chrisdotcode has quit [Remote host closed the connection]
amirmc has joined #ocaml
amirmc has quit [Ping timeout: 264 seconds]
ggole has joined #ocaml
weie has joined #ocaml
avsm1 has joined #ocaml
amirmc has joined #ocaml
<adrien> for ollehar, exceptions and lwt threads, hmmm
<adrien> doesn't sound good
amirmc has quit [Ping timeout: 276 seconds]
zRecursive has joined #ocaml
pzv_ has joined #ocaml
Nahra_ has joined #ocaml
<zRecursive> Can anybody run `echo "sqrt 100. ;;" | ocam | tail +13` successfully ?
pzv has quit [Read error: Connection reset by peer]
Nahra has quit [Remote host closed the connection]
orbitz has quit [Ping timeout: 276 seconds]
orbitz has joined #ocaml
* orbitz generally tries to stick to Result.t in concurrent code
ttamttam has joined #ocaml
<flux> zrecursive, well, no, but what do you expect? after fixing the command my output isn't 13 lines long.
<flux> (I don't currently have ocamlfind in ~/.ocamlinit)
<orbitz> how far aware are the SML semantics from Ocaml? I just got the idea of compiling Ocaml to SML and compiling with mlton
<flux> you may find lot of work in implementing objects, polymorphic variants, first class modules, ..
asmanur has quit [Ping timeout: 246 seconds]
<orbitz> I don't use objects, so polymorphic variants sound slikethe hard thing
<orbitz> Not my forte anyways, just a swell though
<orbitz> thought
<zRecursive> flux: i just want to get the result "10"
avsm1 has quit [Quit: Leaving.]
<flux> zrecursive, why tail -n +13 then and not tail -2?
<flux> echo "sqrt 100. ;;" | ocaml | tail -2 works for me (but ocamlfind could mess things up)
<zRecursive> flux: "-2" just for sqrt which is NOT general
ygrek has quit [Ping timeout: 246 seconds]
<flux> you really want exactly just "10" then you probably want to throw some parse code in there
<orbitz> '-2' is dperecated i thought
<orbitz> need -n 2
<orbitz> or am i wrong?
<flux> says gnu maybe, but not really.
<flux> so many scripts would die if that stopped working :)
<orbitz> indeed, but we must be future proof!
<zRecursive> `cat ... | tail +n` works though
<zRecursive> i.e. `cat foo.txt | tail +100` works
<zRecursive> it skips the first 100 lines
<flux> tail: cannot open ‘+100’ for reading: No such file or directory
<flux> so that would be non-portable functionality
<flux> for positive arguments I need to use -n
Neros has joined #ocaml
asmanur has joined #ocaml
<zRecursive> even if `echo "sqrt 100. ;;" | ocam | tail -n +12` cannot output perfectly, i have to use it temporarily
djcoin has joined #ocaml
zRecursive has left #ocaml []
<flux> how about echo "sqrt 100. ;;" | ocaml | sed 's/^#.*/&/; t; d' | head -1 ?
<orbitz> what problem are you trying to solve?
ygrek has joined #ocaml
<flux> (actually sed '/^#/ p; d' is shorter and to-the-point)
<flux> I don't get a plain '10' out of that, however, I get a line like # - : float = 10.
<flux> but sed works for that :)
<orbitz> echo "sqrt 100.;;" | ocaml 2>/dev/null | tail -n 2 | head -n 1 | cut -f 2 -d '=' will get just the result on my system (+ an extra space)
<djcoin> Code golf, what was the question ? :)
cago has joined #ocaml
mika1 has joined #ocaml
<djcoin> echo "sqrt 100. ;;" | ocaml | sed -n "3s/.* = //p"
thomasga has joined #ocaml
ben_zen has quit [Quit: sleep!]
amirmc has joined #ocaml
Simn has joined #ocaml
amirmc has quit [Ping timeout: 264 seconds]
bondar has joined #ocaml
bondar has quit [Excess Flood]
pr_ has joined #ocaml
pr_ has quit [Client Quit]
eikke has joined #ocaml
ggole has quit [Read error: Connection reset by peer]
ggole has joined #ocaml
wormphlegm has quit [Ping timeout: 248 seconds]
ontologiae_ has joined #ocaml
yezariaely has joined #ocaml
csakatok_ has joined #ocaml
demonimin has joined #ocaml
csakatoku has quit [Ping timeout: 264 seconds]
patronus has joined #ocaml
maxibolt has joined #ocaml
ontologiae has joined #ocaml
rks`_ has joined #ocaml
rednovae_ has joined #ocaml
gnuvince- has joined #ocaml
darkf1 has joined #ocaml
amirmc has joined #ocaml
NaCl_ has joined #ocaml
NaCl_ has quit [Changing host]
NaCl_ has joined #ocaml
buddyholly has quit [Ping timeout: 240 seconds]
The_third_man has quit [Ping timeout: 240 seconds]
thizanne has quit [Ping timeout: 240 seconds]
NaCl has quit [Ping timeout: 240 seconds]
MarcWeber has quit [Ping timeout: 240 seconds]
ontologiae_ has quit [Ping timeout: 240 seconds]
BiDOrD_ has quit [Ping timeout: 240 seconds]
yroeht has quit [Ping timeout: 240 seconds]
gnuvince has quit [Ping timeout: 240 seconds]
rednovae has quit [Ping timeout: 240 seconds]
rks` has quit [Ping timeout: 240 seconds]
balouis has quit [Ping timeout: 240 seconds]
patronus_ has quit [Ping timeout: 240 seconds]
MarcWeber has joined #ocaml
balouis has joined #ocaml
ttm has joined #ocaml
BiDOrD has joined #ocaml
yroeht1 has joined #ocaml
darkf1 is now known as buddyholly
wormphlegm has joined #ocaml
amirmc has quit [Ping timeout: 256 seconds]
zpe has joined #ocaml
ggole has quit [Ping timeout: 246 seconds]
<yezariaely> has ocaml a pair constructor I can partially apply?
<yezariaely> I want to create a list of pairs List.map (fun v -> (a,v)) vs and wondered if a can abbreviate the anonymous function here somehow.
amirmc has joined #ocaml
<adrien_oww> it's 17 character :P
<adrien_oww> and you have two extra parens
<yezariaely> well just wondered. It is a one liner and one sees clearly what happens, so I am happy with the function in general.
<sgnb> yezariaely: "(a,b)" is a notation for "pair _ _ a b"
<sgnb> I meant "@pair _ _ a b" or "pair a b"
<sgnb> pair can be partially applied as usual
<yezariaely> in my ocaml toploop there is no pair, neither a @pair?
<sgnb> ah, sorry
<rks`_> sgnb: are you talking about ocaml?
<rks`_> that looks like coq.
<yezariaely> yeah, that was what I assumed, too ;)
<sgnb> rks`_: right, I am totally OT
<sgnb> sorry
<yezariaely> np
<rks`_> :)
<ousado> in terms of clarity, which of these implementations would you prefer: https://gist.github.com/ousado/b45b0e8a8ded3888b39b ?
<sgnb> type constructors cannot be partially applied in ocaml
<sgnb> (and pairing is not a constructor, but more low level)
<rks`_> ousado: the identation is awful in both cases
<compnaion_cbue> it's sad that backward compatibility prevents constructors from being (partially-appliable) functions
<rks`_> but probably more in the first than in the second one.
<rks`_> ousado: were you waiting for a more interesting answer or is that ok for you?
<ousado> more interesting pls
<ousado> :)
<rks`_> well, too bad.
ggole has joined #ocaml
<ousado> rks`_: it would have been a useful answer if you had mentioned what about the indentation you don't like
<rks`_> ousado: :D
<rks`_> ousado: in terms of clarity, I don't care much whetever you use List.fold_left or use your "loop" function
<adrien_oww> ousado: asking rks`_ for what he likes is *much* faster
<adrien_oww> []
<rks`_> but in both cases you could have used clearer variable names
<rks`_> adrien_oww: \o/
<rks`_> ousado: for exemple, in the second implementation, changing "fun c x -> ..." to "fun (acc, ys) x -> ..." is already much better imho
<ousado> indeed
<ousado> it's not quite clear what deserves the name acc though,
<rks`_> and hum, I would probably prefer the version using List.fold_left, just because... I don't know, I handle "one list at a time" "ys" in the function, "xs" outside.
<rks`_> (but that's just a silly explanation and you don't need to care about it)
<ousado> well, I asked for comments
<rks`_> for me it is ousado, you're doing a fold_map. acc is the accumulator of the "fold" part of that fonction
<ousado> also true
mcclurmc has quit [Quit: Leaving.]
<ousado> I called it c because it's kind of a context
<ousado> but yes, inside the fold_left, it's just another acc
yacks has joined #ocaml
pzv_ has quit [Ping timeout: 264 seconds]
yacks has quit [Quit: Leaving]
amirmc has left #ocaml []
dsheets has quit [Ping timeout: 268 seconds]
zpe has quit [Remote host closed the connection]
dsheets has joined #ocaml
madroach has quit [Quit: leaving]
ttamttam has quit [Ping timeout: 246 seconds]
ygrek has quit [Ping timeout: 245 seconds]
ollehar has joined #ocaml
ygrek has joined #ocaml
madroach has joined #ocaml
zpe has joined #ocaml
pzv has joined #ocaml
zpe has quit [Ping timeout: 246 seconds]
ttamttam has joined #ocaml
mcclurmc has joined #ocaml
Drup has joined #ocaml
_andre has joined #ocaml
q66 has joined #ocaml
csakatok_ has quit [Remote host closed the connection]
zpe has joined #ocaml
aziem has joined #ocaml
aziem is now known as logicgeezer
zpe has quit [Ping timeout: 268 seconds]
beckerb has joined #ocaml
ygrek has quit [Read error: Connection reset by peer]
ygrek has joined #ocaml
f[x] has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
f[[x]] has joined #ocaml
f[x] has quit [Ping timeout: 268 seconds]
mika1 has quit [Quit: Leaving.]
zpe has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
jgw25 has joined #ocaml
<jgw25> are there any compelling reasons not to use the -g flag as a matter of course, for example as default when packaging up a library?
<rixed> jgw25: good question. I think it's the same as in C, you ommit the -g merely to save disk space on user HD (although from my experience, the size increase is less for OCaml than for C)
<compnaion_cbue> it may also make exception handling slower?
<adrien_oww> not sure
<adrien_oww> not by default at least
<adrien_oww> there are a few cases where -g prevents some optimization but it's uncommon and being solved if not already
<jgw25> I suppose my thought is that if a user sees, for example, a Not_found float to top level, I'd like to be able to ask them just to recompile their code with -g and use OCAMLRUNPARAM=b, rather that asking them to recompile the library (which they might have got from OPAM, for example). Plenty of people know how to use libraries but not how to play with the makefile and recompile. Also, it's more effort for the bug reporter, meaning fewer
<mrvn> always use -g, strip if you need the space
<mrvn> (at least for C)
wormphlegm has quit [Ping timeout: 240 seconds]
wormphlegm has joined #ocaml
<f[[x]]> always use -g for ocaml
<f[[x]]> if it slows code - complain on mantis - it shouldn't and doesn't
introom has joined #ocaml
<rixed> Shouldn't OPAM have a global option to always compile everything with such option?
<compnaion_cbue> something like gentoo's CFLAGS ?
<mrvn> Nothing gentoo about CFLAGS
<compnaion_cbue> gentoo allows to specify global compilation flags
<compnaion_cbue> (for instance, -O3 ;))
<mrvn> great for making code slower
<Drup> rixed: opam doesn't control anything about build systems, it just use the command provided by the opam package, so not sure if it's reasonably possible to do this.
f[[x]] has quit [Ping timeout: 246 seconds]
<compnaion_cbue> mrvn: -O2 can be a reasonable choice
<compnaion_cbue> or -Os
<bernardofpc> -march=native has a definite HUGE impact
<mrvn> compnaion_cbue: but -O3 if freqently slower
zpe has joined #ocaml
<bernardofpc> (on numeric code, at least, and using registers as well)
<rixed> Drup: compnaion_cbue: yes I'm thinking about gentoo global flags, which are a very good idea and provide this very functionality (keeping all debugs or not)
yacks has joined #ocaml
mika1 has joined #ocaml
<rixed> Drup: gentoo does not rewrite all build system neither, though. But standard way to build things with Makefiles allow for a global CFLAGS to have this effet.
<rixed> I personally build OCaml programs with Makefiles and use a similar OCAMLFLAGS, but the lack of standard would make it much harder for opam I guess.
<mrvn> A lot of gcc code performance seems also to be random. There is a paper about the effects of the environment on the execution speed and they showed that the effect of different env content is easily twice the differece between -O2 and -O3.
<mrvn> So for example adding 'export FOO="bar"' gains you more speed than optimizing.
<bernardofpc> mrvn: you mean LC_ALL="C" ?
<mrvn> bernardofpc: no, simply adding some more bytes to the env.
<bernardofpc> oh
<mrvn> bernardofpc: changes the addresses the code then uses for everything else
<mrvn> Same thing with stack randomization. The location you get for your stack has more effect than the optimization level.
<compnaion_cbue> oO
<yezariaely> hmm maybe I am doing it wrong: I define a data type in a functor Make. Then I have to define it in the signature S and in the mli file's S description again. Three times writing the same stuff?!
<jgw25> Thanks. -g it is, then.
<Drup> mrvn: the article is quite insane and a bit depressing
<mrvn> Makes it realy hard to profile code. Just by adding 'export CFLAGS=-O3' you can slow the code more down that the -O3 gains or vice versa.
<mrvn> Drup: yeah.
<yezariaely> can one simplify this?
<mrvn> yezariaely: you can not define the signature and skip the mli file.
<yezariaely> mrvn: well, yeah sure. But the idea of abstraction kind of is broken, then...
<whitequark> mrvn: cache effects?
<ggole> Associative caches.
<mrvn> whitequark: yeah
<mrvn> alignment effects describes it better
<whitequark> well, isn't it cache line alignment?
<whitequark> word alignment is enforced by the compiler
<mrvn> yezariaely: I wold skip the mli file until your interface has settled. Then ocamlc -i the ml and edit to fit.
<whitequark> (and runtime)
zpe has quit [Ping timeout: 264 seconds]
<mrvn> whitequark: still an aligment effect
<whitequark> ok
<ggole> whitequark: cache lines are associative in the caches of many machines
<ggole> Which has performance effects
<whitequark> ggole: sure
<ggole> If you have many lines aligned to a page boundary, say, you can get remarkable slowdowns
<rixed> yezariaely: can't you declare the signature S only in the mli?
<mrvn> whitequark: and it's not just the alignment within the cache line. Cache lines themself are cached differently too. So if you hit a later cacheline because ENV was bigger then you might get more cache collisions.
<rixed> yezariaely: (sory if it's stupid, I don't write mli very often)
avsm1 has joined #ocaml
<yezariaely> rixed: I have a functor Make which creates an instance of S.
<yezariaely> thus I have to export S as well.
<mrvn> yezariaely: why?
<yezariaely> ehm Make, sorry
<yezariaely> otherwise Make is not callable by others?
<mrvn> yezariaely: Make takes a module type as input. But the output is infered
<yezariaely> hmm
<rixed> yezariaely: the only thing about Make in the mli is its type (functor from this and that to S). that's quite short
<yezariaely> mrvn: but then I can't restrict what is published?
<mrvn> yezariaely: yes, that is the drawback.
<yezariaely> rixed: yes, exactly. That is not the problem.
<mrvn> rixed: the problem is that if you have S in .mli you must have it in the ml too.
<rixed> Ah ok. that's probably why I don't use mli when I have functors :)
<rixed> If you have already S in the ml and constraint Make by S, then what's the use for a mli file?
<mrvn> yezariaely: but wait. You can restrict things in the ml file.
<yezariaely> how
<yezariaely> ?
<rixed> when I have many functors I tend to split the code in two parts : a ml file with all signatures and one (or several) ml file(s) with all the implementation(s).
<yezariaely> like so? Make(F : MT) : S = struct ... end
<rixed> I tend to see mli files as a simple way to do that when you don't have functors.
<mrvn> module Make = functor (Elt: Elt_t) -> (struct ... end : S)
<yezariaely> ah I see.
<yezariaely> let's try that. Thanks for the discussion!
<mrvn> if you don't need to hide other stuff then you can avoid the mli file that way.
<yezariaely> but I need to hide information. I don't want the internal structure be publicly available.
<mrvn> I think ml and mli files suck in ocaml. One should be able to define everything in .ml and generate the cmi from that.
<ggole> yezariaely: if you need to hide stuff just write a mli
<yezariaely> definitely.
<yezariaely> ggole: I didn't get it?
<ggole> .mli files exist for separate compilation
<ggole> You can compile and then recompile a .ml without users of the .mli having to care about a change
<mrvn> .mli files exist because you can't write 'module M : sig type t end = struct type t = int end' for .ml files, only for submodules.
<yezariaely> ggole: I know that. The problem is different. I wondered, if it is really necessary to write a data type declaration in mli's S module type, and again write it in ml's S module type and the again in ml's Make functor which produces a S.
<yezariaely> so three times the same declaration
* ggole nods
<ggole> That sucks
<ggole> If it is a large type, it is worth splitting it into another module and either referencing or including that
<mrvn> ggole: which breaks down when types become recursive
<yezariaely> no it is only two lines, but I had to change it twice now. which makes 6 changes ;-)
<ggole> Often mutually recursive types lift out together
<rixed> yezariaely: if you need to hide stuffs from the Make internals, then applying signature S to it _will_ hide it. Indeed, an mli file is nothing more than another way to write " : sig blabla end".
<ggole> But yes, sometimes you end up doing dumb things to please the module system
<yezariaely> rixed: true. Let's see if this is better.
<mrvn> rixed: we already covered that
<rixed> yezariaely: here is an example: module type S = sig val a:int end module M : S = struct let a = 1 let b = 2 end -> M.b is not visible
<rixed> So if you explicitely use modules and module types, then mli is useless
<mrvn> rixed: only works on submodules, which luckily a functor is
<ggole> Except for, again, separate compilation
<mrvn> ggole: no.
<mrvn> ggole: you compile the cmi from the ml
<ggole> ...and then every user of the .cmi gets recompiled
<mrvn> ggole: they always do
<jgw25> .quity
<jgw25> .quit pah
<ggole> No they don't? O_o
<jgw25> Don't use IRC for ten years, forget commands :-)
jgw25 has quit []
zpe has joined #ocaml
hyperboreean has quit [Ping timeout: 264 seconds]
hyperboreean has joined #ocaml
cago has quit [Ping timeout: 264 seconds]
zpe has quit [Ping timeout: 264 seconds]
ollehar has quit [Ping timeout: 246 seconds]
snearch has joined #ocaml
mcclurmc has quit [Quit: Leaving.]
mcclurmc has joined #ocaml
ttamttam has quit [Quit: ttamttam]
ttamttam has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 256 seconds]
wormphlegm has quit [Ping timeout: 268 seconds]
wormphlegm has joined #ocaml
zarus has joined #ocaml
djcoin has quit [Quit: WeeChat 0.4.0]
djcoin has joined #ocaml
wormphlegm has quit [Read error: Operation timed out]
zarus has quit [Ping timeout: 256 seconds]
ygrek has joined #ocaml
ollehar has joined #ocaml
wormphlegm has joined #ocaml
yezariaely has quit [Ping timeout: 248 seconds]
zpe has joined #ocaml
smondet has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
snearch has quit [Quit: Verlassend]
ollehar has quit [Ping timeout: 240 seconds]
asmanur has quit [Ping timeout: 256 seconds]
ollehar has joined #ocaml
mika1 has quit [Quit: Leaving.]
zpe has joined #ocaml
bkpt has joined #ocaml
beckerb has quit [Ping timeout: 245 seconds]
Drup has quit [Ping timeout: 246 seconds]
gnuvince- has quit [Changing host]
gnuvince- has joined #ocaml
gnuvince- is now known as gnuvince
beckerb has joined #ocaml
zpe has quit [Ping timeout: 256 seconds]
wmeyer has joined #ocaml
<wmeyer> hello
Drup has joined #ocaml
<wmeyer> Drup: hi!
<Drup> hi wmeyer
f[x] has joined #ocaml
<adrien_oww> o/
ygrek has quit [Ping timeout: 268 seconds]
zpe has joined #ocaml
f[x] has quit [Ping timeout: 264 seconds]
<wmeyer> adrien_oww: \o
<wmeyer> how is your work on cross compilation?
<wmeyer> Damien gently punished us and commited some changes to the build system on the trunk :-)
asmanur has joined #ocaml
<avsm1> parallel makefile. awesome!
<wmeyer> :-)
<ollehar> if I have a json list in js_of_ocaml like `cards##length == 52`, how do I traverse it? or get a single element, what in js would be cards[1]?
<wmeyer> ollehar: best from my experience is to look at the mli files distributed with js_of_ocaml
<adrien_oww> wmeyer: I'm at work :P
<adrien_oww> wmeyer: nooooooooo ='(
<wmeyer> yes, today I took holiday
<adrien_oww> at least I have beer at home
<adrien_oww> for I'll need it
<ollehar> wmeyer: yeah, but `Json.unsafe_input json_string` returns 'a :(
<Drup> ollehar: does your json come from the deriving thing shipped with js_of_ocaml ?
zpe has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
<ollehar> Drup: I wish
xavierm02 has joined #ocaml
<xavierm02> hey
<Drup> ( ollehar : as a general rule, you seems to try to map js concept to caml with js_of_ocaml and it's not really the right way to go. js_of_ocaml is build so that you just do whatever you would like to do in caml and you have an abstract notion of dom tree that use the object part of ocaml)
<xavierm02> is there some way to have a piece of code that is run if and only if the file is the "main" file you're running? Like if you do ocamlbuild file.byte, it runs that piece of code but if you open the file as a module in another file, it doesn't.
<Drup> eliom's client lib make the whole dom part far easier, imo
<mrvn> xavierm02: don't think so
<xavierm02> I thought that's what "let _ =" was but it always runs
<xavierm02> :/
<mrvn> xavierm02: that just binds the result of whatever to forget it
ttamttam has quit [Quit: ttamttam]
<xavierm02> I don't understand
<xavierm02> if you write and expression directly in the file
<xavierm02> the returned value is ignored too
<xavierm02> isn't it? What the pont of let _ = ?
<mrvn> xavierm02: let x = 17 binds 17 to x. _ does the same except that it forgets it as a special case to ignore the result.
<xavierm02> yeah
<xavierm02> but you could write the same thing you wrote after let _ = ... without it
<mrvn> It just avoids the "unused" warning. Not like if __main__: in python.
<Drup> xavierm02: look at the end of this page, I'm not sure that's exactly what you want : http://chaudhuri.info/misc/osetup/
<xavierm02> you mean the interactive thing?
<Drup> yes
<xavierm02> the doc says this: This reference is initially set to false in standalone programs and to true if the code is being executed under the interactive toplevel system ocaml.
<xavierm02> it's just to know if it's interactive or if it's an actual file
<xavierm02> apparently
<xavierm02> yup
<xavierm02> tried and it's false in both cases
paolooo has joined #ocaml
<xavierm02> I'll do without it then
<xavierm02> ty anyway guys :)
<Drup> xavierm02: there is always the obivous solution : put the "executable" part of the module you want to load somewhere else
<xavierm02> yeah
<xavierm02> but that would be annoying
<xavierm02> I'm just doing project Euler exercises
<xavierm02> and I had to reuse an older one and didn't want the outputs from it
<mrvn> and then you can only access the public interface or have to include a dummy function in the interface.
<rixed> xavierm02: "if you write an expression directly in the file" -> like "42" ? That's a syntax error. "let _ = 42" is not.
<xavierm02> yeah
<xavierm02> but in real use cases you'll have
<xavierm02> let function_1 = ... in ... let function_k = ... in *som expression using the functions*;;
<rixed> xavierm02: for project Euler, I would not define values in modules but functions, then #load and call the one I want from the toplevel.
<rixed> "let ... = ... in" is not valid at to level of a module (or a file). Sorry if I do not understand your situation (which is probably the case)
<rixed> s/at to level/at top level/
paolooo has quit [Ping timeout: 250 seconds]
<xavierm02> hm
<gasche> "let x = a in let c = d;;" is a mistake beginners often make
<xavierm02> I have "function_1=...;; function_2=...;;print_int function_2 10;;
<mrvn> ;; is a mistake too
<rixed> xavierm02: ok this is valid in the repl but this is not compilable.
<xavierm02> why is that?
<xavierm02> repl=?
<rixed> ocamlc will signal a syntax error here.
<rixed> repl = ocaml program (the "top level")
<xavierm02> erm
<mrvn> ;; is a special token to execute the input in the toplevel
<xavierm02> I just use ocamlbuild
<gasche> ;; is valid in an OCaml file
<xavierm02> I just use ocamlbuild file.byte --
<gasche> in fact there are no syntax differences between the toplevel and complete programs, except the toplevel directives
<rixed> gasche: ";;" is valid but is more or less ignored isn't it?
<gasche> (and of course the fact that in the toplevel, the ";;" are mandatory for interactive purposes)
<gasche> yes
<gasche> I still wouldn't call it a "mistake", some people like this style
<xavierm02> and what's the alternative style?
<gasche> and it's useful if you want to send phrases to the toplevel from an Emacs buffer
<xavierm02> let in?
<rixed> I suppose it's so that you can #use and #load the file
<gasche> xavierm02: not using ';;' when it's not ambiguous
<mrvn> xavierm02: simply drop the ;;
<xavierm02> erm
<gasche> rixed: #use should work fine without the ;;, I think
<xavierm02> right
<xavierm02> it works O_O
<rixed> xavierm02: what I was trying to say is: in a .ml file that you want to compile, then you can only either: 1) define modules (module X = struct ... end) or 2) bind values (let X = ...)
<rixed> xavierm02: you can not just write "42" in file.ml and compile it.
<rixed> thus the frequent use of "let _ = ..."
<mrvn> In prefer let () =
<xavierm02> what's the difference?
<xavierm02> aside from the fact you can only return unit
<mrvn> _ is type 'a and () is type unit
<xavierm02> k
<mrvn> let f x y = x + y let _ = f 1 works but let () = f 1 gives an error so you see that you forgot something
<rixed> sometime I use "let main = " for the entry point (simple convention of course)
<mrvn> rixed: let main args = .... let _ = main Sys.arg
<xavierm02> let main -
<xavierm02> or let main () =?
<rixed> xavierm02: just "let main = ..." just to show that this is where the program "begins" (of course the actual entry point is in ocaml runtime and every module is initialized the same so this "main" is really nothing more than a convention)
<xavierm02> k
<xavierm02> is there some way to "mute" the program for some time?
Arsenik has joined #ocaml
<xavierm02> like, forbid to write text to screen, or simply ignore it for some time
<xavierm02> ?
<mrvn> not unless you implement it
<rixed> xavierm02: why don't you merely turn your euler solutions into proper functions that are executed only when called?
<xavierm02> that's what they are
<rixed> apparently you have some printf in the top level bindings. Make them functions too.
<xavierm02> well if I did that
<xavierm02> I couldn't just hit Ctrl + B to see the output
<xavierm02> I'd have to run ocaml in a terminal
<xavierm02> load my file etc.
<rixed> xavierm02: oooook, now I understand.
darkf has quit [Quit: Leaving]
<rixed> xavierm02: but then, when you edit another file where you want to use solve_1, can you still use Ctrl+B ? (sorry I'm not using emacs)
<xavierm02> yeah
<rixed> xavierm02: maybe split this in two modules : one with the reusable functions and one with the prints ?
<xavierm02> I use sublime text btw
<mrvn> put a "let do_print = ref true" in it and check that everywhere you print. Then you can turn it on and off.
<rixed> @mrvn: but the module initializer will be executed before you have the occasion to turn do_print off
<xavierm02> how could that work? I have one exercice per file
<mrvn> or let print = ref Printf.printf
<xavierm02> I'll just split the file.
Arsenik has quit [Ping timeout: 246 seconds]
<xavierm02> Found a way: Sys.executable_name
<mrvn> xavierm02: so when I rename the binary it stops working?
<xavierm02> yes
<xavierm02> and when you include, it's the "parent" name you get
<xavierm02> so you can detect it
<rixed> xavierm02: nice, not carrier grade but acceptable for project Euler exercices ;)
ygrek has joined #ocaml
<xavierm02> since I name my files with number I just have to look for "e#." with # the number in the name of the file
<Drup> xavierm02: this is ugly
<xavierm02> Drup: This works :D
<xavierm02> having two files was annoying: i had to write in one then switch, hit compile, check the result, switch again etc.
shinnya has joined #ocaml
paolooo has joined #ocaml
beckerb has quit [Ping timeout: 245 seconds]
<gasche> hnrgrgr's patches for "make -jN" on the compiler sources was just merged in
<gasche> (in trunk)
<wmeyer> great
<gasche> (it broke Windows compilation but hopefully that will be fixed)
pkrnj has joined #ocaml
<rixed> ocaml-list is turning its attention to political philosophy now :-D
jdoles has quit [Read error: Connection reset by peer]
palomer has joined #ocaml
<rks`_> wmeyer: hello! apparently you're working on ocamlbuild (gasche sold you out on the ML)
<rks`_> so I have a feature request for you (or hm, maybe you can tell me why it's not a god idea) : being able to put « bin-annot » in my _tags
<rks`_> (that'll be all, thank you)
<Drup> rks`_: i think it's already in the trunk
<rks`_> oh, well perfect then
<rks`_> sorry for the noise
Drup has quit [Ping timeout: 256 seconds]
ontologiae has quit [Ping timeout: 264 seconds]
introom has quit [Remote host closed the connection]
pkrnj has quit [Read error: Operation timed out]
pkrnj has joined #ocaml
mcclurmc has quit [Quit: Leaving.]
osa1 has joined #ocaml
thomasga has quit [Quit: Leaving.]
ygrek has quit [Ping timeout: 276 seconds]
pkrnj has quit [Quit: Computer has gone to sleep.]
palomer has quit [Read error: Operation timed out]
<wmeyer> rks`_: sorry to be late and you are welcome, actually the bin-annot is a last year change from Jonathan Protzenko. It's relatively easy to add new rules and tags, in essence we should have less centralised way of doing that, (which gasche and me proposed independently before) via. loading ocamlfind packages. However this case is relatively self contained and belongs to the core.
Drup has joined #ocaml
csakatoku has joined #ocaml
pkrnj has joined #ocaml
<avsm1> rks`_: you can already do that in 4.1 ocamlbuild. just add "bin_annot"
<avsm1> gasche: those make-j patches are awesome. my 48core dev box will be happy ;-)
<whitequark> wow, 48-core
<whitequark> what platform is that?
<avsm1> an old amd magnycours. had it for 2 years now
<whitequark> so, four 12-core cpus?
<avsm1> yeah
<orbitz> avsm1: does oasis requires dependencies specified as part of the build system?
<avsm1> orbitz: it can, but i rarely bother
<avsm1> its more trouble than its worth usually
<orbitz> yeah, that is basically the problem i've run into in Erlang
<avsm1> i prefer wrapping that in the opam file
<orbitz> the primary build tool used in Erlang requires projects encode their deps + versions in the repo
<orbitz> It also doesn't understand semantic versioning
avsm1 has quit [Quit: Leaving.]
zpe has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
dsheets has quit [Ping timeout: 276 seconds]
palomer has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
zpe_ has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
<gasche> Drup: you need to add examples (with pictures!) to your LILiS project before it gets really redditable
<Drup> gasche: I do have pictures !
<gasche> I can't get them from the source repository
<gasche> is there a website?
<Drup> hum, they should be in the repository, under doc/
<Drup> and they also are in the readme, as showed in the github page
<gasche> scrap that, I was looking at an old version
<gasche> (somehow the github search sent me there)
<gasche> redditable it is, then
<palomer> http://www.google.com/trends/explore?q=clojure%2C+ocaml#q=clojure%2C%20ocaml&cmpt=q <-- this makes me sad :(
eikke has quit [Ping timeout: 248 seconds]
dsheets has joined #ocaml
<Drup> gasche: wait a bit
<Drup> gasche: I really would like to finish the opam package
<wmeyer> hmmm, git svn fails on ARM Linux
<wmeyer> I got this problem before and it was reported
gautamc has joined #ocaml
<gasche> Drup: too late
wormphlegm has quit [Ping timeout: 276 seconds]
wormphlegm has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
csakatoku has quit [Remote host closed the connection]
osa1 has quit [Quit: Konversation terminated!]
osnr has quit [Client Quit]
<Drup> gasche: the documentation is also online
ulfdoz has joined #ocaml
osnr has joined #ocaml
wormphlegm has quit [Ping timeout: 260 seconds]
wmeyer has quit [Ping timeout: 240 seconds]
Neros has quit [Remote host closed the connection]
wormphlegm has joined #ocaml
mye has joined #ocaml
bkpt has quit [Quit: Leaving]
jayprich has joined #ocaml
zpe has joined #ocaml
zpe_ has quit [Read error: Connection reset by peer]
<palomer> is there a Pervasives.referential_equality ?
<whitequark> what should it do?
ggole has quit []
<palomer> it would be to == what Pervasives.compare is to =
<palomer> (==) and (=)
<palomer> basically, I want to create a set of references
<palomer> we could just compare pointer addresses, no?
<gasche> well , Pervasives.(==) ?
<gasche> you cannot have an order as values get moved around in memory by the GC
<gasche> just add an unique identifier to the references in your set
<palomer> so no one has ever written an efficient container for references?
paolooo has quit [Quit: Page closed]
tane has joined #ocaml
wmeyer has joined #ocaml
<wmeyer> adrien: adrien_oww: ping
<adrien> wmeyer: pong
<gasche> palomer: I've never had a use for "a set of references"
<gasche> what's your use-case?
<wmeyer> adrien: already home?
<adrien> for less than one hour :P
<adrien> tomorrow will be busy too but starting friday I'll have much more time
<palomer> I'm using my references as unique identifiers
<wmeyer> adrien: cool!
<palomer> instead of having a global int ref
<wmeyer> I'll install your patches, but wait for the fixes by Damien for the builds that failed
<adrien> ah, he broke stuff too? :P
<wmeyer> yes, it looks like the buids fail, but haven't looked why
malo has joined #ocaml
csakatoku has joined #ocaml
<adrien> wmeyer: by build tests had an issue which I've fixed just now so I'll have to run them again
<gasche> palomer: could you elaborate?
<gasche> ah
<gasche> you're using the trick that allocation creates fresh values?
<gasche> it seems to me that you are asking for trouble here
<gasche> (the problem is not that it's hard to have an efficient set of references, but rather that you shouldn't use references for this purpose in the first place)
<wmeyer> adrien: ok, I'll wait
csakatoku has quit [Ping timeout: 264 seconds]
dtg_ has quit [Read error: Connection timed out]
<palomer> gasche, why not?
<adrien> wmeyer: I really expect that there won't be issues so I should be able to push a new patch tomorrow; I'll also expand the documentation with figures about how much time and space each option saves
<gasche> palomer: .. because it's hard to manipulate them efficiently then?
<gasche> I don't see the problem with a global integer counter
dtg has joined #ocaml
<palomer> integers overflow :P
<adrien> only on 8 bit machines
<gasche> well reference would overflow just as well if you use all your memory
<wmeyer> adrien: that would be great!
<gasche> (the program would crash first)
<palomer> an integer might overflow quicker
<palomer> since references are garbage collected
ulfdoz has quit [Ping timeout: 240 seconds]
<palomer> ok, here's my usecase
<palomer> I'm doing type inference
osa1 has joined #ocaml
<palomer> when I infer the type of a toplevel binding, I associate this type with the identifier of the let binding
<palomer> then when it's used I have to instantiate this type
<palomer> so I have to associate all the type variables with new type variables
<gasche> I think the OCaml type-checker uses integers for this purpose
djcoin has quit [Quit: WeeChat 0.4.0]
<gasche> (have you seen Oleg's article about the OCaml type inference engine? it's orthogonal but may interest you in any case)
<palomer> I've seen the ocaml type checker
<palomer> but this way is quick and dirty :P
<palomer> the ocaml type inference engine does a lot of silly stuff
<palomer> to detect cycles they mutate each object encountered, for example
<gasche> have a look at Oleg's article
<gasche> but I think the reason why it's still done this way is "it works and we never needed better"
<gasche> going to bed anyway, see you
<palomer> night
zpe has quit [Ping timeout: 264 seconds]
wmeyer` has joined #ocaml
palomer has quit [Ping timeout: 240 seconds]
wmeyer has quit [Ping timeout: 240 seconds]
wmeyer` has quit [Remote host closed the connection]
wmeyer` has joined #ocaml
_andre has quit [Quit: leaving]
jayprich has quit [Ping timeout: 260 seconds]
<wmeyer`> adrien: the builds are back to normal
ollehar has quit [Ping timeout: 240 seconds]
wmeyer` has quit [Ping timeout: 240 seconds]
tane has quit [Quit: Verlassend]
avsm1 has joined #ocaml
avsm1 has left #ocaml []
smondet has quit [Quit: bye bye]
mcclurmc has joined #ocaml
xavierm02 has quit [Remote host closed the connection]
tchell has quit [Ping timeout: 245 seconds]
tchell has joined #ocaml
wormphlegm has quit [Remote host closed the connection]
wormphlegm has joined #ocaml
Drup has quit [Quit: Leaving.]
malo has quit [Quit: Leaving]
thomasga has joined #ocaml
thomasga has quit [Client Quit]
palomer has joined #ocaml
jayprich has joined #ocaml
wormphlegm has quit [Read error: Operation timed out]
wormphlegm has joined #ocaml
anemator has joined #ocaml
anemator has quit [Client Quit]
mort___ has joined #ocaml
anemator has joined #ocaml
<anemator> hi all, is there an ocaml equivalent to python's virtualenv?
palomer has quit [Read error: Operation timed out]
<whitequark> opam ?
<anemator> opam is almost what i'm looking for except it installs everything in my home directory.
anemator has quit [Quit: Page closed]
<dsheets> uhh... -r ROOT
<dsheets> but anemator was too impatient
palomer has joined #ocaml
pzv has quit [Ping timeout: 256 seconds]
pkrnj has quit [Quit: Computer has gone to sleep.]
osa1_ has joined #ocaml
ollehar has joined #ocaml
osa1 has quit [Ping timeout: 240 seconds]
osa1_ is now known as osa1
jayprich has quit [Quit: jayprich]
pkrnj has joined #ocaml
<palomer> I hope someone answered anemator's question
pzv has joined #ocaml
<mfp> * anemator has quit (Quit: Page closed)
<mfp> <dsheets> uhh... -r ROOT
<mfp> <dsheets> but anemator was too impatient
<dsheets> or $OPAMROOT even
palomer has quit [Read error: Operation timed out]
ontologiae has joined #ocaml
dsheets has quit [Ping timeout: 240 seconds]
ollehar has quit [Ping timeout: 264 seconds]
ollehar has joined #ocaml
eikke has joined #ocaml
ontologiae has quit [Ping timeout: 240 seconds]
Simn has quit [Quit: Leaving]
dsheets has joined #ocaml
mort___ has quit [Quit: Leaving.]