adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.07.1 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.07/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml | Due to ongoing spam, you must register your nickname to talk on the channel
orbifx3 has quit [Ping timeout: 250 seconds]
orbifx3 has joined #ocaml
steenuil has joined #ocaml
<AvalancheCat> thanks anyway companion_cube!
<companion_cube> AvalancheCat: typically I write the type of public functions in a .mli
<companion_cube> and there the types have to match
iAmDecim_ has joined #ocaml
iAmDecim has quit [Ping timeout: 252 seconds]
ziyourenxiang has joined #ocaml
orbifx3 has quit [Ping timeout: 246 seconds]
carlosdagos has joined #ocaml
<AvalancheCat> hmm, I do not see that happening when I try it
<companion_cube> if you have a .mli with the same file prefix, and add `val foo : 'a list -> unit` to it, it still compiles?
<Fardale> AvalancheCat: when you add type to definition of the function, you say to the compiler: I want this type to be at most this.
<Fardale> But you are not forcing it to be this type. For exemple if I write: let f (x:'a) = x + 1;;
<AvalancheCat> the second line from the cat is from the *.mli file
<AvalancheCat> the error from mismatching mli only occurs when I match the arg to the function, otherwise it almost seems to ignore the mli
<Fardale> What do you mean by "match the arg to the function" ?
<AvalancheCat> tif the .ml compiles, then it checks if the mli matches it. but since the ml doesn't compile it doesn't even get to compare it to mli
<AvalancheCat> if the .ml*
<AvalancheCat> so the mli was checked after I made the ml code compile by fixing the type restriction to foo by replacing 1 -> "X"
mfp has quit [Ping timeout: 250 seconds]
<Fardale> ok
<AvalancheCat> but the mli defined foo to be bool->unit, that wasn't even checked before I modified the ml file so it would compile
<Fardale> No, it would not compile
jmiven has quit [Quit: co'o]
jmiven has joined #ocaml
<AvalancheCat> i was just hoping the mli would be the ground-truth for the compiler as I assumed from companion_cube's last message
<Fardale> AvalancheCat: in Printf, when you write "%s\n" the %s says that it will print a string. How do you think it can handle a int ?
<AvalancheCat> the link you pasted describes a mismatch between the ml and mli file
<Fardale> Yes
<Fardale> the ml was let f x = x+1 and the mli was: val f: 'a -> int
<Fardale> the mli file is there to define the interface of your module. Then the ml file define the implementation. The compiler will check that your implementation is correct regarding typing then it will look if you match what is in the mli file
<AvalancheCat> i do not think it can handle and int. I would hope that the compiler would tag the error anywhere else besides the caller - when I am calling the func and its signature I see 'a -> unit, but the inner "%s" has magically overwritten that
<AvalancheCat> i think the core of my question is that I can define the args to function as eg. ('a -> unit), the func body has "%s" hidden in there, and then my compile will fail if I try to call it with ~'a (any type). the compiler blames my callsite, I am wondering why it doesn't blame the arg declaration + format string
<Fardale> I agree with you, it is confusing
<AvalancheCat> I am sure there is a good reason for that :) I would like to now what the reason is so I can avoid those situatuations where my callsite is blamed
<Fardale> Because, the type you put one "arg" is more like a restriction than a definition
<AvalancheCat> also happy to hear that it is somewhat confusing to someone besides me :D
<AvalancheCat> okay, so it is basically "the type can be as wide as 'a, but internal restrictions may apply at compile time"
<Fardale> yes
<AvalancheCat> "and the callsite gets blamed" - which is what I am having an issue with :P
<AvalancheCat> but okay, I get the point
<AvalancheCat> thanks a bunch Fardale :)
spew has quit [Quit: Connection closed for inactivity]
iAmDecim_ has left #ocaml [#ocaml]
malina has quit [Remote host closed the connection]
iAmDecim has joined #ocaml
Algebr` has quit [Ping timeout: 250 seconds]
spew has joined #ocaml
ygrek__ has quit [Ping timeout: 268 seconds]
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
al-damiri has quit [Quit: Connection closed for inactivity]
navaja has joined #ocaml
ggherdov16 has joined #ocaml
spew has quit [Ping timeout: 268 seconds]
ggherdov16 has quit [Remote host closed the connection]
tormen_ has joined #ocaml
tormen has quit [Ping timeout: 268 seconds]
sonologico has quit [Ping timeout: 268 seconds]
navaja has quit [Quit: Leaving]
sonologico has joined #ocaml
h11 has quit [Read error: Connection reset by peer]
h11 has joined #ocaml
Jeanne-Kamikaze has joined #ocaml
Algebr` has joined #ocaml
slamzy12345 has joined #ocaml
h11 has quit [Quit: Ping timeout (120 seconds)]
h11 has joined #ocaml
slamzy12345 has quit [Ping timeout: 256 seconds]
sonologico has quit [Remote host closed the connection]
jao has quit [Ping timeout: 246 seconds]
slamzy12345 has joined #ocaml
slamzy12345 has quit [Remote host closed the connection]
sepp2k has joined #ocaml
Jeanne-Kamikaze has quit [Quit: Leaving]
Algebr` has quit [Ping timeout: 246 seconds]
firippu has joined #ocaml
firippu has quit [Remote host closed the connection]
Algebr` has joined #ocaml
bartholin has joined #ocaml
rwmjones_ has joined #ocaml
rwmjones has quit [Ping timeout: 252 seconds]
freyr69 has joined #ocaml
sagotch has joined #ocaml
troydm has quit [Ping timeout: 246 seconds]
gravicappa has joined #ocaml
sagotch has quit [Quit: Leaving.]
orbifx3 has joined #ocaml
Algebr` has quit [Ping timeout: 268 seconds]
orbifx3 has quit [Ping timeout: 245 seconds]
nopf has joined #ocaml
bartholin has quit [Remote host closed the connection]
troydm has joined #ocaml
Algebr` has joined #ocaml
Haudegen has joined #ocaml
mfp has joined #ocaml
dmiles has quit [Ping timeout: 250 seconds]
jaar has joined #ocaml
sagotch has joined #ocaml
Algebr` has quit [Ping timeout: 250 seconds]
dmiles has joined #ocaml
gravicappa has quit [Ping timeout: 246 seconds]
slamzy has joined #ocaml
Algebr` has joined #ocaml
asymptotically has joined #ocaml
OmegaPhil21 has joined #ocaml
OmegaPhil21 has quit [Remote host closed the connection]
rwmjones_ is now known as rwmjones
iAmDecim has quit [Ping timeout: 252 seconds]
Algebr` has quit [Ping timeout: 250 seconds]
kakadu_ has joined #ocaml
kakadu has quit [Read error: Connection reset by peer]
jaar has quit [Ping timeout: 252 seconds]
kakadu_ has quit [Remote host closed the connection]
kakadu_ has joined #ocaml
ollehar has joined #ocaml
slamzy has quit [Remote host closed the connection]
slamzy has joined #ocaml
Algebr` has joined #ocaml
iAmDecim has joined #ocaml
demonimin has quit [Remote host closed the connection]
slamzy has quit [Remote host closed the connection]
demonimin has joined #ocaml
demonimin has joined #ocaml
iAmDecim has quit [Ping timeout: 252 seconds]
Algebr` has quit [Ping timeout: 246 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
bartholin has joined #ocaml
<bartholin> #show_type list;;
<bartholin> type nonrec 'a list = [] | (::) of 'a * 'a list
<bartholin> Why the nonrec keyword in the list definition?
theblatte has quit [Read error: error:1408F10B:SSL routines:ssl3_get_record:wrong version number]
theblatte has joined #ocaml
<octachron> bartholin, this is a bug
<bartholin> oh?
johnelse_ has quit [Read error: Connection reset by peer]
johnelse has joined #ocaml
sagotch has quit [Quit: Leaving.]
Algebr` has joined #ocaml
tane has joined #ocaml
demonimin has quit [Quit: bye]
Haudegen has quit [Remote host closed the connection]
demonimin has joined #ocaml
Algebr` has quit [Ping timeout: 268 seconds]
<Leonidas> what is this discussion on caml-list
<Leonidas> people complaining that you need a build tool and a package manager, unlike every other language on the planet?
* Leonidas is so confused
<theblatte> they want their users to compile the code of their programs for them without these users having to install anything I think ;)
<Leonidas> hmm, maybe we need batchfile_of_ocaml then
sagotch has joined #ocaml
Algebr` has joined #ocaml
slamzy has joined #ocaml
slamzy has quit [Ping timeout: 256 seconds]
slamzy has joined #ocaml
asymptotically2 has joined #ocaml
asymptotically2 has quit [Remote host closed the connection]
Haudegen has joined #ocaml
jao has joined #ocaml
Algebr` has quit [Ping timeout: 245 seconds]
slamzy1234 has joined #ocaml
slamzy has quit [Ping timeout: 256 seconds]
Algebr` has joined #ocaml
Algebr` has quit [Ping timeout: 250 seconds]
spew has joined #ocaml
freyr69 has quit [Remote host closed the connection]
Algebr` has joined #ocaml
FreeBirdLjj has joined #ocaml
pzp has joined #ocaml
alpha has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
Algebr` has quit [Ping timeout: 246 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
Algebr` has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
FreeBirdLjj has joined #ocaml
johnelse has quit [Quit: leaving]
inr has quit [Quit: WeeChat 2.2]
Haudegen has quit [Remote host closed the connection]
sagotch has quit [Quit: Leaving.]
Algebr` has quit [Ping timeout: 250 seconds]
johnelse has joined #ocaml
SpiceGuid has joined #ocaml
marvin2 has quit [Ping timeout: 268 seconds]
ollehar has quit [Ping timeout: 268 seconds]
SpiceGuid has quit [Quit: ChatZilla 0.9.93 [SeaMonkey 2.49.2/20180205075051]]
malina has joined #ocaml
ziyourenxiang has quit [Ping timeout: 268 seconds]
alpha has quit [Quit: alpha]
sonologico has joined #ocaml
jnavila has joined #ocaml
Jesin has joined #ocaml
roygbiv has joined #ocaml
groovy2shoes has quit [Quit: moritura te salutat]
Guest41412 has joined #ocaml
marvin2 has joined #ocaml
sepp2k has quit [Quit: Leaving.]
ygrek__ has joined #ocaml
fraxamo has joined #ocaml
pzp has quit [Quit: Connection closed for inactivity]
Algebr` has joined #ocaml
Guest41412 has quit [Read error: Connection reset by peer]
FreeBirdLjj has quit [Remote host closed the connection]
Jesin has quit [Quit: Leaving]
slamzy1234 has quit [Remote host closed the connection]
slamzy1234 has joined #ocaml
Jesin has joined #ocaml
asymptotically has quit [Remote host closed the connection]
asymptotically has joined #ocaml
Madars has joined #ocaml
kakadu has joined #ocaml
Birdface has joined #ocaml
slamzy12345 has joined #ocaml
slamzy1234 has quit [Remote host closed the connection]
slamzy12345 has quit [Remote host closed the connection]
asymptotically has quit [Remote host closed the connection]
slamzy12345 has joined #ocaml
asymptotically has joined #ocaml
Jesin has quit [Quit: Leaving]
fraxamo has quit [Quit: Leaving]
pzp has joined #ocaml
tane has quit [Quit: Leaving]
sz0 has joined #ocaml
iAmDecim has joined #ocaml
jpirko has joined #ocaml
jpirko has quit [Remote host closed the connection]
Guest77723 has joined #ocaml
Guest77723 has quit [Remote host closed the connection]
Haudegen has joined #ocaml
jnavila has quit [Remote host closed the connection]
bartholin has quit [Remote host closed the connection]
<iAmDecim> test
<iAmDecim> so question...when installing ocaml...i'm looking at a particular configuration https://gist.github.com/haldun/6184624
<iAmDecim> opam switch 4.01. i see under list-avail that there have been several releases. is this necessary in the initial set up or is more like RVM for ruby?
roygbiv has quit [Quit: ™]
slamzy12345 has quit [Quit: Leaving]
asymptotically has quit [Quit: Leaving]
spew has quit [Quit: going home]
GreyFaceNoSpace has joined #ocaml
<GreyFaceNoSpace> hi....how can i find a parent of a node in a tree through pattern matching? i've been trying to do it for a while and im having trouble. type tree = Leaf | Node of int * tree * tree . this is my type... i can traverse the tree normally but what if i want to get the parent of my current node? is it possible through pattern matching?
<Fardale> You cannot access the parent of node from the node, you need to remember it before you get to the node
<GreyFaceNoSpace> alright
<GreyFaceNoSpace> so its not possible through pattern matching?
<GreyFaceNoSpace> i have to store the parents in a list
<Fardale> what do you mean by "through pattern matching" ?
<Fardale> And what do you want to do with the parent ?
<GreyFaceNoSpace> so if i want the children i just match the tree with : match t with Leaf -> t | Node(x,l,r) -> doSomething(l)
<GreyFaceNoSpace> so now i am accessing the left child
<GreyFaceNoSpace> what if i want to go to the parent. is there a matching pattern for that?
<GreyFaceNoSpace> the parent Node of t
<GreyFaceNoSpace> i short... why cant i do this? match t with Node(x,t,r) with t here being the same ,
<Fardale> Because when you have Node of …, you have no idee if there exist a parent
<Fardale> You can be at the root, or in the middle of some tree, but what you have is juste a tree (which is the all tree or a subtree)
<GreyFaceNoSpace> yes so the only way is to store the parents in a list. correct?
<GreyFaceNoSpace> with each recursive call of the function i add the parent to a list
<Fardale> No there is different way to do this
<Fardale> if you only need the parent, then you juste need to pass the parent and not a list
lynn has joined #ocaml
<Fardale> or you can just do something after the recursive call of your function
<GreyFaceNoSpace> ok :) thanks
<Fardale> or you can use the list if you need all parent nodes
<GreyFaceNoSpace> yea exactly
<GreyFaceNoSpace> i need all of them :D
<Fardale> if you give me more info on what you try to do, I can give you more advice
<Fardale> usually you don't rely need all parent nodes
Haudegen has quit [Remote host closed the connection]
kakadu has quit [Remote host closed the connection]