myx has quit [Read error: Connection reset by peer]
myx_ has joined #ocaml
myx_ has quit [Ping timeout: 256 seconds]
myx has joined #ocaml
<tac_>
SuperNoeMan: you still there?
<SuperNoeMan>
tac_: yes omg
<SuperNoeMan>
thanks so much
<tac_>
what are you trying to do here exactly?
<tac_>
ah, defined ntimes, yeah?
<SuperNoeMan>
I've just updated the gist
<SuperNoeMan>
please reload :)
<SuperNoeMan>
yea, ntimes
<SuperNoeMan>
but I get the following error:
<SuperNoeMan>
Error: This expression has type 'a * 'b but an expression was expected of type 'c -> 'd
<SuperNoeMan>
and I don't know why...
myx has quit [Read error: Connection reset by peer]
<SuperNoeMan>
I think its because the interpreter sees the argument to the recursive call to f as a different type than what is received, but I don't know how to resolve the error...
<tac_>
Just a disclaimer. I don't know Ocaml, so the syntax I give may be a bit off :)
<SuperNoeMan>
ok
<tac_>
but basically
<tac_>
(compose f, (ntimes f, (n - 1))) is a pair
<tac_>
containing "compose f" and another pair, containing "ntimes f" and "n - 1"
<tac_>
In ocaml, you don't use commas to pass multiple arguments
<tac_>
try
<tac_>
compose f (ntimes f (n-1))
<SuperNoeMan>
tac_: thanks!
<tac_>
no problem
<tac_>
one last note
<SuperNoeMan>
I'll update the gist... one sec
<SuperNoeMan>
wait-I still get an error
<tac_>
you can also start at n=0 in this case
<SuperNoeMan>
(ntimes should be renamed to compose_n
<tac_>
what's the error?
<tac_>
ah yes
<SuperNoeMan>
tac_: yeah, I could do the composition in logarithmic time
<SuperNoeMan>
I know
<tac_>
oh, I wasn't thinking about that
<SuperNoeMan>
by dividing by 2 and continually doing f(f(...
<tac_>
but compose_n f 0 = id
sivoais has quit [Ping timeout: 240 seconds]
<tac_>
It's often a nice thing to start at 0 whenever doing recursion :)
<tac_>
also, in your definition of compose, you have a useless set of parentheses
<SuperNoeMan>
the error I get now is: Error: This expression has type 'a but an expression was expected of type 'b -> 'a The type variable 'a occurs inside 'b -> 'a
<tac_>
err wait no
<SuperNoeMan>
tac_: I need to leave the base case at 1, because if I don't then the definition is off
<tac_>
I think your compose is slightly wrong
myx has joined #ocaml
<tac_>
Think about in math notation: (f o g)(x) = f(g(x))
<SuperNoeMan>
tac_: yeah, but compose_n only receives one f
<SuperNoeMan>
so it's f(f( == f(f( in this case
<SuperNoeMan>
whether I switch h and g...
<SuperNoeMan>
won't matter
<SuperNoeMan>
or...
<tac_>
it's not about the order. Where's the x :)
Fabrizio has quit [Quit: This computer has gone to sleep]
<SuperNoeMan>
right, well I want my compose function to do composition on functions regardless of what type of arguments they are meant to receive
<SuperNoeMan>
so compose_n f 5 of f = x+2 should imply x+10-
<SuperNoeMan>
x+10;; *
myx has quit [Client Quit]
myx has joined #ocaml
<SuperNoeMan>
and compose_n x 2 where x = "boo" ^ s
<SuperNoeMan>
should produce "booboo" ^ s
<SuperNoeMan>
tac_: so I don't understand why I would give an x...
<smango>
What's the best practice for defining types? I don't want to repeat the definition in the ml and mli but it seems like I can't get ocaml to know what the types are without doing that
<SuperNoeMan>
smango: I thought mli files were generated by the compiler...
tac_ has quit [Ping timeout: 245 seconds]
<smango>
are they? I feel like people include them in source control all the time
<SuperNoeMan>
idk...
<SuperNoeMan>
I just know that when I do ocamlc on a .ml file, I get .mli files...
tac2 has joined #ocaml
<tac2>
SuperNoeMan: Computer froze. If you asked anything, I missed it.
<SuperNoeMan>
oh...
<SuperNoeMan>
sorry
<SuperNoeMan>
well, basically all I said was that I don't understand why I would put the x
<SuperNoeMan>
when I want my compose_n function to work regardless of the parameters of the function it is composing receive
myx has quit [Ping timeout: 246 seconds]
<SuperNoeMan>
I want compose_n to work whether f receives a string, 1 argument or 20 ints
<tac2>
ah.
<tac2>
I see what you're going for
<tac2>
So, if you DID add the x
<tac2>
what would the type of x be?
<SuperNoeMan>
well that, and I don't know that I should only add just one x. what about w, y, z, a,...
<SuperNoeMan>
you name it
<SuperNoeMan>
tac2: also, I noticed that when I change the else line to
<tac2>
SuperNoeMan: ah, but look at the types, my friend!
<tac2>
what type must f have?
<SuperNoeMan>
...
<tac2>
f : 'a -> 'a
<tac2>
f can't take multiple arguments
<tac2>
It can only take one
<SuperNoeMan>
oh...
<tac2>
Similarly, compose_n f n : 'a -> 'a
<SuperNoeMan>
man... idk. I've been staring at this problem
<tac2>
It can also only take one
<tac2>
It's ok. It happens to the best of us
<tac2>
But!
<tac2>
If 'a = (int, int, int, int, int)
<tac2>
(a quintuple of ints)
<tac2>
Then f is "sorta" like a function that takes 5 parameters (and must return 5 results)
<SuperNoeMan>
oh ok
<SuperNoeMan>
so, I don't have to worry about that.
<tac2>
right.
<SuperNoeMan>
I should just do what you said and add the x...
<SuperNoeMan>
but where do I add the x?
<tac2>
(f o g)(x) = f(g(x))
<tac2>
in math terms
<tac2>
which means compose f g x = .....
<SuperNoeMan>
right
<SuperNoeMan>
so at compose?
<tac2>
(it's just a matter of translation, see if you can get it :)
<tac2>
yeah
sivoais has joined #ocaml
<SuperNoeMan>
tac...
<tac2>
yeah?
<SuperNoeMan>
oh my gosh
<SuperNoeMan>
I got it to work
<SuperNoeMan>
woot.
<SuperNoeMan>
fuck yes
<tac2>
nice
<SuperNoeMan>
you are the bomb diggity
<tac2>
Is this for school? Or for fun?
<SuperNoeMan>
or at least to go through the compilation part
<SuperNoeMan>
yeah, but the professor said we could work in groups
<tac2>
cool
<SuperNoeMan>
so the fact that you explained it to me is great
<SuperNoeMan>
funtion currying is awesome
<tac2>
The nice thing about languages with good type systems is if you can get it into compile, you know at least it's not totally shit
<SuperNoeMan>
now I understand that without the compiler seeing the x, it can't know that f and g have some remaining arguments
silkwood has quit [Quit: Ex-Chat]
<SuperNoeMan>
tac2: lol that statement right there is what I mourn about python
<tac2>
yeah
<SuperNoeMan>
I dislike dynamic typing
<SuperNoeMan>
everything must have a type
<tac2>
fighting the type system can be frustrating
<tac2>
but it saves you from having to fight a much longer drawn out battle later on
<SuperNoeMan>
python may not give errors when you type it in, but it doesn't mean that they aren't there. you are only deferring that problem until runtime where it is way harder to find.
<tac2>
yup!
<tac2>
although, sometimes it's better to be able to run your code and inspect it. Interactivity is a great tool for learning.
<SuperNoeMan>
so, I read somewhere that ocaml doesn't have stack traces for exceptions
<SuperNoeMan>
does it?
<SuperNoeMan>
I don't have much experience with ocaml...
<tac2>
That I'm not sure about.... but sadly, the fact Ocaml has tail recursion kinda messes up stack traces
<tac2>
I have never written an Ocaml program :3
myx has joined #ocaml
<SuperNoeMan>
yeah, I'm kinda at a loss about how to do a lot of debugging, but I'm very new to ocaml
<tac2>
You'll have to ask someone else about that. But I do think Ocaml has a pretty nice step-debugger.
<SuperNoeMan>
tac2: I can't get ocamldebug to work via the command line
<tac2>
sad
<SuperNoeMan>
I"m a vim fan so I don't know how to make it interact with emac
<SuperNoeMan>
emacs...
<tac2>
yeah
<SuperNoeMan>
sorry, I should have said work well
<tac2>
The nice thing is you don't have to debug nearly so often
<SuperNoeMan>
I can step through, but I don't know how to get it to show the values of variables and the stack trace and a lot of stuff that I'm good at with C++ programs
<tac2>
yeah
<tac2>
The tools for functional languages are kinda lacking
<tac2>
Though they have a lot of potential
<tac2>
In another functional language called Agda, there's an emacs mode where you can leave "holes" in your code. And then you can ask "what is the type of the result I need in this hole?"
<SuperNoeMan>
I like functional languages though, I appreciate the ability to use functors
<tac2>
and fill it in interactively
<SuperNoeMan>
wow
<SuperNoeMan>
tac2: hey if you use vim, for the past 2 weeks I've been looking up plugins...
<tac2>
Haskell is supposedly getting "holes" in the next release as well
<SuperNoeMan>
I found an ocaml plugin for vim that integrates ocamldebug... or supposedly does
<tac2>
yeah.
<tac2>
I don't know much about plugins or anything
<SuperNoeMan>
tac2: wowcamldebug
<SuperNoeMan>
is what it is called
<tac2>
Even in Emacs (my primary unix editor), I rarely use anything more than the default mode
<SuperNoeMan>
vim plugins are incredibly easy to install
<SuperNoeMan>
just drop them in their appropriate place within ~/.viim
<SuperNoeMan>
~/.vim
<SuperNoeMan>
I presume you are familiar with *nix right?
<SuperNoeMan>
ah ok
<tac2>
yeah
Fabrizio has joined #ocaml
<tac2>
btw, in a pinch, if this channel is empty, you might want to try asking nicely in #haskell or #haskell-blah
<tac2>
Haskell is the most active functional programming channel on freenode
<tac2>
If it's for basic FP concepts, they will always be around, even if this channel is quiet
<SuperNoeMan>
ah ok
<SuperNoeMan>
thanks
sivoais is now known as sivoais_
<SuperNoeMan>
I thought I would get yelled at for organization-ocaml in #ocaml, haskell in #haskell
<tac2>
ok man
<tac2>
Good luck with Ocaml
<tac2>
I'm off for now
<SuperNoeMan>
tac2: thanks so much :) :) :)
myx_ has joined #ocaml
Zerker has joined #ocaml
myx has quit [Ping timeout: 252 seconds]
tac-tics has quit [Ping timeout: 245 seconds]
ulfdoz has joined #ocaml
SuperNoeMan has quit [Remote host closed the connection]
myx__ has joined #ocaml
myx_ has quit [Ping timeout: 248 seconds]
adotbrown has quit [Ping timeout: 244 seconds]
Yoric has joined #ocaml
myx_ has joined #ocaml
myx__ has quit [Ping timeout: 272 seconds]
Icarot has joined #ocaml
Zerker has quit [Remote host closed the connection]
Fabrizio has quit [Quit: Leaving]
ulfdoz has quit [Ping timeout: 248 seconds]
myx_ has quit [Ping timeout: 252 seconds]
myx_ has joined #ocaml
myx_ has quit [Ping timeout: 248 seconds]
ttamttam has joined #ocaml
sivoais has joined #ocaml
gour has joined #ocaml
<smango>
http://pastie.org/5809060 here test.ml gives the error "The expression has type int but an expression was expected of type Blah.thing." How do you do this?
mye has quit [Quit: mye]
adrien_oww has joined #ocaml
weie has quit [Quit: Leaving...]
invariant has joined #ocaml
<invariant>
Batteries supposedly has a composition operator. What's its name?
<flux>
invariant, people usually use module aliases instead. you could emulate partial opening with: module M = struct include BatPervasives let blahblah = blahblah end include M - but I think people rarely do this
<flux>
oops
<flux>
not include, but open
<invariant>
The really proper way to develop software would be to never open a third party module directly, but introduce a layer in between with your own names.
<invariant>
I don't think anyone does that, however.
<flux>
do you?
<invariant>
No
<invariant>
Perhaps when one would be developing a 10 million line system it would be a good idea.
<flux>
it has downsides, though. a new person reading the program now needs to learn the intermediate module, even if they already knew the actual dependency library.
<flux>
and they need to do that for each program they develope
<invariant>
Yes, and I suppose this is also why open-sourcing it can be a good idea.
Yoric has quit [Ping timeout: 252 seconds]
<flux>
so how does that scale? say you have 10 libraries you depend on, a few programs, and all those have different kind of intermediate libraries for the same libraries they use. obfuscation much?
bondar has joined #ocaml
<invariant>
flux, I think they call it abstraction :P
<invariant>
flux, but yes, I agree for a very large part.
<flux>
paraphrasing: all problems in computer programming can be solved by adding a new layer of abstraction. except the problem of too much abstraction.
<invariant>
I think the best way to solve these problems is to just make sure that the libraries don't need replacement.
<flux>
I think a good way to solve these problems is just not worry about it, and should the library need replacement, modify code. or then write the intermediate layer. code isn't written in stone.
<invariant>
Or to simply don't depend on too large surfaces.
<flux>
one could write an additional layer ahead if he can realistcially anticipate it needs exchanging at some point
AltGr has joined #ocaml
<invariant>
flux, did you heavily modify your Tuareg-mode?
<flux>
I think I haven't modified it at all..
<flux>
but I might also not be using the most recent version
<invariant>
I wrote some nice code to hide all those annoying copyright statements.
<invariant>
I don't get what's wrong with putting it in a COPYRIGHT file or something like that.
bondar has quit [Ping timeout: 256 seconds]
<flux>
maybe in an open source project the association between different files isn't as clear as the association between the contents of a single file
<flux>
(not to mention in my experience commercial vendors do that as well in closed source projects)
<flux>
(but at least they don't put a license to it, because, well, in general case you don't have one)
<invariant>
flux, you mean commercial vendors that sell a shrink wrapped product?
<flux>
yes
<flux>
or, say, phones
Cyanure has joined #ocaml
<flux>
in fact that's maybe there those per-file-things originate from
<flux>
the older the code the more pronounced the file headers seem
<invariant>
flux, how do you mean phones?
<flux>
cellulat phones
<flux>
cellular I mean
<invariant>
flux, yes, I got that part.
<flux>
they have a lot of software..
<flux>
developed internally..
<invariant>
flux, ok, so you worked on e.g. carrier software on phones?
<flux>
and that code also is written with per-file headers stating copyright. or maybe just a statement of copyright is file with you?
<invariant>
In the EU you don't need to write the words 'copyright' even.
<flux>
I've worked in a company that has subcontracted to a mobile phone vendor
<invariant>
Everything is copyrighted.
<flux>
I still think the worst offenders are the humongous signatures sometimes seen in the wild
<flux>
in emails that is
pippijn has quit [Quit: qq]
pippijn has joined #ocaml
<invariant>
flux, that's why you install some code on your computer to eliminate those.
<invariant>
flux, isn't that nice? Some computers adding text and others removing it again.
<flux>
well, that's what they are good at
hkBst has joined #ocaml
testcocoon has quit [Quit: Coyote finally caught me]
tac2 is now known as tac-tics
darkf has joined #ocaml
<invariant>
I seem to have a better uptime than my ISP, which is also rather disturbing.
jamii has joined #ocaml
testcocoon has joined #ocaml
hkBst_ has joined #ocaml
hkBst has quit [Ping timeout: 272 seconds]
<orbitz>
CUFP is Boston next year right?
<invariant>
OCaml says this is not exhaustive: let [a;b] = List.map a ["A";"B"]
<invariant>
The 'a' on the right hand side should be foo.
<adrien>
yes because it cannot say it is
<invariant>
foo is exception free.
<invariant>
It's a trivial theorem to prove.
<adrien>
there's a syntax extension for this and iirc it's something like "irrefutable patterns"
<adrien>
then please submit a patch to the compiler ;-)
<adrien>
(and there's certainly a mantis bug about that)
<adrien>
afk
ontologiae has joined #ocaml
adotbrown has quit [Ping timeout: 256 seconds]
Yoric has joined #ocaml
<invariant>
Is there something like a line macro for use in error messages?
<flux>
I think one of the campl4 modules that come with ocaml have that.. but I haven't used it.
<invariant>
Or some other way to get proper backtraces on Fatal errors.
<flux>
compile with -g, export OCAMLRUNPARAM=b
<invariant>
Why doesn't it show everything by default?
<flux>
apparently there's an associated runtime cost
jamii has quit [Ping timeout: 256 seconds]
myx has joined #ocaml
myx_ has joined #ocaml
myx has quit [Ping timeout: 272 seconds]
myx_ has quit [Read error: Operation timed out]
<orbitz>
invariant: you have to prove List.map though, which Ocaml doesn't know how to do unless you give it special knowledge
myx_ has joined #ocaml
myx__ has joined #ocaml
myx_ has quit [Ping timeout: 255 seconds]
myx_ has joined #ocaml
myx__ has quit [Ping timeout: 240 seconds]
myx__ has joined #ocaml
chambart has joined #ocaml
myx_ has quit [Read error: Operation timed out]
<invariant>
Is there any library to get variable bindings like X=123 from a file?
<invariant>
(I don't need to know how to write something like that.)
<adrien_oww>
depends on the portability you want
thomasga has joined #ocaml
<adrien_oww>
Marshal, yojson or another json library, sexplib, several binary marshalers, ...
<thizanne>
SuperNoeMan: there is a problem in your if - then - else
<thizanne>
you can only put one instruction between if and then
<SuperNoeMan>
what? that's a limitation of ocaml?
<SuperNoeMan>
wow that sucks
<thizanne>
if you want to put several, write if cond then begin f(); g() end else h ()
<thizanne>
you can replace begin ... end by ( ... )
<SuperNoeMan>
then begin ... end
tac-tics has joined #ocaml
<SuperNoeMan>
ok
<flux>
in any case, it's not probably doing what you want
<flux>
List.append acc [x]; will just throw the result away
<thizanne>
I don't know what language you're usually using, but it's exactly the same thing in C
<SuperNoeMan>
thizanne: ah ok
<SuperNoeMan>
thizanne: well now that you tell be about the begin ... end and ( ) part...
<SuperNoeMan>
I just thought for a second it was like.. no multi statements in if blocks evaaar
<SuperNoeMan>
lol :)
<thizanne>
yes but as flux said, your program is wrong anyway :)
<SuperNoeMan>
ok
<SuperNoeMan>
so...
<SuperNoeMan>
acc::x?
<flux>
supernoeman, what you want is to use fold to handle both your index and the resulting array
<flux>
oops, resulting list
sivoais_ has quit [Quit: leaving]
<flux>
well, at least for some value of 'want', it's the functional way ;)
<SuperNoeMan>
well, the specification of selectall is that I return elements for which f gives true for a given index
<SuperNoeMan>
so if I have ["a" ; "b" ; "c" ; "d"];;
<SuperNoeMan>
and f -> index mod 2;;
<flux>
the trick is having List.fold_left's value0 be (0, [])
<SuperNoeMan>
then I should have ["b" ; "d" ]
<flux>
then you take that index and list, and for the next round you give index+1 and the new list
_andre has joined #ocaml
<flux>
finally List.fold_left returns the index and the list and you discard the index
<SuperNoeMan>
ok
<SuperNoeMan>
wait...
<SuperNoeMan>
still trying to understand hold on...
<SuperNoeMan>
is the functor given to fold_left recursively called?
<SuperNoeMan>
because I thought that it was just called on each element...
<flux>
no.. I mean, how could it, unless you call it yourself..
<SuperNoeMan>
oh
<SuperNoeMan>
well I've never used fold_left before
<flux>
yes, fold_left applies the function for each element
<SuperNoeMan>
and I don't know where its definition is. I tried to find examples, but they didn't really help me understand what fold_left was doing...
<flux>
for the first value it calls let value1 = yourfunction value0 x
<ski>
anyway, i think what i did is basically the same as what flux suggested
Cyanure has quit [Ping timeout: 245 seconds]
jamii has quit [Read error: No route to host]
<fasta>
ski: there are tools to paste on github. Some of them are even built-in to debug environments.
_andre has joined #ocaml
<ski>
i see
<fasta>
ski: for example, people wrote tools to paste a method on github in a gist while being in an interpreter.
xavierm02 has joined #ocaml
<ski>
(nitpick, itym s/interpreter/interactor/)
Kakadu has quit []
trombi has joined #ocaml
<fasta>
ski: please write the Wikipeia article first.
<fasta>
ski: Wikipedia*
<fasta>
ski: until then I think it's just fine as it stands.
<fasta>
ski: I know what you mean, but I don't consider it to be incorrect.
<testcocoon>
SuperNoeMan: install oqamldebug from opam or GODI
<ski>
as long as you're aware of the distinction between compiler vs. interpreter, and batch vs. interactor
Cyanure has joined #ocaml
<SuperNoeMan>
testcocoon: dude, I wanted to so bad
<SuperNoeMan>
but it kept failing on not finding QApplication
<SuperNoeMan>
so I never got around to installing the QT SDK
<SuperNoeMan>
but I think I'm going to try and configure vim's ocamldebug integration XD
<SuperNoeMan>
and then go with oqamldebug from there :)
<testcocoon>
SuperNoeMan: what is your platform?
<SuperNoeMan>
I'm on OS X 10.7
<SuperNoeMan>
lion
<testcocoon>
SuperNoeMan: just install Qt SQK 4.8 from qt-project.org and then execute 'QMAKESPEC=macx-g++ opam install oqamldebug'
<SuperNoeMan>
ok
silkwood has joined #ocaml
<SuperNoeMan>
shouldn't opam detect that I'm on mac?
<SuperNoeMan>
I'd like to make a commit request so that others don't see the nasty error I got
<SuperNoeMan>
it should intelligently detect the QT SDK dependency isn't installed, and then tell the user what to do
tac has joined #ocaml
tac-tics has quit [Ping timeout: 245 seconds]
<testcocoon>
The problem is the default output of qmake which is not a Makefile when you use the official Qt SDK
Cyanure has quit [Remote host closed the connection]
<SuperNoeMan>
yeah, but you could just check for the file that QT is trying to include
<SuperNoeMan>
see if it exists
<testcocoon>
No, this is the job of qmake
<SuperNoeMan>
... can qmake's return status then just be checked?
<SuperNoeMan>
and just put something pretty on the terminal so that users see that?
<invariant>
oqamldebug installed in 1 minute. Not bad.
<SuperNoeMan>
ok I give up.
<invariant>
It could use a trivial call like $(which ocamldebug )however to configure it.
<SuperNoeMan>
:)
<invariant>
SuperNoeMan, just install a Linux VM for your OCaml hacking.
<testcocoon>
qmake generate a Makefile, it it does not work, no makefile a generated.
<invariant>
Is pkg-config something that also exists on a mac?
<testcocoon>
What do you want to print more? "No makefile please find why"
<invariant>
Everything which doesn't ship pkg-config configuration doesn't want to play nice with others imho.
<SuperNoeMan>
perhaps "Qt's qmake command did not generate a makefile, possibly because QT SDK is not installed"
<trombi>
Hi everybody, I'm trying to compile ocaml from sources but it somehow takes forever while processing camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
<thelema>
trombi: I assume you're compiling version 4.00; if you're not committed to using camlp4, you can disable it and the compiler will work fine without it
<trombi>
what do i have to disable, and how do i do it? :) I just did: make world.opt
<thelema>
./configure --no-camlp4
<trombi>
alright, will try that.. thanks.
<trombi>
that won't disable the optimization stuff, right? the ocamlopt-part
<thelema>
correct, calmp4 is a preprocessor system
<thelema>
*camlp4
<trombi>
right
<trombi>
thanks again
ttamttam has quit [Quit: ttamttam]
myx_ has joined #ocaml
hkBst_ has quit [Quit: Konversation terminated!]
SuperNoeMan has left #ocaml []
myx has quit [Ping timeout: 244 seconds]
pango is now known as pangoafk
ocp has joined #ocaml
philed has joined #ocaml
<philed>
Can anyone help me with the documentation generation with oasis? I'm getting lots of "module not found" warnings. Any idea what I'm supposed to do?
<thelema>
philed: one sec, trying to make doc in my oasis source dir
<thelema>
those warnings are fine; they're just for modules in the stdlib
Kakadu has joined #ocaml
<thelema>
ocamldoc wants to make symlinks to them, but as their documentation isn't currently being compiled, it can't.
Yoric has joined #ocaml
<thelema>
philed: the documentation should be available in api-oasis.docdir/
silkwood has quit [Quit: Ex-Chat]
<testcocoon>
invariant: finding the location of ocamldebug is not trivial on Windows, that the reason why it asks for the path.
<philed>
thelema: Cheers. I'll take a look. At the moment, some of my warnings are to internal modules.
<thelema>
there's some element warnings I see, but in general these warnings aren't a problem
<thelema>
I'm sure sylvain wouldn't mind you submitting a patch to fix them
<philed>
:) For now, I just want to know if I'm doing something wrong.
<thelema>
as far as I can see, no
<philed>
Cool. Cheers!
xavierm02 has quit [Ping timeout: 248 seconds]
trombi has quit [Ping timeout: 245 seconds]
RagingDave has joined #ocaml
justdit_ has quit [Ping timeout: 272 seconds]
ttamttam has joined #ocaml
xavierm02 has joined #ocaml
justdit_ has joined #ocaml
justdit_ has quit [Ping timeout: 255 seconds]
djcoin has quit [Quit: WeeChat 0.3.9.2]
travisbrady has joined #ocaml
<travisbrady>
Anyone ever gotten this from oasis? "E: Expecting not empty string" I get it when running 'check' or 'setup'
<thelema>
Kakadu: you should implement tarjan's algorithm
<Kakadu>
thanks
<Kakadu>
(maybe it will be great to add it to ocamlgraph)
<thelema>
yes, that sounds good
<thelema>
worst-case it can be a small package of its own that depends on ocamlgraph
travisbrady has quit [Quit: travisbrady]
travisbrady has joined #ocaml
Playground has quit [Ping timeout: 255 seconds]
dabd has joined #ocaml
thomasga has quit [Quit: Leaving.]
<gour>
evening
<gour>
i'm looking at realworldocaml alpha version, but do not see space for leaving comments?
<gour>
*alpha2
<thelema>
gour: email anil@recoil.org
<thelema>
also, according to the webpage:
<thelema>
Once authenticated, you will see that every paragraph has a comments link beside it. Simply enter your feedback in there, and a Github issue will automatically be created on your behalf. We will follow up via e-mail that you will receive through Github, thus ensuring that all feedback can be tracked and dealt with easily.
<gour>
ok
_andre has quit [Quit: leaving]
<gour>
i was asked to be authenticated 1st time, but now it probably recognizes cookie in the browser
redfire has joined #ocaml
<Kakadu>
gour: where did u get alpha?
<thelema>
Kakadu: there's a list of reviewers; bother anil for access
<Kakadu>
ahhh
<gour>
Kakadu: realworldocaml.org site
<gour>
Kakadu: and i sent email to anil
ttamttam has quit [Remote host closed the connection]
<gour>
the book starts with requirement to install OPAM..it seems they count strongly on it
<thelema>
well. It looks like I have even less reason to continue working on odb.
<adrien>
maybe it's not shared but I find some things around OPAM pretty aggressiv
<adrien>
e
<gour>
i just wonder if OPAM is supposed to replace ocamlbuild eventually?
<thelema>
gour: not at all
<thelema>
gour: opam is package management, not package building
<adrien>
and I don't think there would be a reason to throw ocamlfind away and start from scratch
<adrien>
s/\<a\>/any/
<gour>
thelema: yeah, that's how it's atm
<thelema>
adrien: I'm hoping that a little cleverness in namespaces can make ocamlfind obselete
<thelema>
gour: ocamlpro has a different tool they're working on to replace ocamlbuild - ocp-build. It's actually what builds opam, if you look closely
<gour>
thelema: ahh, that's interesting
<gour>
what's with typerex these days? developed in seclusion?
<adrien>
thelema: ocamlfind lets you chose the binaries, it should let you specify additional options, it handles various search paths
<thelema>
used by ocamlpro employees and maybe a few others who have managed to get it working.
<thelema>
adrien: the search path handling can be easily replaced by directory=namespace in the ocaml compiler
<Kakadu>
They are rewriting typerex in defferent branch
<thelema>
Kakadu: not actively, as far as I can tell
<adrien>
thelema: I mean, you can put libraries in vastly different paths
<thelema>
adrien: the rest of ocamlfind's features can probably be lived without.
<adrien>
like /foo/bar/baz and /a/b/c
<gour>
i'm busy with web stuff atm, but hopefully can dedicate more time to (learn) ocaml soon
<adrien>
thelema: dependencies?
<thelema>
adrien: and the ocaml compiler has search path for libraries
<adrien>
subpackages?
<adrien>
the whole point of ocamlfind is making it easy
<thelema>
and ocamlbuild/ocamldep can do dependencies (maybe needs improvement for deps between packages)
<thelema>
adrien: I'm all for making it easy
<thelema>
I think there's an easier way to make it easy once directory = module
<adrien>
META files lets you chose easily what you want to build against
<adrien>
you can specify several packages at once
<adrien>
you can add .cmo and .cmx files
<adrien>
you can specify dependencies
<thelema>
adrien: In a perfect world, there's no need to specify packages, just use "open Core.Std", and the ocaml compiler will look in its search path for core/std.cmi
<thelema>
ocamlbuild will have to be extended to support dependencies of dependencies
<thelema>
err, dependencies of compiled files
<adrien>
packages have side-effects
<thelema>
modules can have side effects
<adrien>
yes, what I meant :-)
<adrien>
if you rely on the code to decide which modules to load, the code will also define their load order
<thelema>
and if you really need to sequence the link order of your modules, you're certainly welcome to tell ocamlbuild ordering requirements
<adrien>
it's too unpredictable and too brittle
<adrien>
(the current situation isn't very good but you can easily know what it does and it doesn't change often)
<thelema>
in 99% of cases, dependency order is sufficient to link properly
<adrien>
agreed
<thelema>
I don't want to take away custom link orders, I just want ocamlbuild to "just work"
<adrien>
but even before the fact that the order of lines (or calls to functions like printf) will impact which modules get linked in
<thelema>
without any extra META files or special installation procedures
<adrien>
how do you handle dependencies?
<thelema>
ocamldep is able to look at source code and get a list of modulenames
<adrien>
no
<adrien>
ocamldep sucks at this task
<thelema>
ocamlobjinfo is able to look at compiled objects and get a list of deps
<thelema>
yes, it sucks, but it's certainly possible for it to do this job good enough for most projects
<thelema>
and adding any deps it misses seems straightforward
<thelema>
Yes, ocamldep has its limitations, but it's really good for most projects
<adrien>
only because you use it on *one* project at once
<thelema>
I define a project as something that gets compiled together. If it's compiled separately, it's separate projects
<adrien>
you already avoid name conflicts by yourself because it'd be annoying in the code
<thelema>
?
<thelema>
I'm not suggesting running ocamldep on the whole repo of installed projects
<adrien>
the reason you don't have two modules named the same in your projects is because it would be annoying for you as a human
<thelema>
yes.
<adrien>
and it turns out that helps ocamldep/ocamlbuild
<adrien>
if you take that and bring it at a bigger scale (whole system), you get a much more complex situation
<thelema>
and once there's a global namespace with some standard for unique toplevel names (I suggest project names), module name conflicts go away
<thelema>
every module has a unique full name, and can be 'open'ed by that name
<adrien>
actually such automation reminds me of libtool
<thelema>
which means ocamlc/ocamlopt can find such a module by looking in the right dir
<adrien>
it's a bit different but its automatic library pulling (among others) is a hell to deal with
<adrien>
why would every module have a unique full name?
dwmw2_gone is now known as dwmw2_SAT
<thelema>
projectname.modulename
<thelema>
yes, project names aren't guaranteed to be unique, but by the same human principle, collisions are likely to go away quickly, with one project renaming when it realizes the conflict
<thelema>
especially with opam, the package name has to be unique
<adrien>
when would the namespace path be defined? at compilation or installation?
<thelema>
adrien: hmm, that's a really good question. My instinct is that a module Foo that's not installed yet into Bar isn't yet Bar.Foo
<thelema>
so the namespace path is defined by installed modules
<adrien>
but then 'mv' on the installed directories would rename the namespace path
<thelema>
I'm imagining each user having access to a system namespace and a local namespace in different dirs, with a PATH that says search in local namespace first and then system namespace
<thelema>
yes, mv would rename
<thelema>
modules
<adrien>
I'm all for something simple but in this case I think the issue isn't simple and won't have a simple solution unless you lock-down all ths possibilities
<thelema>
is there a problem with renaming by mv?
<adrien>
sounds brittle for packaging
<adrien>
it means you can easily break stuff
<adrien>
obviously, you wouldn't mv things everyday
<adrien>
but having mv have huge consequences seems a bit too much
<thelema>
you can easily break any linux system by doing 'mv /usr /foo"
<thelema>
I don't see mv being a common operation on installed package trees
<thelema>
install a package by copying to ~/.ocaml-lib/packagename
<adrien>
what I like with ocamlfind is that it's simple and while being a package manager, it does not conflict with your system package manager
<thelema>
Yes, it's good that ocamlfind doesn't conflict with the system package manager. I don't think of ocamlfind as simple, but maybe I've not worked with it enough
<adrien>
here you'd be imposing additional restrictions and I'm sure I've used "mv" several times when doing things in my ocaml prefix
<thelema>
adrien: using "mv" in ocamlfind's site-lib has the same effect as in my proposal
<thelema>
I don't see why it's ok in one and brittle in the other
<adrien>
hmmm, you're absolutely right; I would have sworn it still worked
<adrien>
that's a bit surprising since it check every META file each time iirc
<adrien>
(or it did)
<adrien>
what I don't really like with relying only on namespace once installed is that changing one thing has many implications
<thelema>
my understanding has always been: package name = directory
Yoric has quit [Ping timeout: 252 seconds]
<adrien>
I've just checked: if you move a directory in ocamlfind's main library directory, that does not rename the directory
<thelema>
yes, it breaks the package
<adrien>
that makes it unaccessible
<thelema>
so my proposal would likely be more flexible than ocamlfind
<thelema>
you prefer the package name to be stored in a META file with the compiled objects
<thelema>
what's the problem with the package name being the directory that those objects are in?
<jathd>
adrien: I don't understand your objections. The compiler already relies heavily on file names: if I change the name of a source file, it changes that name of the module.
<jathd>
Using directories seems like a natural generalization.
<adrien>
not a generalization but a mix
emmanuelux has joined #ocaml
<adrien>
because lib/foo.cmxa can bring Lib.Foo.M just like lib/foo/m.cmxa can
<adrien>
I'm not saying it's not manageable
<adrien>
I'm arguing it will actually be more complicated
<thelema>
adrien: actually, my proposal is simpler than that, what you're describing is fabrice's proposal, which is very similar
<thelema>
mine only supports one level of directory namespace
<adrien>
I'll wait for the full-featured and stabilized code against real-world scenarios before calling one or the other simpler ;-)
<adrien>
ah, ok
<adrien>
you lose quite a lot of the interest then :P
<thelema>
interest?
<jathd>
thelema: It does? Can you explain why you'd want to do that (instead of using the full path relative to some root directory)?
<thelema>
in saying how terrible the proposal is?
<adrien>
s/the interest/what it brings/
<adrien>
Fabrice proposal's works during builds, no?
<thelema>
I don't see much need for deeply heirarchical namespace
<adrien>
so you have the source code upon which you have full control
<thelema>
adrien: no idea, actually.
<adrien>
I've been using src/backend/foo.ml and src/ui/foo.ml
<thelema>
adrien: I guess it's not too unreasonable to build in a full path at compile time
cdidd has quit [Read error: Connection reset by peer]
<adrien>
the ui/ directory uses lablgtk while the backend one does not (and actually _must_ not)
<invariant>
Hierarchical namespaces are already in Haskell.
<thelema>
adrien: but I don't see any advantage
<thelema>
adrien: if they're part of the same package, give them different names.
<adrien>
replace packs
<adrien>
and keep a light module name
<jathd>
invariant: My (limited) experience with Haskell is that a package Foo is often made up of subpackages Foo.A, Foo.B, etc., but Foo usually re-exports the interesting bits.
<adrien>
because ocamldep won't like if you rename your module to the one in another directory :P
<thelema>
jathd: a single level of directory namespace is sufficient to allow each package to have its own Foo module
myx_ has quit [Quit: ушёл]
<thelema>
adrien: so have two packages, one that implements the backend, and the other that depends on the backend that implements the UI
<jathd>
thelema: Right, so that's enough to prevent name conflicts across packages.
<thelema>
jathd: within packages, as adrien already said, each module should already have a distinct name
<jathd>
If that's the goal, then I guess there's indeed no point in going "full-pathé.
<thelema>
because humans - confusion
<adrien>
thelema: there are foo1.ml, foo2.ml, foo3.ml in both ui/ and backend/
<adrien>
hmmm, hold on
<adrien>
both foo3 depend on foo2 which depend on foo1
<thelema>
I don't see how internal deps matter
<invariant>
jathd, there is no notion of a subpackage in Haskell. In fact, Haskell doesn't even have packages, AFAIK.
<adrien>
thelema: trying to sort my thoughts out, I'm 30 minutes past my supposed bedtime :P
<invariant>
The notion of a package is something which was done in a defacto way.
<thelema>
adrien: ah, ok.
<adrien>
I think I had tried building in two steps but that didn't work out well
<thelema>
adrien: the argument being that you can't separate the code into two packages
RagingDave_ has joined #ocaml
smondet has quit [Ping timeout: 248 seconds]
<thelema>
adrien: but then why do the two files need the same name?
<jathd>
invariant: Sorry, I meant module.
<thelema>
jathd: haskell definitely doesn't have modules
<adrien>
thelema: because the code is a thousand times clearer
<adrien>
thelema: and because they can
<invariant>
I think the OCaml module system is still more than powerful enough.
<jathd>
Damn, what do you call those things… :/
<thelema>
it is quite powerful
ManAmongHippos has joined #ocaml
<invariant>
OCaml has a library called Core with about 7700 symbols.
<adrien>
I think it's fine but the main issue is that you can have name conflicts with ocamldep
<adrien>
it won't see the difference between "m.ml" and "module M = struct end"
<thelema>
adrien: I'm not convinced that the benefit of being able to have a package with multiple modules of the same name is worth the extra complexity of search (not in the compiler, in the heads of people trying to figure out what's going on)
<invariant>
If you extend it, you could depend on DNS.
<invariant>
Just like Java did.
<invariant>
That was a good idea.
<thelema>
adrien: ocamldep of course would have to become namespace aware so that it would treat ui/foo as different from backend/foo
<adrien>
thelema: the whole idea is that you don't have to search: both are almost independant with only a few links
<thelema>
invariant: I hope you're being sarcastic
<invariant>
thelema, it solves the namespace problem, doesn't it?
RagingDave has quit [Ping timeout: 276 seconds]
<adrien>
I can't remember: the namespace proposal has a different syntax for namespaces or does it piggyback on modules?
<adrien>
i.e. does it create A.B or really A/B as you wrote
<thelema>
invariant: it does, but in an ugly way.
<invariant>
thelema, I am not saying that I want to write package verylongstring here.
<thelema>
adrien: same syntax for namespaces as modules.
<invariant>
thelema, there could be lots of ways to automate that part.
Kakadu has quit []
<invariant>
thelema, I am also not sure what the point of reversing the components was.
<thelema>
invariant: dns was backwards from the start; known bug
hongboz has quit [Ping timeout: 276 seconds]
<thelema>
invariant: java put the components in the correct order
<invariant>
thelema, java puts the components in the operational order.
<invariant>
thelema, whether or not that is the correct order is up to debate.
<thelema>
invariant: I can't find the quote from its creator saying that it was a mistake to have the .com last
<tac>
It only makes sense, since it was created by us Americans
<invariant>
thelema, I can imagine an alternative universe in which the other alternative would be used.
<adrien>
thelema: I can't remember for sure why building in two steps was much more difficult
xavierm02 has quit [Quit: Leaving]
<adrien>
but I think that's because since I was making a program and not a library, I had to build one lib, install it temporarily, build the other lib, install it temporarily, build the executable
<thelema>
ok, the scenario is a single project that really wants two modules with the same name, and my response is: don't do that.
<adrien>
I'll have to check that but I won't have time before sunday or next week
<adrien>
well, I'd say: do that if you can have well-separated things
<thelema>
the scenario doesn't matter that much; unless it's really common, it's not a worry
<adrien>
one issue is that with ocamlbuild (which I've started to despise), you have no control on where it looks for things
<adrien>
and you can't do something in two or more steps
<thelema>
sure, I'm not saying that ocamlbuild is the best ever.
<adrien>
iirc it was mentionned as being quite common in the namespace proposal
<thelema>
I'm just expecting it'll be the easiest thing to transform into auto-dependency management
<thelema>
namespace-aware build tool;
<thelema>
adrien: I don't believe it so much. The best reason fabrice had for nested namespaces was a huge company like microsoft wanting to put all their code inside the microsoft namespace
<adrien>
I'll look it up another day but iirc there was mention of Xen
<thelema>
but once you realize that that whole codebase isn't a single project, then separate namespaces for each make sense
<thelema>
ocaml has historically made it hard to build from separate codebases
<thelema>
ocamlfind makes this a little easier, but still messy
<thelema>
I imagine a world where external code bases (packages) are as easy to use as modules within a single project
<thelema>
and to accomplish this, why not make them look just like modules?
dwmw2_SAT is now known as dwmw2_gone
tac_ has quit [Ping timeout: 245 seconds]
Yoric has joined #ocaml
mye has joined #ocaml
Snark has quit [Quit: Quitte]
<invariant>
If one applies over every directory (and files) just some hash function, then you can put in your dependencies that package foo=ae123323ae833.
<thelema>
invariant: I'm strongly in favor of having dependencies be inferred from code as much as possible: "don't repeat yourself"
<thelema>
the code says you want to use module Foo, the build system should go find module foo and use it.
<inv>
other languages have namespaces for categorization
<inv>
crypto.aes.ctr, protocols.http.server, etc
<thelema>
looking myself at most of the namespace in those languages, it's actually flat.
<thelema>
(I'm thinking of specifically perl and java)
<thelema>
python has adopted a completely flat namespace
answer_42 has quit [Remote host closed the connection]
<inv>
what defines a flat namespace?
<thelema>
I should take back that last sentence
<thelema>
the python rule is flat is better than nested, and from what I understand, they've applied it to packages, but I'm not a python user
<thelema>
so I can't back that up with details
<inv>
I use Python extensively, but I've never heard the term "flat namespaces" before, so that's the reason I'm asking.
<thelema>
I meant that package names aren't heirarchical; as contrasted with java's javax.swing.text.html.parser
<inv>
er what?
<inv>
yes they are
<thelema>
oh, well then
<inv>
python's namespaces work exactly like those of perl
<thelema>
ok, they support heirarchy
<thelema>
but most of the usage is quite flat
<inv>
like in java and perl.
<thelema>
because humans don't work with deep heirarchies that well
<thelema>
although it looks like there's definitely sections of the python namespace taken up by zope and others, which are heirarchical
<inv>
I really don't know where you're getting your Python facts from, lots of people use hierarchical naming. the standard lib is full of it.
<thelema>
but in practice, organizing every package into a proper heirarchy doesn't happen, because ... maybe because there's no curator putting tons of work into ensuring each piece is in the right place
<thelema>
full of depth 1 and 2, not so much depth 5 like in java
<inv>
true.
<thelema>
my proposal is to allow only an increase of 1 in module depth from namespaces
<thelema>
if this is too restrictive, it can be removed, but I point out that the opposite conversion will not be feasible
Yoric has quit [Ping timeout: 252 seconds]
<inv>
is there a benefit in limiting nesting?
<inv>
I think most things can be covered with 2 levels, maybe you should consider expanding it to two levels.
<thelema>
just in discouraging excessive nesting
<thelema>
2 levels will be the default: packagename.modulename.function
<thelema>
for example, Batteries.Tuple2.map
<thelema>
of course, 'open Batteries' should still work as expected
<thelema>
if it's problematic to have anything other than values in the toplevel of a package module, then 'open Batteries.Std' is fine too
mcsquiggedy has left #ocaml []
RagingDave_ has quit [Quit: Ex-Chat]
RagingDave has joined #ocaml
dwmw2_gone is now known as dwmw2_SAT
<gour>
1st chapter of RWO book starts with OPAM, ends with ocamlbuild :-)
adotbrown has joined #ocaml
tane has quit [Quit: Verlassend]
gour has quit [Quit: WeeChat 0.3.8]
philed has quit [Remote host closed the connection]
redfire has quit [Quit: WeeChat 0.3.8]
leoncamel has quit [Ping timeout: 248 seconds]
silkwood has joined #ocaml
travisbrady has quit [Quit: travisbrady]
q66 has quit [Quit: Quit]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
cyball has joined #ocaml
adrien has quit [Ping timeout: 255 seconds]
patronus_ has quit [Remote host closed the connection]
adrien has joined #ocaml
patronus_ has joined #ocaml
dwmw2_SAT is now known as dwmw2_gone
Playground has joined #ocaml
adrien_o1w has joined #ocaml
cyball has quit [Ping timeout: 248 seconds]
adrien_oww has quit [Read error: Operation timed out]
theplanet^2 has joined #ocaml
elixey has quit [Remote host closed the connection]