adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | Current MOOC: https://huit.re/ocamlmooc | OCaml 4.04.0 release notes: http://ocaml.org/releases/4.04.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
malina has joined #ocaml
planet_en has quit [Quit: planet_en]
fraggle-boate has quit [Ping timeout: 240 seconds]
IRCFrEAK has joined #ocaml
IRCFrEAK has left #ocaml [#ocaml]
infinity0 has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 240 seconds]
eimpec has quit [Quit: WeeChat 1.4]
Onemorenickname has quit [Read error: Connection reset by peer]
infinity0 has joined #ocaml
nomicflux has joined #ocaml
<SomeDamnBody> Hello - I need the ability to fold as is shown in this function: https://github.com/backtracking/ocamlgraph/blob/master/src/traverse.mli#L72
rpg has joined #ocaml
<SomeDamnBody> But I cannot reach this function - it's not in the module minted by the api. It's not publicly accessible for whatever reason, according to my compiler.
<SomeDamnBody> But in the source, I can see it... I don't know what gives.
<Drup> SomeDamnBody: check the ocamlgraph version
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wtetzner has joined #ocaml
<SomeDamnBody> Drup: I have the latest version
<Drup> maybe it's only in the dev version ?
<SomeDamnBody> I'm guessing what I'm seeing is that the version on github is more up to date than the opam version
<SomeDamnBody> yeah
<SomeDamnBody> That's what I'm guessing :/
nomicflux has quit [Quit: nomicflux]
orbifx has quit [Ping timeout: 240 seconds]
mengu has quit [Quit: Leaving...]
rpg has joined #ocaml
mfp has quit [Ping timeout: 240 seconds]
<SomeDamnBody> Ok, now I have a different, algorithmic problem.
<SomeDamnBody> I'm doing a traversal over one graph, and adding nodes from that graph into another. The problem of the matter is that, when we add nodes to the second graph, we don't want to add any node from the first graph into the second that isn't in the first.
<SomeDamnBody> in terms of linkage. So, I may have a tree in the first graph. If I traverse the tree, I may skip some nodes between additions in the second. So, I use the DFS capability, and I need to keep track of the node that was last used in linkage. But then, when the traversal switches to a different lineage, backtracking, I need to switch the node to use that.
<SomeDamnBody> Or else what was a tree will result in potentially a loop
FreeBirdLjj has joined #ocaml
<SomeDamnBody> Oh wait.. is there a reverse tree implementation somewhere? Where, I can, say, have an array where items point to other indices?
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rpg has joined #ocaml
<SomeDamnBody> Union_find!
<SomeDamnBody> Found it
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
silver has quit [Read error: Connection reset by peer]
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wtetzner has quit [Remote host closed the connection]
bobbypriambodo has joined #ocaml
sh0t has quit [Remote host closed the connection]
Simn has joined #ocaml
bobbypriambodo has quit [Ping timeout: 260 seconds]
wtetzner has joined #ocaml
cbot has joined #ocaml
cbot has quit [Client Quit]
lopex has quit [Quit: Connection closed for inactivity]
jao has quit [Ping timeout: 240 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
def` has quit [Ping timeout: 276 seconds]
Asmadeus has quit [Ping timeout: 240 seconds]
adrien has quit [Ping timeout: 264 seconds]
bobbypriambodo has joined #ocaml
Asmadeus has joined #ocaml
cbot has joined #ocaml
jabroney has quit [Quit: Leaving.]
copy` has quit [Quit: Connection closed for inactivity]
def` has joined #ocaml
adrien has joined #ocaml
MercurialAlchemi has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
wtetzner has quit [Remote host closed the connection]
larhat has joined #ocaml
FreeBirdLjj has joined #ocaml
larhat has quit [Quit: Leaving.]
jstolarek has quit [Ping timeout: 240 seconds]
jstolarek has joined #ocaml
govg has quit [Ping timeout: 255 seconds]
igitoor has quit [Ping timeout: 240 seconds]
igitoor has joined #ocaml
igitoor has quit [Changing host]
igitoor has joined #ocaml
bobbypriambodo has quit [Ping timeout: 260 seconds]
bobbypriambodo has joined #ocaml
govg has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 268 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
bobbypriambodo has quit [Quit: ERC (IRC client for Emacs 25.1.1)]
AlexDenisov has joined #ocaml
MercurialAlchemi has joined #ocaml
FreeBirdLjj has joined #ocaml
d0nn1e has quit [Ping timeout: 240 seconds]
d0nn1e has joined #ocaml
kakadu has joined #ocaml
cdidd has quit [Ping timeout: 260 seconds]
basro_ has joined #ocaml
basro has quit [Ping timeout: 260 seconds]
alfredo has joined #ocaml
cdidd has joined #ocaml
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jnavila has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
freusque has quit [Quit: WeeChat 1.7]
freusque has joined #ocaml
orbifx has joined #ocaml
orbifx has quit [Ping timeout: 255 seconds]
snhmib has joined #ocaml
FreeBirdLjj has joined #ocaml
freusque has quit [Read error: Connection reset by peer]
freusque has joined #ocaml
larhat has joined #ocaml
ygrek has joined #ocaml
cthuluh has quit [Ping timeout: 240 seconds]
AlexDenisov has joined #ocaml
abeaumont has joined #ocaml
cthuluh has joined #ocaml
ia0 has quit [Quit: reboot]
ia0 has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
malina has quit [Ping timeout: 260 seconds]
tane has joined #ocaml
zpe has joined #ocaml
abeaumont has quit [Ping timeout: 268 seconds]
FreeBirdLjj has joined #ocaml
FreeBird_ has joined #ocaml
mfp has joined #ocaml
lopex has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 255 seconds]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
abeaumont has joined #ocaml
AlexDenisov has joined #ocaml
cbot has quit [Quit: This computer has gone to sleep]
rcsole has joined #ocaml
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FreeBird_ has quit [Remote host closed the connection]
jao has joined #ocaml
kakadu has quit [Remote host closed the connection]
dhil has joined #ocaml
<reynir> I forgot, how do you install an opam switch under an alias?
johnelse is now known as johnel_away
johnel_away is now known as johnelse
<Drup> reynir: opam switch --help
<Drup> ;)
ygrek has quit [Ping timeout: 240 seconds]
freyr has joined #ocaml
_andre has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 268 seconds]
<flux> lies, that just gives the help screen..
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
ziyourenxiang has joined #ocaml
silver has joined #ocaml
jao has quit [Ping timeout: 255 seconds]
alfredo has quit [Ping timeout: 240 seconds]
alfredo has joined #ocaml
sepp2k has joined #ocaml
<reynir> Yea, I was reading it, but I was too stupid to understand it.
stormogulen has joined #ocaml
bobbypriambodo has joined #ocaml
<Drup> opam switch create --alias-of 4.04.0 myfoobarswitch
dhil has quit [Ping timeout: 255 seconds]
shinnya has joined #ocaml
tane has quit [Quit: Leaving]
rpg has joined #ocaml
rpg has quit [Client Quit]
bobbypriambodo has quit [Ping timeout: 255 seconds]
nomicflux has joined #ocaml
freusque has quit [Ping timeout: 240 seconds]
freusque has joined #ocaml
AlexDenisov has joined #ocaml
freusque has quit [Ping timeout: 255 seconds]
freusque has joined #ocaml
malc_ has joined #ocaml
bobbypriambodo has joined #ocaml
nomicflux has quit [Quit: nomicflux]
bobbypri` has joined #ocaml
bobbypri` has quit [Remote host closed the connection]
bobbypriambodo has quit [Ping timeout: 240 seconds]
dhil has joined #ocaml
shinnya has quit [Ping timeout: 260 seconds]
SomeDamnBody has quit [Remote host closed the connection]
stormogulen has quit [Remote host closed the connection]
sh0t has joined #ocaml
jabroney has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 240 seconds]
govg has quit [Ping timeout: 240 seconds]
dhil has quit [Ping timeout: 260 seconds]
freyr has quit [Quit: Lost terminal]
kakadu has joined #ocaml
dhil has joined #ocaml
jnavila_ has joined #ocaml
jnavila has quit [Read error: Connection reset by peer]
infinity0_ has joined #ocaml
infinity0 is now known as Guest3152
infinity0 has joined #ocaml
Guest3152 has quit [Killed (hobana.freenode.net (Nickname regained by services))]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
orbifx-m has joined #ocaml
<orbifx-m> any wrappers for Linux's '
<orbifx-m> '
<orbifx-m> mmap
<tobiasBora> Hello,
<tobiasBora> I'd like to know, how "difficult" is bytecode ?
<tobiasBora> For example, how much time/code line would I need to code a bytecode interpretter, in let's say, Ocaml.
<orbifx-m> tobiasBora: that's a very vague question
<tobiasBora> orbifx-m: Well, I don't see why. In other terms, is it thinkable to manually write an interpretter for the bytecode language (I'm not asking it to be really efficient), or is it too complicated and would need lot's of deep knowledges ?
jnavila_ has quit [Ping timeout: 240 seconds]
<orbifx-m> smondet`: can ocaml values be stored and referenced from there?
gnuyoda_ has quit [Ping timeout: 276 seconds]
MercurialAlchemi has joined #ocaml
gnuyoda has joined #ocaml
<Armael> tobiasBora: I'm not a specialist, but I think it should be achievable
<Armael> if you implement it in ocaml, you can eg just reuse ocaml's gc instead of reimplementing one
zpe has quit [Remote host closed the connection]
<smondet`> orbifx-m: I've never tried. Through the Marshal module yes. If you want direct “live” access it may be very tricky to play against the GC; I don't know.
<orbifx-m> tobiasBora: depends what you want it to do. E.g. if it's just adding numbers, it would be really easy.
<orbifx-m> smondet`: that is what I want, it's for IPC.
<nicoo> tobiasBora: It's not more difficult than writing an interpreter for a "usual" language. Mostly, the parsing is different
<tobiasBora> Armael: Well, I'd like to write an implementation that do not relly on the Ocaml garbage collector (else, why wouldn't I just call in my interpretter the system call "ocaml ..." ? :P).
<tobiasBora> But since I don't want a really efficient version, I don't mind to have a stupid garbage collector
<Armael> I think these two pdfs + occasionnally looking at the C code of ocamlrun should be enough
<Armael> well yeah you can also implement your gc if you want
Simn has quit [Read error: Connection reset by peer]
<tobiasBora> nicoo: Well some "usual" language are quite complicated, and I would not like to write a parser for them...
jnavila_ has joined #ocaml
<tobiasBora> *
<tobiasBora> not a parser, an interpreter sorry
<Armael> the range of features you have to implement is quite flexible; if you don't want to implement one you can basically piggy-back on the corresponding ocaml feature
<Armael> as for the bytecode parser, you can maybe reuse js_of_ocaml's
<tobiasBora> Armael: Yes, js_of_ocaml let me thinking that it would be possible ^^
Simn has joined #ocaml
<nicoo> tobiasBora: same for bytecodes! Some of them can be quite awful
<orbifx-m> thanks smondet`
ryanartecona has joined #ocaml
tane has joined #ocaml
Onemorenickname has joined #ocaml
jnavila_ has quit [Ping timeout: 240 seconds]
dhil has quit [Ping timeout: 240 seconds]
slash^ has joined #ocaml
jao has joined #ocaml
Onemorenickname has quit [Quit: Leaving]
silver_ has joined #ocaml
silver has quit [Read error: Connection reset by peer]
sh0t has quit [Quit: Leaving]
MercurialAlchemi has quit [Ping timeout: 260 seconds]
ziyourenxiang has quit [Quit: Leaving]
dhil has joined #ocaml
alfredo has quit [Quit: Textual IRC Client: www.textualapp.com]
orbifx-m has quit [Ping timeout: 240 seconds]
mvanier has joined #ocaml
govg has joined #ocaml
copy` has joined #ocaml
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zpe has joined #ocaml
smondet` is now known as smondet
larhat has quit [Quit: Leaving.]
Denommus has joined #ocaml
Denommus has quit [Client Quit]
Denommus has joined #ocaml
freusque has quit [Quit: WeeChat 1.7]
jamesst20 has joined #ocaml
freusque has joined #ocaml
rpg has joined #ocaml
freusque has quit [Client Quit]
nojb has joined #ocaml
<jamesst20> Hi again :)
<jamesst20> I have been struggling for hours on a very simple function :/ As I am new to functional langages (and also OCaml), I think I would need an example to get a better overall understanding. I have a list of char, and a method make_branch. I would like to build a tree from that method like this : (Node(list[0], Node(list[1], ...))
<jamesst20> But I am also forced to use a specific signature (for school) : http://pastebin.com/JX9GfPrC
<jamesst20> I don't know if anyone would be willing to help me :)
MercurialAlchemi has joined #ocaml
jnavila_ has joined #ocaml
<tane> jamesst20, ahoy
jnavila_ has quit [Client Quit]
<dmbaturin> let make_branch lc = Node (ref true, ref lc)
<dmbaturin> Mutable data inside a tree looks like a rather strange idea though.
smondet` has joined #ocaml
smondet` has quit [Read error: Connection reset by peer]
<dmbaturin> * let make_branch lc = Node (ref true, ref lc, ref (empty ()))
<tane> dmbaturin, looks like a mutable prefix tree, for later updates
<dmbaturin> tane: Yeah, my concern is that functional update of a prefix tree wouldn't be much harder than destructive update.
<tane> yeah
jamesst20 has quit [Remote host closed the connection]
jamesst20 has joined #ocaml
<jamesst20> Sorry
<jamesst20> Got connection issue
<jamesst20> dmbaturin: tane: The tree structure is not up to me :/
nojb has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<jamesst20> dmbaturin: "let make_branch lc = Node (ref true, ref lc, ref (empty ()))" This will not work
<jamesst20> dmbaturin: It's one letter per node. So Hello would make 5 nodes
zpe has quit [Remote host closed the connection]
<dmbaturin> This wasn't in the spec. ;)
jao has quit [Ping timeout: 255 seconds]
zpe has joined #ocaml
<jamesst20> dmbaturin: The param lc is a char list and the tree is "type tree = Node of bool ref * (char * tree) list ref"
<jamesst20> dmbaturin: Basically Node(ref false, ref [('H', Node(ref false, ref [('e', Node(ref false, ref[...]))]))]
<dmbaturin> Ah, char, not char list. Prefixes could be more flexible. But, no matter.
<jamesst20> dmbaturin: Do you think you would be able to help me ?
zpe has quit [Ping timeout: 240 seconds]
<dmbaturin> let rec make_branch cs = match cs with [] -> empty () | [c] -> Node (ref true, ref c, ref (empty ())) | c :: cs' -> Node (ref false, ref c, make_branch cs)
<dmbaturin> * make_branch cs'
ryanartecona has quit [Quit: ryanartecona]
<jamesst20> dmbaturin: Thank you, trying to read it now :) where does "* make_branch cs'" belongs to
jao has joined #ocaml
<dmbaturin> The recursive branch.
<dmbaturin> I've added the prime for clarity, not really required in practice due to shadowing.
<jamesst20> dmbaturin: Node takes 2 parameters, I am not sure to understand the third one
<dmbaturin> Adjust for the type yourself. ;)
<dmbaturin> Yeah, that's a tuple of bool ref and a tuple of char and node ref... I tell you, I would do it different if I were to make a prefix tree. In any case, that's a trivial change, just rearrange the parens.
rand__ has joined #ocaml
dch_ has joined #ocaml
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rwmjones has quit [Ping timeout: 245 seconds]
<jamesst20> dmbaturin: wow I got it to works with minor changes
rwmjones has joined #ocaml
<jamesst20> dmbaturin: Thank you so much, I get what I was not understanding. I have never though I could place the rec call directly inside there
AlexDenisov has joined #ocaml
<jamesst20> dmbaturin: Final code :) http://pastebin.com/fgFxr9gS
<dmbaturin> Well, that's the whole point of let rec. It allows recursive expressions inside the function.
ryanartecona has joined #ocaml
<jamesst20> dmbaturin: Yeah, it's just a design I am really not used to. I have done a lot and a lot of Java/C++/C#, but OCaml is very different
<dmbaturin> The reason letrec exists is that sometimes you want to refer to a name from the outer scope and shadow it, rather than have a binding refer to its own name.
<dmbaturin> Making all bindings recursive by default would make this impossible to do.
zpe has joined #ocaml
<jamesst20> Yeah :)
<jamesst20> How come this synthax "let explode = function ..." accepts params?
<jamesst20> I don't see anything in front of explode, but a space
snhmib has quit [Ping timeout: 260 seconds]
orbifx has joined #ocaml
<thizanne> that's because function ... defines a function
jao has quit [Ping timeout: 240 seconds]
<thizanne> if you write let f = function x -> 2 * x, you're basically saying "I define f as being the function that takes x as an input and returns 2*x"
ygrek has joined #ocaml
<jamesst20> let explode = function | "" -> [] | s
<jamesst20> thizanne: But this accept a param
<thizanne> yes
<jamesst20> Sounds odd to me but I think I get it
<thizanne> that's the function that, if given "" as an input, returns [], and if given another thing (which it gives the name s), returns something else that you didnt write
<jamesst20> thizanne: Alright I get it thanks :)
<thizanne> maybe you should read some book or tutorial about ocaml, as you noticed it's a bit different from C/C++/Java, so it's a bit harder to just try things without knowing the basics
<thizanne> !rwo > jamesst20 is a good one
<ocabot_> jamesst20 is a good one: https://realworldocaml.org/
<jamesst20> thizanne: Yeah I got PowerPoints from my Teacher, but it's not very very complete
<jamesst20> thizanne: wow I can read it online for free, that's cool thank you :)
dhil has quit [Ping timeout: 260 seconds]
zpe has quit [Remote host closed the connection]
HKei has joined #ocaml
infinity0 has joined #ocaml
silver_ is now known as silver
<HKei> Hello, I'm using merlin with emacs; But apparently local modules are not being picked up
slash^ has quit [Remote host closed the connection]
<HKei> I have a line_frequency.ml which uses inc_counter from assoc_counter.ml as Assoc_counter.inc_counter, but merlin says that Assoc_counter is unbound
<HKei> I can compile the file just fine with corebuild though, so there shouldn't be a problem with my code
<tane> did you read that, regarding S and B directives?
freusque has joined #ocaml
<jamesst20> thizanne: Do you know why line 8 OCaml thinks l' is a function and I am calling it :( ? It's a param to make_tree.. http://pastebin.com/DA63N7rw
<HKei> I have S . and B . in my .merlin
<HKei> although they're both in the same directory, the way I understood that article I shouldn't even need a config in that situation
<tane> jamesst20, (l' Noeud(a, ref (creer_branche (explode word))::!b)), you're apply l' to Noude (Node?)
<tane> maybe you're missing a comma
<jamesst20> tane: I am calling make_tree (l' Noeud(a, ref (creer_branche (explode word))::!b)), where l' is first parameter of make_tree and the Noeud the second. Yes Noeud is Node in english
<cojy> you need to get rid of the outer parens
<cojy> make_tree l' Noeud(a, ref (creer_branche (explode word))::!b)
<cojy> otherwise it's tryign to call l' as a function
rpg has joined #ocaml
malc_ has quit [Remote host closed the connection]
<jamesst20> tane: Okay I don't get the error message, but I just figured out something makes no sense in my code
<tane> alright :)
<HKei> tane: Ohps, I needed B _build where I had B . Thanks!
Denommus has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<jamesst20> tane: Doesn't this return a list with the element added? ('a', creer_branche (explode word))::!b. where creer_branche returns a Node and b is a (char * Node) list ref ?
<tane> does it compile?
<tane> seems about right
<jamesst20> tane: Nope same error line 8 http://pastebin.com/S2aZT5Nf
<tane> you're still having these parens?
<jamesst20> Talking about l’ —> Error: This expression has type 'a list This is not a function; it cannot be applied.
<tane> jamesst20, I'm talking about the parens opening before l'
<tane> as did cojy before
<tane> just write make_tree l' (Noued(...
<jamesst20> tane: Yeah I'm calling make_tree (param1 param2)
<jamesst20> alright
<tane> let f a b = a + b in f 1 2, no parens needed
zpe has joined #ocaml
<jamesst20> This function has type 'a list -> 'b * 'c -> 'b * 'c It is applied to too many arguments; maybe you forgot a `;'.
<jamesst20> tane: Doesn't make sense. It's only 2 params. The list, The Node
<tane> look at line 9
<tane> same thing, remove the parens
<jamesst20> tane: Done and same error
cdidd has quit [Ping timeout: 240 seconds]
cdidd has joined #ocaml
jnavila has joined #ocaml
jao has joined #ocaml
mvanier has quit [Quit: Page closed]
orbifx has quit [Ping timeout: 268 seconds]
ollehar has joined #ocaml
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
MercurialAlchemi has quit [Ping timeout: 240 seconds]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
CcxWrk has joined #ocaml
larhat has joined #ocaml
jao has quit [Ping timeout: 240 seconds]
ryanartecona has quit [Quit: ryanartecona]
_andre has quit [Quit: leaving]
orbifx has joined #ocaml
jabroney has quit [Quit: Leaving.]
tane has quit [Ping timeout: 255 seconds]
sepp2k has quit [Ping timeout: 260 seconds]
cbot has joined #ocaml
tane has joined #ocaml
kakadu has quit [Remote host closed the connection]
ollehar has quit [Remote host closed the connection]
ollehar has joined #ocaml
gnuyoda has quit [Ping timeout: 255 seconds]
freusque has quit [Ping timeout: 240 seconds]
ollehar has quit [Client Quit]
gnuyoda has joined #ocaml
Simn has quit [Quit: Leaving]
d0nn1e has quit [Ping timeout: 260 seconds]
d0nn1e has joined #ocaml
jamesst20 has quit [Remote host closed the connection]
jamesst20 has joined #ocaml
jnavila has quit [Remote host closed the connection]
rand__ has quit [Quit: leaving]
cbot has quit [Quit: This computer has gone to sleep]
ryanartecona has joined #ocaml
rpg has joined #ocaml
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
mengu has joined #ocaml
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
<jamesst20> Hi
<jamesst20> Would anyone be able to tell me why line 10 works but not 16 ? http://pastebin.com/QyAiqtZU
dxtr has quit [Ping timeout: 240 seconds]
dxtr has joined #ocaml
rcsole has quit [Ping timeout: 260 seconds]
tane has quit [Quit: Leaving]
<fds_> jamesst20: I'd say you need a pair of brackets around "Noeud(a, b) as acc'"
<fds_> jamesst20: Because of the way the parser works (which is not always intuitive)
monad_cat has joined #ocaml
<fds_> I'm not really qualified to give a better explanation than that, but I hope it helps.
<jamesst20> fds_: like that ? | word::rest, (Noeud(a,b)) as acc' -> make_tree rest acc'
<fds_> No, including the "as acc'"
<jamesst20> wait you said brackets?
<jamesst20> or parenthesis?
<fds_> I mean round brackets (parentheses)
<monad_cat> Hi #ocaml. I know this may be a common question, but google turned out mixed results. My experience in typed FP is mostly in Haskell, why would I like to use OCaml? As far as I understand right now it has better performance characteristics and is easier to understand at places, is there some other benefit I don't know of?
<fds_> jamesst20: At the moment, your code is naming "word::rest, Noeud(a, b)" as acc', but I think you only want to name "Noeud(a, b)" as acc', so you need to group it explicitly
<fds_> Unless I'm mistaken.
<jamesst20> fds_ yes exactly
<jamesst20> I only want Noeud to be acc
<fds_> So you write: | word::rest, (Noeud(a, b) as acc') -> make_tree rest acc'
<jamesst20> When I do what you said, it breaks the line "in make_tree l vide()" This function has type string list -> D_Arbo.arbre -> D_Arbo.arbre . It is applied to too many arguments; maybe you forgot a `;'.
rpg has quit [Quit: Textual IRC Client: www.textualapp.com]
cbot has joined #ocaml
octachron has joined #ocaml
<fds_> jamesst20: Hmm, I guess you want "make_tree l (vide())" ?
<jamesst20> fds_: Wow that makes it
<jamesst20> fds_: How come I have to surround all Noeud that way?
<jamesst20> I lost hours into this issue :/ Pretty new to OCaml
<octachron> jamesst20, ocaml's parser reads "f a b c d" → as "(((f a) b) c) d"
<fds_> Well, in this case, it's nothing to do with Noeud. If you type "make_tree l vide ()" you are passing three arguments to make_tree: first a list l, then a function vide, then the unit value ()
<zozozo> monad_cat: well, from what I understand (i don't know haskell very much), it is far easier in ocaml to have side-effects in functions, so if you want/need some kind of imperative style, it helps, ^^
<monad_cat> doesn't it defeat the purpose of static typing though zozozo ? I don't know OCaml at all so I'm curious :)
<octachron> monad_cat, there is also the question of modules/functors vs type classes
<zozozo> why would there be a problem ?
<jamesst20> fds_: I get it thank you :)
<jamesst20> fds_: Makes more sense. Couldn't I just have removed the parenthesis?
<jamesst20> fds_: Like make_tree l vide
<zozozo> well, side-effects can in some cases constrain a little bit the typing, but only in a very reasonnable way in my opinion
<fds_> jamesst20: Well, then you would pass the function vide itself (which has the type unit -> arbre or somethinng), not the result of vide (), which is a Noued.
<monad_cat> I meant that if any function can emit a side effect then types don't really tell you much about what how that function may affect the world
<octachron> zozozo, the (relaxed) value restriction can be painful from time to time
<zozozo> sure, types mainly are about the shape of values given to and returned by a function
<monad_cat> there are still monads in OCaml though, right?
<zozozo> octachron: right, I simply rarely ever get restricted by it so I tend to forget, :p
<octachron> monad_cat, similarly haskell type system does not track termination, so any function can never returns
<monad_cat> sure, but there's a marked difference between a bottom somewhere in the function chain and the lack of guarantee that these functions may do something to the world along the way
<octachron> monad_cat, the categorical structure is still here, it can be less practical to use monad in OCaml however (at least due to the lack of higher kinder polymorphism)
<jamesst20> fds_: Thanks it so much more clearer
<fds_> jamesst20: I'm glad I could help
<monad_cat> octachron: got it. Any other major differences? :)
rpg has joined #ocaml
<octachron> monad_cat, I am not sure if I see a major difference between an unexpected bottom and an unexpected side-effect
rpg has quit [Client Quit]
<octachron> both are the kind of things that well-behaved code tends to avoid
<Drup> monad_cat: it's a different idea of safety
rpg has joined #ocaml
<Drup> haskell is very hell-bent on purity and control of side effects
<Drup> ocaml has a more ... practical approach to the question
<Drup> yes, you can do bullshit with side effects, but not nearly as much as people say, and it's still damn useful a lot of the time
<monad_cat> a bottom doesn't influence anything outside of your program, a side effect does and could be detrimental to, say, your database. I'm not saying that OCaml's approach is worse or better than Haskell's, but guarantees from a type system are markedly weaker without side-effect tracking
<Drup> especially since OCaml is non-mutable by defualt. You have to actually say it, when you want mutations. And abstraction boundaries protects you from a lot of issues
<monad_cat> but I feel by now that it may be worth trying OCaml for a more manageable performance :P
orbifx has quit [Ping timeout: 240 seconds]
<Drup> (in general, OCaml is less elegant and more practical)
<octachron> monad_cat, on the pratical side, OCaml has labelled/optional argument
<Drup> and records that actually work
<monad_cat> any book you/site you would suggest to someone familiar with FP who would like to get up to speed on OCaml's details?
<monad_cat> oh, nice octachron
<Drup> (and a real module system ...)
<Drup> monad_cat: there are some blog posts about learning OCaml given your knowledge of Haskell
<octachron> monad_cat, also polymorphic variants + open variants are variations over sum types
<octachron> + the object system, probably the best object system which is never used
<Drup> octachron: this piece of code is disgusting. I love it
<jamesst20> fds_: It did thank you so much :D
<monad_cat> ok, so what should I read to learn more? :P
<Drup> after that, go look at the ressources on ocaml.org
<monad_cat> thanks Drup
ryanartecona has quit [Quit: ryanartecona]
<mankyKitty> monad_cat: exercism.io is nice for just diving in and poking things
jao has joined #ocaml
<Armael> monad_cat: note that in the blogpost Drup's linked, they talk about == and !=; don't use these; testing equality and inequality is done using = and <>
<monad_cat> got it
<Armael> (== and != are for physical equality)
<mankyKitty> interesting... *takes notes* (OCaml noob, professional Haskeller)
<octachron> Drup, like I said, all the wonders of GADTs errors and hidden code generation gathered in one package
<Drup> it's great
<octachron> Drup, and yet, I do encounter situations where I think that it may be a nice feature
<Drup> oh, I've wanted that several time
<Drup> and I've seen bug report on mantis about it
<Drup> the problem is not the feature, it's the price you have to pay :p
jamesst20 has quit [Remote host closed the connection]