tobiasBora has quit [Quit: Konversation terminated!]
mfp has quit [Ping timeout: 246 seconds]
pkrnj has quit [Quit: Computer has gone to sleep.]
darkf has joined #ocaml
mort___ has quit [Quit: Leaving.]
zRecursive has joined #ocaml
turnersr has joined #ocaml
hinayana has quit [Quit: Quitte]
<turnersr>
Hi, I am working through examples of Okasaki's book on data structures. I am looking at the module for StackList https://bitbucket.org/mmottl/pure-fun/src/744d85f5220565e95c4f56688e1f2ef7e7095190/chp2.ml?at=default . And I do not understand how to evoke the append operator for the module's implementation. Also, is let (++) = (@), the example I am confused about, point free notation for OCaml?
<turnersr>
nvm
<turnersr>
I just got it. :)
<turnersr>
Why the parentheses around ++?
<turnersr>
And @?
ben_zen has joined #ocaml
Neros has joined #ocaml
<turnersr>
Is it standard practice to mix the infix and prefix notation for operators in OCaml?
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
chrisdotcode has quit [Remote host closed the connection]
q66 has quit [Quit: Leaving]
Xom has joined #ocaml
<Drup>
turnersr: ( xxx ) is the notation to turn the "xxx" infix operator into the associated function.
<Drup>
It's also this way you declare them
<turnersr>
Yep, makes sense. Making operators standard prefix standard practice? I error if I try to do let ++ = @.
<turnersr>
Although I can let x = [1; 2; 3] @ [1;2;4;5];;
<Drup>
turnersr: you need the paranthesis to use infix operators as function, yes
<turnersr>
Drup: Thank you. I am curious why the change and if regular OCaml coders prefer one style over the other. In LISP, for example, it's clear. OCaml can go either way and do projects tend you use one over the other?
<Drup>
Not sure to see what style you are referring to. It's late for me, you will need to be a bit precise :D
<turnersr>
let x = [1; 2; 3] @ [1;2;4;5];;
<turnersr>
vs
<turnersr>
let x = (@) [1; 2; 3] [1;2;4;5];;
<Drup>
The syntax with paranthesis is not exactly making them prefix (you can also use prefix operators, starting with a ! character), they are plain real function than you can pass as argument
<Drup>
However, I never saw anyone use infix operators like the second way :)
<turnersr>
But does seem natural in this example
<turnersr>
let y = ListStack.cons 1 ListStack.empty in let x = ListStack.cons 2 ListStack.empty in let h = (ListStack.(++) y x) in ListStack.tail h;;
<Drup>
or ListStack.( y ++ x)
<Drup>
wich is clearer, IMO
<turnersr>
Yea, I like that better!
<Drup>
which*
<Drup>
"ModuleFoo.( bla )" is exactly like "let open Module Foo in bla"
<Drup>
ModuleFoo*
<turnersr>
And we need the parens in order make ++ act like first-class function?
<Drup>
no, we need parens to delimit the local open
<Drup>
you could also write "ListStack.( cons 1 empty )", for example
<turnersr>
uhm, that makes sense given how you expand ModuleFoo.( bla ). Now I am still confused why the person needed to write let (++) = (@).
<turnersr>
let ++ = @ ought work, too?
<turnersr>
If does not of course.
<turnersr>
It*
<turnersr>
Because in ListStack.( y ++ x) we showed that ++ could be infix.
<Drup>
the transformation from infix operator to "function" with the parens notation is done at the *parser* level, in the expression "let ++ = @", from the parser point of view, ++ and @ are obviously not infix operator, hence syntax error
<yezariaely>
opam didn't generate documentation for a package after upgrading. How do I regenerate them?
<yezariaely>
I can call opam install -d batteries
thomasga has quit [Read error: Connection reset by peer]
<yezariaely>
but this says "already installed"
thomasga1 has joined #ocaml
<yezariaely>
Can I force it to reinstall somehow?
weie has joined #ocaml
chambart has joined #ocaml
mfp has joined #ocaml
yacks has joined #ocaml
<yezariaely>
found opam reinstall, never mind ...
mort___ has quit [Remote host closed the connection]
<yezariaely>
but it does not install the docs :/ opam reinstall -d batteries does not create docs. :/
<gasche>
kerneis: where are you on .mllib?
<gasche>
(thanks for the whining on the testsuite, that's helpful)
<gasche>
yezariaely: do you have experience with opam installing docs for batteries before?
<gasche>
building Batteries doc is slow and a bit painful; I wouldn't be highly surprised if the opam packages had disabled that part
<yezariaely>
gasche: I just ran a opam upgrade which installed batteries-2.1.0. Before, there was batteries-2.0.0 which automatically had docs installed. Now I installed docs manually from the build directory of opam by executing make doc which simply worked out of the box.
<yezariaely>
though neither opam install -d nor opam reinstall -d installs batteries' docs
<gasche>
I can't help you much, I know little about the batteries opam packaging
<gasche>
hm
<gasche>
do you often use the local html documentation?
<yezariaely>
regularly, I work on my laptop
<gasche>
I'm not trying to help but genuinely curious; I assumed most people either browsed the web online, or looked at the .mli files directly
<yezariaely>
and I know that the docs I use match the version I use ;)
<gasche>
does Batteries install its .mli in the relevant place?
<yezariaely>
emh, probably.
<yezariaely>
yes, it does.
<yezariaely>
but I rather look at a properly formatted html doc with links than in a mli file.
<gasche>
ok
<yezariaely>
anyway, thx
weie_ has joined #ocaml
vpit3833 has joined #ocaml
weie has quit [Ping timeout: 245 seconds]
vpit3833 has quit [Client Quit]
osa1 has joined #ocaml
contempt has quit [Ping timeout: 240 seconds]
<kerneis>
gasche: ok, the ml -> mllib approach is broken I think
skchrko has joined #ocaml
<gasche>
:'(
<kerneis>
there is simply no way to take into account every possible dynamic dep
<kerneis>
if the user has a custom myocamlbuild.ml
<kerneis>
but I'm quite sure of the semantics of those rules in fact
<gasche>
+not?
<kerneis>
+not
contempt has joined #ocaml
<gasche>
one thing I noticed is that when you have a rule foo -> bar
<gasche>
ocamlbuild is a bit ad-hoc in adding the tags of "foo", or of "bar", to the compilation command
<kerneis>
too bad you're so far away, we badly need a whiteboard :-(
<gasche>
:D
<gasche>
Rocquencourt certainly is in the country, but I don't feel like I'm the one that got the farthest away :-'
<gasche>
I don't understand what the problem with dynamic dependencies are, do you have an example ?
<kerneis>
yes
<gasche>
*problems
<kerneis>
let me think 2 sec
<kerneis>
there are 2 issues I think
<kerneis>
1/ to generate a static library (.cma, since cma must act as both static and dynamic, or .cmxa)
<kerneis>
you need to know the complete list of dependencies
<kerneis>
you cannot derive that from the ml file alone
<kerneis>
because of ocamlbuild's dynamic rules
<kerneis>
this is a particular instance of the more general problem that there is no way to get the list of depencies of a target
<kerneis>
2/ to generate a dynamic library (.cmxs)
<kerneis>
there, a single call to ocamlopt -shared -linkall is enough
<kerneis>
that's the current cmx -> cmxs rule
<kerneis>
the problem is... no maybe there is no problem in that case
<gasche>
the confusing between static and dynamic linking for cma and is the subject of a PR by Daniel
<gasche>
*confusion
<kerneis>
yes
<kerneis>
it's extremely annoying
<kerneis>
but it wouldn't solve this issue, only make it possible to generate "cms" easily
<kerneis>
the problem remains for cmxa and "actual cma"
<gasche>
I've actually been thinking of adding a .cmos target
<gasche>
but let's not digress
<kerneis>
so let's backtrack to the root of the issue:
<kerneis>
if you have an mllib and it fails for some reason, but is named similarly to an ml, then cmo -> cma kicks in
<kerneis>
and produces something incomplete (the transitive closure of your cmo)
ollehar has quit [Ping timeout: 246 seconds]
<gasche>
I think what you're saying is that with .cmo -> .cma (or .cmo -> .mllib) one has access to the dependencies of the module, from the .cmo, while they're missing from the .ml file alone
<kerneis>
yes
<kerneis>
(although with cmo -> mllib I don't know how to get them in fact)
<gasche>
well
<gasche>
hm
<gasche>
but do we really need to write those deps in the .mllib file?
darkf_ has joined #ocaml
<kerneis>
yes
<gasche>
I thought the .mllib -> .cma rule would take care of including the dependencies from the listed modules
darkf has quit [Ping timeout: 264 seconds]
<kerneis>
ha, maybe…
<gasche>
(contrarily to .mldylib)
<kerneis>
hmm
<kerneis>
interesting
<kerneis>
so maybe it works after all
<gasche>
hm
<gasche>
kerneis: I will push some other changes to ocamlbuild today
<kerneis>
no problem
<kerneis>
does it change behaviour?
<gasche>
but probably not risky changes in after that
<gasche>
so I think we have three options
<kerneis>
I'm fine with waiting for 4.01.1
<gasche>
ok
<gasche>
the options where more or less
<kerneis>
this is an important issue, so let's fix it correctly directly
Yoric has joined #ocaml
<gasche>
push it today, only have it in trunk (when it's ready), or devise a less invasive fix for now and do the rest later
<gasche>
(eg. we could have various .foo.cmo -> .mllib for now, and do the factorization only in trunk)
<kerneis>
(or you can apply my "works maybe current patch" and wait for screaming users to fix in next release or force people to write explicit mllib and mldylib :-)
<gasche>
that's more or less option (1), "push it today", except I would require unit tests (instead of future screaming users)
<gasche>
if you are willing to wait, I won't press you
<kerneis>
I'll try and write some now anyway
<kerneis>
that's while doing it that I realized this potential issue
<gasche>
if you want some reading and thinking in between the .mllib stuff, I'll welcome any comment
<yezariaely>
hmm I expected a != b to be the same as: not (a = b) though I have a counter example :/
<gasche>
(my goal is to do something minimally invasive, and still providing the basic brick for a *possible* plugin ecosystem after 4.01)
<yezariaely>
what is the semantics of both
<yezariaely>
?
<gasche>
yezariaely: you want to use (<>)
<kerneis>
yezariaely: not (a==b) ~ a!=b
<yezariaely>
ah!
<yezariaely>
so != corresponds to == ?
<kerneis>
yes
<yezariaely>
grml :/
<gasche>
it would be nice if we had docstrings for OCaml
<gasche>
it may be possible in the extension-points branch
<kerneis>
docstrings?
<gasche>
a special comment on each signature item
<gasche>
as in Python or Emacs
<gasche>
users could ask "#doc (!=);;" in the toplevel
<yezariaely>
yes, that would be indeed nice.
<kerneis>
gasche: couldn't you (ab)use ocamldoc for this?
<kerneis>
ah, you want to preserve it in the bytecode
<gasche>
not necessarily, querying .cmti files would be an obvious choice
<gasche>
OCamlbuild produces .odoc files, I don't know exactly what they have inside but that could be possible as well
mort___ has joined #ocaml
<gasche>
so yes, it may be possible to implement it today already
mcclurmc has joined #ocaml
q66 has joined #ocaml
<kerneis>
no idea, it just sounds like something ocamldoc has been designed for
<kerneis>
(documenting interfaces)
<kerneis>
gasche: there is a problem with "failing_msg"
<kerneis>
if one is provided, we should check that the execution fails indeed
<kerneis>
if you agree, I'll make a patch
<kerneis>
(I need it right now anyway)
darkf_ is now known as darkf
<kerneis>
(oh, or I can add a "not file" to check that a file is not here, works too)
Yoric has quit [Read error: Connection reset by peer]
milosn has joined #ocaml
chris2_ has joined #ocaml
NaCl_ has joined #ocaml
mort___ has quit [*.net *.split]
zpe has quit [*.net *.split]
milosn_ has quit [*.net *.split]
asmanur has quit [*.net *.split]
fds has quit [*.net *.split]
IbnFirnas has quit [*.net *.split]
ggherdov has quit [*.net *.split]
chris2 has quit [*.net *.split]
Jenza has quit [*.net *.split]
NaCl has quit [*.net *.split]
mort___ has joined #ocaml
zpe has joined #ocaml
asmanur has joined #ocaml
fds has joined #ocaml
Jenza has joined #ocaml
<kerneis>
hmm, it's already the case in fact
bernardofpc has quit [Quit: leaving]
bernardofpc has joined #ocaml
ggherdov has joined #ocaml
yezariaely has quit [Ping timeout: 240 seconds]
Drup has joined #ocaml
bernardofpc has quit [Quit: Changing server]
yezariaely has joined #ocaml
bernardofpc has joined #ocaml
<Kakadu>
hi!
<Kakadu>
Can u tell me if concept of virtual machine's "warm-up" is applyable to OCaml native code runtime?
<gasche>
I don't think so Kakadu
<gasche>
well
Xom has joined #ocaml
<Kakadu>
I ask mecause my parser combinators runs seriously faster if I execute yacc parser before combinators
<Kakadu>
because*
<gasche>
it's probably an IO issue
<gasche>
like you parse a file, the first batch is from the disk, the second batch has the file in the filesystem memory cache
<gasche>
(in the general case as well there are various caching factors that may make hot code faster: the code is in cache, the memory is in the TLB cache, etc.)
<Kakadu>
Any ideas how to verify your assumption?
<Kakadu>
copy input file with a different name and parse two identical input files?
_andre has joined #ocaml
<gasche>
Kakadu: well first try using yacc t wice, or using your parsing combinators twice, and see if the second run is faster
<ggole>
Virtual machines have a "warm up" period because they are busy compiling code as it becomes hot enough
<ggole>
OCaml definitely doesn't do that.
<Kakadu>
If I use combinators twice than second time is 50% faster than 1st one
<ggole>
Is this after compiling that binary?
<ggole>
It's probably just the OS caching things.
<Kakadu>
ggole: don't get your question...
<ggole>
If you see that behaviour immediately after compiling, that might indicate that it is not a paging issue
<ggole>
(Since that content is likely to be in the page cache.)
<gasche>
you can probably test this assumption by measuring the time for "cat theinputfile" as well
chambart has quit [Ping timeout: 246 seconds]
<Kakadu>
yeah , I have executed just after compiling
<ggole>
IIRC there is a way to ask Linux to drop certain bits of the page cache, so you might be able to test it.
<ggole>
If you are on Linux.
<gasche>
(and you can probably remove the overhead of the first version by adding a "cat theinputfile > /dev/null" before launching your program)
<Kakadu>
cat gives the same time
<Kakadu>
but my files is nt very big, 4.6M
<ggole>
sync && echo 3 > /proc/sys/vm/drop_caches
<ggole>
Probably easier just to run it a few times and take the later readings as more accurage.
<ggole>
*accurate.
<pippijn>
adrien: where's wmeyer?
<gasche>
I think he's in holidays
<pippijn>
oh
<gasche>
hm
<gasche>
I have no idea in fact
<gasche>
but that would be a good reason not to be very present, in the middle of August
<pippijn>
right, august
mort___ has quit [Quit: Leaving.]
introom has joined #ocaml
<Kakadu>
heh, `echo 3` really changes time results for cat
<Kakadu>
ggole: thanks
walter has joined #ocaml
<gasche>
I just pushed the "composable-ocamlbuild" patchset in trunk and version/4.01
<gasche>
this might introduce regressions (which will hopefully be catched when 4.01 beta is released and tested), but it should also have very positive effects on the ocamlbuild plugin ecosystem after 4.01 is released
<kerneis>
ack
<kerneis>
gasche: writing unit tests, seems to work so far
chris2_ is now known as chris2
<kerneis>
hmm, no
<kerneis>
what was I thinking?
yezariaely has quit [Quit: Leaving.]
<kerneis>
gasche: so I confirm that if you have a mllib, ocamlbuild does *not* take it's transitive closure for cma/cmx
<kerneis>
(cmxa/cmx I meant)
osa1 has quit [Ping timeout: 256 seconds]
<pippijn>
gasche: great
<pippijn>
gasche: composable ocamlbuild is what I need
<gasche>
people have been pushing to put this information in tags
<gasche>
something like
<pippijn>
rules in tags?
<gasche>
"true: plugin(noweb)"
<pippijn>
oh
<gasche>
but I don't really like that
<pippijn>
hmm
<pippijn>
I don't object to that idea
<gasche>
something we could consider is to have a header/body separation, as in say yacc/menhir
<pippijn>
why don't you like it?
<gasche>
some new declarative language, then %%, then tags as usual
<gasche>
well
<gasche>
the semantics of _tags is well-defined: it applies tags conditionally to some targets
<pippijn>
ah, yes
<gasche>
putting in this file global information that is not tag-related feels wrong
<pippijn>
makes sense
<pippijn>
I don't like the %% stuff
<pippijn>
for the reason you just explained
<gasche>
(my personal criterion for whether something should go in _tags is whether it makes sense to apply it to some targets only, or whether its very semantics is naturally global or already conditional)
<pippijn>
hmm
<pippijn>
actually
<gasche>
(eg. I don't think a cflags(foo) tag would make sense, because "cflags" already embodies a conditional meaning that is not tag-related)
Xom has quit [Quit: ChatZilla 0.9.90.1 [Firefox 22.0/20130618035212]]
<pippijn>
target-specific plugins do make sense
<pippijn>
but are probably not easy to implement in the current ocamlbuild code
<pippijn>
remember the conflict issue
<pippijn>
if you have one directory where fooprog needs to run to get .ml from .foo
<pippijn>
and another directory that needs foobarprog
<gasche>
you can write a plugin such that the precise program to be called is the parameter of a parametric tag
<pippijn>
you could load fooprog plugin in one directory, and foobarprog in another
<pippijn>
no, that's not what I mean
<pippijn>
I mean: you write a fooprog, and a .foo -> .ml rule
<gasche>
I see what you mean
<pippijn>
and I write a foobarprog, and a .foo -> .ml rule
<pippijn>
they are in conflict
<gasche>
but indeed I don't know how to have rules applied conditionally to some subtargets only
<pippijn>
right
<pippijn>
because myocamlbuild is global
<gasche>
yes
<pippijn>
that's a bit poor
<gasche>
I agree, but currently a lot of things are higher priority that trying to change that
<pippijn>
yes
<pippijn>
and I imagine that change would be non-trivial
IbnFirnas has joined #ocaml
<gasche>
kerneis: if you manage to get a good comprehension of some piece of code in ocamlbuild, patches to add comments are welcome
<kerneis>
ok
<kerneis>
gasche: what does for-pack do?
<gasche>
as a compilation option for the OCaml compiler itself?
<kerneis>
ah, I thought it was only an ocamlbuild flag
<gasche>
-for-pack blah marks the resulting .cmo as intended for packing into a larger module Blah
<kerneis>
ok
<kerneis>
this is not done automatically when you write mlpack files
<gasche>
kerneis: if you just read the code around caml_transitive_closure and link_gen, link_modules, I think now would be a good time to write a few comments explaining what they do
<gasche>
I'll happily include them upstream
<Kakadu>
TT
Neros has quit [Ping timeout: 248 seconds]
hyperboreean has quit [Read error: Operation timed out]
hyperboreean has joined #ocaml
smondet has joined #ocaml
osa1 has joined #ocaml
Yoric has joined #ocaml
yacks has quit [Read error: Operation timed out]
osa1_ has joined #ocaml
osa1 has quit [Ping timeout: 264 seconds]
travisbrady has joined #ocaml
wwilly has joined #ocaml
<wwilly>
bonjour
darkf has quit [Quit: Leaving]
introom has quit [Remote host closed the connection]
PM has quit [Ping timeout: 264 seconds]
<gasche>
kerneis: what about a target foo.inferred.mllib?
PM has joined #ocaml
<gasche>
I think that could solve our dilemma
tlockney has quit [Excess Flood]
<gasche>
we'd keep both .mllib and .mldylib strict in their listing of modules
<gasche>
but let users get the complete closure (re)computed for their convenience with .inferred.mllib
tlockney has joined #ocaml
tane has joined #ocaml
wwilly has quit [Quit: This computer has gone to sleep]
introom has joined #ocaml
osa1__ has joined #ocaml
osa1__ is now known as osa1
osa1_ has quit [Ping timeout: 245 seconds]
tlockney has left #ocaml []
hkBst has quit [Quit: Konversation terminated!]
yacks has joined #ocaml
dsheets has joined #ocaml
travisbrady has quit [Quit: travisbrady]
mort___ has joined #ocaml
watermind has joined #ocaml
<watermind>
are tuples always evaluated right to left?
<watermind>
or is it implementation dependent?
skchrko has quit [Quit: Leaving]
<ggole>
The manual says order of evaluation is undefined, iirc.
<kerneis>
gasche: that would definitely make sens
travisbrady has joined #ocaml
<gasche>
watermind: it is implementation depend, and may change in practice depending on whether you use the bytecode or native compiler
<gasche>
(I know one of the unspecified orders (arguments, tuples, let-and...) does change, but I'm very careful to forget which one, as it keeps me honest on the others as well)
Arsenik has joined #ocaml
introom has quit [Remote host closed the connection]
<kerneis>
gasche: I noticed today that trunk allows me to have several types with the same constructor
ygrek has joined #ocaml
<kerneis>
like type t = A | B; type u = A of int | B of float ;
<kerneis>
are you aware of it? is it really a new feature (as opposed to a strange bug)?
<gasche>
it is indeed a new feature
<gasche>
it has been discussed to death
<gasche>
ask Leo White
walter has quit [Quit: This computer has gone to sleep]
<fds>
Perhaps I should note (if it's not obvious) that I don't really know what I'm doing and I'm just trying to learn stuff as I go along.
<fds>
Maybe I just want <:expr< true >> and <:expr< false >>?
mort___ has quit [Quit: Leaving.]
gautamc has quit [Read error: Connection reset by peer]
gautamc has joined #ocaml
dsheets has quit [Ping timeout: 256 seconds]
<thomasga>
fds: or <:expr< True >> and <:expr< False >> if you use the revised syntax inside quotations (as it's usually the case)
Yoric has joined #ocaml
Arsenik has quit [Remote host closed the connection]
Yoric has quit [Read error: Connection reset by peer]
Neros has joined #ocaml
<fds>
thomasga: Hrm, well, at the moment I'm using the original syntax, since that's what he has in the tutorial. I think I'm closer to getting something working, but now I have "Error: The type of this expression, '_a formula Camlp4.PreCast.Gram.Entry.t, contains type variables that cannot be generalized". Do you think it's worth pastebinning my code here?
<thomasga>
don't have much time to help you know unfortunately
<thomasga>
(sorry)
thomasga has quit [Quit: Leaving.]
<fds>
...Too late, but thanks anyway. :-)
thomasga has joined #ocaml
<fds>
thomasga: I understand; thanks anyway.
_andre has quit [Quit: leaving]
djcoin has quit [Quit: WeeChat 0.4.0]
tlockney has joined #ocaml
mort___ has joined #ocaml
manud has joined #ocaml
wwilly has quit [Quit: This computer has gone to sleep]
mort___ has quit [Quit: Leaving.]
joostvb has quit [Ping timeout: 246 seconds]
joostvb has joined #ocaml
joostvb is now known as Guest76158
vpm has quit [Ping timeout: 246 seconds]
Snark has quit [Quit: leaving]
ollehar has quit [Ping timeout: 264 seconds]
vpm has joined #ocaml
<gasche>
fds: still have your camlp4 problem?
<gasche>
the "contains type variables that cannot be generalized" probably means that you have an unused grammar entry lying around
q66 has quit [Quit: Leaving]
q66 has joined #ocaml
Neros has quit [Ping timeout: 276 seconds]
contempt has quit [Ping timeout: 240 seconds]
pango has quit [Remote host closed the connection]
contempt has joined #ocaml
travisbrady has quit [Quit: travisbrady]
pango has joined #ocaml
Simn has quit [Quit: Leaving]
<whitequark>
can I disable a warning using ocamlbuild tags?