<mrvn>
anyway, using inotify with make is a nice idea but not something I would call a revolutionary new concept
<pippijn>
the revolutionary new concept was "inverting the arrows"
<pippijn>
so instead of having a dependency of foo.o -> foo.c
<pippijn>
you have a "can build" arrow for foo.c -> foo.o
<pippijn>
omake has both
<pippijn>
my build system (makequick) has the inverted arrow, too
<pippijn>
it's useful to have an idea of everything that can be built, because you can do wildcard operations on non-existant but buildable files
osa1 has quit [Remote host closed the connection]
<mrvn>
The .c -> .o makes actually more sense I think. In make you have .o being build from 100 different sources and then you have to search and search till you find one that actually exists or is buildable through any number of rules.
osa1 has joined #ocaml
Xom has quit [Quit: ChatZilla 0.9.90.1 [Firefox 22.0/20130618035212]]
<pippijn>
right
chrisdotcode has quit [Remote host closed the connection]
<pippijn>
and producing the complete "buildable" graph is reasonably fast
<pippijn>
but anyway, that can be saved in a db
<mrvn>
Also the patterns I can think of right now are not "can build" but "does build".
<pippijn>
so you only need to do it once
<pippijn>
most things that can be built are in fact built
<mrvn>
hmm, *.ml files have a "can build". They can .cmo or .cmx depending on what you use.
<pippijn>
more interestingly, they can build .cmi
<pippijn>
but not if a .mli exists
<mrvn>
yeah, that is even more complex
<mrvn>
They can build .mli too with -i
<pippijn>
the .cmo/.cmx thing is just a parse time conditional
<pippijn>
but the mli thing is at runtime
<pippijn>
ocamllex produces .ml from .mll, ocamlyacc produces .ml and .mli from .mly
<pippijn>
you can't trivially know whether you want to build a .cmi from .ml or from .mli
<mrvn>
but those are simple again. it always produces exactly those
<pippijn>
my point was the last sentence
<pippijn>
it's a runtime thing, you can't decide it at makefile parse time
<pippijn>
you need to build the graph to know it
<mrvn>
If you have an .mll file then .cmi is build from .ml. With .mly it is produced from .nli
<pippijn>
yes
<pippijn>
and you know this only after building the graph
<mrvn>
I call that parse time
<pippijn>
I disagree
<pippijn>
but if you like that, fine
<pippijn>
then I'll introduce a preprocessing time
<pippijn>
which evaluates the if/ifdefs
<pippijn>
because that is what decides whether a .cmx or .cmo or both are built
<mrvn>
graph building time is probably better
<pippijn>
that was the point of my distinction
<pippijn>
whether .cmx is built is known before the graph has been built
<mrvn>
but you said you would save that in a db so later at runtime you don't have to build it again
<mrvn>
lets call that build time
<pippijn>
ok, so we have a parse time, a graph building time, and a build time
<mrvn>
and then we all agree
<pippijn>
:)
<mrvn>
Now tell me how to get oasis / myocamlbuild to output "ocamlc -i" stuff for each .ml file
<mrvn>
I hate writing .mli files.
<pippijn>
ocamlbuild $(find . -name "*.ml" | sed -e 's/\.ml/.inferred.mli/')
<pippijn>
or something :)
<pippijn>
you may want to exclude _build
<pippijn>
after that, you can copy the .inferred.mli to your source tree and rename them to .mli
avsm has quit [Quit: Leaving.]
<mrvn>
Ocamlbuild knows of no rules that apply to a target named gui/src/widget.infered.mly. This can happen if you ask Ocamlbuild to build a target with the wrong extension (e.g. .opt instead of .native) or if the source files live in directories that have not been specified as include directories.
<pippijn>
mli, not mly
<mrvn>
That is the error from % ocamlbuild gui/src/widget.infered.mli
<pippijn>
inferred, not infered
<mrvn>
ahh, much better
osa1 has quit [Remote host closed the connection]
<mrvn>
thx. that helps a lot.
chrisdotcode has joined #ocaml
wmeyer has quit [Ping timeout: 264 seconds]
chrisdotcode has quit [Remote host closed the connection]
Drup has quit [Quit: Leaving.]
oriba has quit [Quit: oriba]
xuser has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
darkf has joined #ocaml
dsheets has quit [Read error: Operation timed out]
oriba has joined #ocaml
oriba has quit [Read error: Connection reset by peer]
manud has joined #ocaml
djcoin has quit [Quit: WeeChat 0.4.0]
q66 has quit [Quit: Leaving]
xuser has left #ocaml []
ygrek has joined #ocaml
Xom has joined #ocaml
manud has quit [Ping timeout: 245 seconds]
manud has joined #ocaml
manud has quit [Ping timeout: 256 seconds]
manud has joined #ocaml
Xom has quit [Quit: ChatZilla 0.9.90.1 [Firefox 22.0/20130618035212]]
<ggole>
There's a good "reduction" joke in there somewhere
<wmeyer>
should have a lambda picture on the bottle ideally
<wmeyer>
"moderate malty" nice
Kakadu has quit [Ping timeout: 268 seconds]
* adrien
sends a crate of stouts to wmeyer
<adrien>
beer + coffee :P
<wmeyer>
i'd prefer just beer with little bit of coffee flavour
<wmeyer>
actually in small bottles, that's good, crate is good from time to time (once we finish commiting cross compiler patches I definitely need a crate of stout)
<adrien>
working on them :P
<adrien>
but some of the code is more than a decade old, with all the organic growth around it that you can imagine :P
<adrien>
and Jacques Garrigue made driver/ocamlcomp.sh.in, an ugly hack :P
<wmeyer>
:)
<adrien>
I'm pretty sure it killed build times on windows though
<adrien>
basically it's a shell script that will redirect to either ocamlc or ocamlc.opt and either ocamlopt or ocamlopt.opt
<adrien>
somewhere in the makefiles, there are calls to sed to set that
<adrien>
so, quite dirty global effect
<adrien>
and on windows, it means spawning an intermediate bash
<wmeyer>
:O
<adrien>
and it's from 2002; not even sure it still brings any improvement
<wmeyer>
actually the only thing which is worries are these complicated shell scripts
<adrien>
a recursive function which returns i if "f i" is true, or does a recursive call
yacks has quit [Quit: Leaving]
<dsheets>
let search f n = let rec loop k = if k = n then n else if f k > 0 then k else loop (k+1) in loop 0;;
yacks has joined #ocaml
<bernardofpc>
wouldn't an exception be a "more direct" imperative OCaml translation ?
<adrien>
if you want imperative, yes
<adrien>
but typical ocaml would be with a list and a (tail)rec function
ulfdoz has quit [Ping timeout: 245 seconds]
wwilly has quit [Remote host closed the connection]
<adrien>
I think that removing the ocamlcomp{,opt}.sh kludge reduced build times (without ocamlbuild and camlp4 and with ccache) from 5m20s to 4m20s \o/
<adrien>
(and on windows it should save 5 minutes)
<mrvn>
introom: you wouldn't write such code in python in the first place
<introom>
mrvn: what?
<mrvn>
introom: 1) you would use xrange, 2) return n is bad, raise Not_found, 3) you probably would have an enumeration to search instead of f
<mrvn>
i=0; for x in f: if x > 0: return i; i +=1; raise
<introom>
mrvn: haha. 1) I use python3 for personal coding. 2) an exercise, logically requires that 3) f is a function
<mrvn>
introom: It's always surprising how bad execises are
<introom>
mrvn: no, the exercise requires to write ocaml. For simplicity, I translated it into python first and then ask here.
<mrvn>
In python3 range == xrange, right?
<introom>
yes.
<mrvn>
I would return None if not found and Some x if something is found. Or raise Not_found.
<adrien>
mrvn: I think the only purpose is to show some simple imperative code that is easy to read
<adrien>
and then convert it to functional/recursive
<introom>
yeah.
<adrien>
and I believe it managed to do that
<introom>
I am kinda not familiar with ocaml syntax.
<mrvn>
adrien: yeah, your code is fine. It translates the python code.
manud has quit [Ping timeout: 264 seconds]
<adrien>
my code? :P
<introom>
dsheets's code
<mrvn>
exception Found of int let search f n = try for i = 0 to n -1 do if f(i) > 0 then raise (Found i); done; n with Found i -> i;;
<mrvn>
adrien: sorry dsheets's code
<mrvn>
introom: ^^ if you want imperative style
<introom>
mrvn: for i to is also supported.
<introom>
I may encounter that later in the tutorial.
<mrvn>
It's too bad ocamls for/while loops don't have a break statement.
<mrvn>
using an exception to escape the loop always feels wrong for me.
<adrien>
isn't there going to be support to do this in a light way?
<bernardofpc>
yeah, intriguing that the imperative style is a bit "cramped"
<mrvn>
well, imperative style has for/while not returning a value. So "break i" to return a result doesn't quite fit. Would be damn usefull in practice though.
<bernardofpc>
well, for/while serve to side-effects
<bernardofpc>
break stops the side-effects early
<mrvn>
bernardofpc: raise too
<bernardofpc>
yeah, but raise looks like an "error" to me
<mrvn>
The only difference would be that break would have no (visible) try block and could be cheaper sinec you wouldn't need a stack backtrace and such.
<ggole>
How would for return a (non-unit) value? Seems like an strange idea.
<ggole>
And what happens if you fall off the end, do you get an exception?
<ggole>
I guess it would make short-circuiting search a bit easier to program
transfinite has quit [Quit: transfinite]
yacks has quit [Quit: Leaving]
<introom>
how to implement a dict with ocaml?
<ousado>
you can use Map or Hashtbl
<introom>
if I want to implement it on my own?
<ggole>
Either write a functor and take hash/eq operations as an argument, or use the built-in polymorphic operations
<ousado>
uhm.. look at their implementations? Or google for functional datastructures?
<introom>
the Introduction to OCaml doesn't provide answers publicly is really a pain.
<introom>
ot, what are you doing with ocaml?
<bernardofpc>
a log parser, for me
<bernardofpc>
(mostly I'm learning, ocmpared to the guys here developping ocaml environment ;-))
<introom>
I am learning it these days. so, it's also a ocaml-dev channel here.
<adrien>
question about ocamlbuild: what does this do: ["stdlib/std_exit"-.-C.o] ,
<adrien>
?
zpe has joined #ocaml
<introom>
where can I find square root function?
<adrien>
there's "sqrt", for floats
<ggole>
It's in Pervasives. You should download or bookmark the reference, it is useful for answering such questions.
<introom>
yeah. thanks.
zpe has quit [Ping timeout: 264 seconds]
Drup has joined #ocaml
fds has quit [Read error: Operation timed out]
<adrien>
I think I'm going to put an electric collar on wmeyer to make him come back to IRC :P
fds has joined #ocaml
habnabit has joined #ocaml
leroux_ has joined #ocaml
gereedy has quit [Ping timeout: 240 seconds]
cdidd has quit [Ping timeout: 240 seconds]
leroux has quit [Ping timeout: 240 seconds]
_habnabit has quit [Ping timeout: 240 seconds]
gereedy has joined #ocaml
leroux_ is now known as leroux
cdidd has joined #ocaml
wmeyer has joined #ocaml
zpe has joined #ocaml
<adrien>
wmeyer: \o/
<adrien>
wmeyer: it looks like ocamlbuild expects (or expected) ocamlc.opt, ocamlopt.opt, stdlib/, ... to be in _build/
<adrien>
wmeyer: any idea why/what for?
shinnya has joined #ocaml
<introom>
what's the unary addition for, ~+
<adrien>
wmeyer: also, how do I regenerate boot/myocamlbuild.boot?
<introom>
~+3 is just 3, any use scenario?
zpe has quit [Ping timeout: 240 seconds]
<ggole>
Just there to match ~- afaik.
wmeyer has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
Kakadu has joined #ocaml
gnuvince- has joined #ocaml
gnuvince- has quit [Changing host]
gnuvince- has joined #ocaml
ben_zen has joined #ocaml
introom has quit [Remote host closed the connection]
zpe has joined #ocaml
introom has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
ollehar has joined #ocaml
Neros has joined #ocaml
gautamc has quit [Read error: Connection reset by peer]
Neros has quit [Read error: Connection reset by peer]
gautamc has joined #ocaml
Neros has joined #ocaml
introom has quit [Remote host closed the connection]
Guest84602 is now known as amiller
amiller has quit [Changing host]
amiller has joined #ocaml
gnuvince- has quit [Ping timeout: 276 seconds]
manud has joined #ocaml
ulfdoz has joined #ocaml
Nahra has quit [Ping timeout: 264 seconds]
introom has joined #ocaml
dsheets has quit [Ping timeout: 264 seconds]
Neros has quit [Remote host closed the connection]
Neros has joined #ocaml
introom has quit [Remote host closed the connection]
ben_zen has quit [Ping timeout: 264 seconds]
Xom has joined #ocaml
osnr has quit [Quit: leaving]
omar_ has joined #ocaml
omar_ has quit [Client Quit]
darkf has quit [Quit: Leaving]
osnr has joined #ocaml
iZsh has quit [Quit: Coyote finally caught me]
wmeyer has joined #ocaml
<adrien>
wmeyer!
<adrien>
you broke trunk! :P
<wmeyer>
I broke trunk? :P
<wmeyer>
<wmeyer> hey adrien, sorry afternoon nap
<wmeyer>
<wmeyer> well, [make boot] will generate it
<wmeyer>
<wmeyer> and we want to get rid of this code [18:07]
<wmeyer>
<wmeyer> and actually use just plain makefiles to compile ocamlbuild
<wmeyer>
<wmeyer> without *any* bootstrapping
<wmeyer>
<adrien>
I believe you didn't re-generate boot/myocamlbuild.boot after you've enabled -use-ocamlfind by default
<adrien>
which made you not notice an issue
<adrien>
and when I've wanted to re-generate that file, I did notice the issue :P
<wmeyer>
:D
<adrien>
wmeyer: ocamlbuild/ocaml_specific.ml has this code:
<adrien>
let () = if !Options.use_ocamlfind then begin
<adrien>
[ do some stuff relying on ocamlfind ]
<adrien>
but since it's a toplevel statement, it's executed when the module is loaded
<adrien>
and before Options.use_ocamlfind has had a chance to be set to "false" by -no-ocamlfind
<adrien>
that's a guess but it seemed pretty liekly
<adrien>
likely
<adrien>
I didn't look at why but only the A"-linkpkg" stuff was causing an issue
<wmeyer>
OK, let me check it
<adrien>
I had "ocamlc" called with "-linkpkg"
<adrien>
thanks :-)
Neros has quit [Read error: Operation timed out]
avsm has joined #ocaml
wmeyer has quit [Ping timeout: 264 seconds]
tane has quit [Quit: Verlassend]
madroach has quit [Quit: leaving]
ollehar has quit [Ping timeout: 264 seconds]
contempt has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
contempt has joined #ocaml
gnuvince- has joined #ocaml
Nahra has joined #ocaml
Nahra has quit [Changing host]
Nahra has joined #ocaml
<chris2>
for a simple fixed string -> fixed string replacement with ocaml-core, do i really need re2?
<adrien>
I don't know core but if you're worried about regexps being "too much", iirc, re is very fast
<adrien>
like _very_
<chris2>
yeah, but i just want to replace '' with '
<chris2>
it seems like overkill :)
ollehar has joined #ocaml
<orbitz>
shoudl be pretty easy to write inefficeinclty
ulfdoz has quit [Ping timeout: 245 seconds]
<chris2>
i think i can just use String.escape
<chris2>
erm unescape
avsm has quit [Quit: Leaving.]
ggole has quit []
ygrek has quit [Ping timeout: 268 seconds]
Neros has joined #ocaml
avsm has joined #ocaml
dsheets has joined #ocaml
mfp has quit [Ping timeout: 245 seconds]
wormphlegm has quit [Ping timeout: 256 seconds]
wormphlegm has joined #ocaml
habnabit is now known as _habnabit
mfp has joined #ocaml
wormphlegm has quit [Ping timeout: 268 seconds]
wormphlegm has joined #ocaml
Xom has quit [Quit: ChatZilla 0.9.90.1 [Firefox 22.0/20130618035212]]
speredenn has joined #ocaml
Neros has quit [Remote host closed the connection]
Kakadu has quit []
tane has joined #ocaml
ulfdoz has joined #ocaml
wmeyer has joined #ocaml
<wmeyer>
hello adrien
wmeyer has quit [Remote host closed the connection]
contempt has quit [Ping timeout: 268 seconds]
contempt has joined #ocaml
ta`e has joined #ocaml
malo has joined #ocaml
tane has quit [Ping timeout: 240 seconds]
contempt has quit [Ping timeout: 264 seconds]
contempt has joined #ocaml
dsheets has quit [Ping timeout: 256 seconds]
speredenn has quit [Quit: Leaving]
yacks has joined #ocaml
pango has joined #ocaml
dsheets has joined #ocaml
iZsh has joined #ocaml
iZsh has quit [Excess Flood]
iZsh has joined #ocaml
jdoles has joined #ocaml
<jdoles>
Is it possible to define structures in expressions in OCaml? So, let x = structure Foo...
<mrvn>
jdoles: that would be a module and they are first class now.
<mrvn>
or do you mean a record?
<levi>
OCaml's treatment of records and modules is leaving me a bit unsettled.
<jdoles>
mrvn: what I really want is to have a single initialization of a module from a run-time variable such that the scope of this module is global.
<levi>
What do you mean by the scope of the module?
<levi>
You mean you can access its members via Module.member from anywhere in the program?
<jdoles>
levi: yes
<mrvn>
then you need to 1) pass the module around as agrument, 2) initialize it before other modules needs it or 3) make a module option ref
<mrvn>
or module ref initialized to a dummy module at first
<mrvn>
Initializing global state is quite difficult in ocaml.
<mrvn>
at runtime at least
<levi>
jdoles: Does the module itself need initialization, or just an instance of a data type managed by that module?
<jdoles>
mrvn: yes, never mind.
<mrvn>
jdoles: note that a module is just wrapping. a golbal int needs exactly the same method as a varian, record, module or whatever
watermind has joined #ocaml
<levi>
The base module system provides two things, namespace structuring and controlled information hiding/sharing.
<levi>
When you add in functors, you get an extra degree of flexibility, but it's essentially a concise way of describing a set of related modules and allowing you to select only the ones you need from that set.
<levi>
And I have not yet wrapped my brain around first-class modules, so I won't say anything about them.
malo has quit [Quit: Leaving]
pango_ has joined #ocaml
pango has quit [Ping timeout: 240 seconds]
osa1 has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
osa1 has quit [Ping timeout: 240 seconds]
ben_zen has joined #ocaml
osa1_ has joined #ocaml
avsm has quit [Quit: Leaving.]
osa1_ has quit [Remote host closed the connection]