adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.09 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.09/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
jao has quit [Remote host closed the connection]
toppler has quit [Ping timeout: 240 seconds]
Haudegen has quit [Quit: Bin weg.]
toppler has joined #ocaml
okuu has joined #ocaml
Traviss__ has joined #ocaml
<okuu> I am trying to write a dumb program in SML, but can't. If someone could tell me how this program could be written in OCaml, I'll switch in a heartbeat: https://stackoverflow.com/q/58550827/46571
vicfred has joined #ocaml
Traviss__ has quit [Client Quit]
Traviss__ has joined #ocaml
traviss has quit [Ping timeout: 245 seconds]
Traviss__ has quit [Client Quit]
traviss has joined #ocaml
toppler has quit [Ping timeout: 265 seconds]
toppler has joined #ocaml
traviss has quit [Quit: Leaving]
toppler has quit [Ping timeout: 268 seconds]
traviss has joined #ocaml
toppler has joined #ocaml
Haudegen has joined #ocaml
mfp has quit [Ping timeout: 264 seconds]
toppler has quit [Ping timeout: 240 seconds]
toppler has joined #ocaml
tormen_ has joined #ocaml
tormen has quit [Ping timeout: 268 seconds]
toppler has quit [Ping timeout: 276 seconds]
toppler has joined #ocaml
toppler has quit [Ping timeout: 264 seconds]
toppler has joined #ocaml
okuu has quit [Quit: brb]
toppler has quit [Ping timeout: 246 seconds]
toppler has joined #ocaml
narimiran has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kleisli has quit [Ping timeout: 240 seconds]
ggole has joined #ocaml
gravicappa has joined #ocaml
toppler has quit [Ping timeout: 240 seconds]
toppler has joined #ocaml
nullifidian__ is now known as nullifidian
unyu has quit [Remote host closed the connection]
unyu has joined #ocaml
toppler has quit [Ping timeout: 252 seconds]
toppler has joined #ocaml
kvda has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
bartholin has quit [Remote host closed the connection]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
nullifidian has quit [Read error: Connection reset by peer]
nullifidian_ has joined #ocaml
madroach has joined #ocaml
Serpent7776 has joined #ocaml
toppler has quit [Ping timeout: 240 seconds]
nullifidian__ has joined #ocaml
brillenfux has joined #ocaml
nullifidian_ has quit [Ping timeout: 240 seconds]
toppler has joined #ocaml
nullifidian__ is now known as nullifidian
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
toppler has quit [Ping timeout: 245 seconds]
toppler has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kvda has joined #ocaml
kvda has quit [Client Quit]
toppler has quit [Ping timeout: 276 seconds]
toppler has joined #ocaml
gareppa has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
kvda has joined #ocaml
madroach has joined #ocaml
gareppa has quit [Remote host closed the connection]
gareppa has joined #ocaml
gareppa has quit [Quit: Leaving]
gareppa has joined #ocaml
dhil has joined #ocaml
toppler has quit [Ping timeout: 264 seconds]
vicfred has quit [Remote host closed the connection]
toppler has joined #ocaml
gareppa has quit [Quit: Leaving]
gareppa has joined #ocaml
toppler has quit [Ping timeout: 265 seconds]
toppler has joined #ocaml
mfp has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gareppa has quit [Quit: Leaving]
toppler has quit [Ping timeout: 240 seconds]
gravicappa has quit [Ping timeout: 265 seconds]
toppler has joined #ocaml
nullifidian_ has joined #ocaml
nullifidian has quit [Read error: Connection reset by peer]
webshinra has quit [Remote host closed the connection]
webshinra has joined #ocaml
toppler has quit [Ping timeout: 245 seconds]
toppler has joined #ocaml
toppler has quit [Ping timeout: 264 seconds]
toppler has joined #ocaml
jgkamat has quit [Ping timeout: 240 seconds]
Niamkik has quit [Quit: WeeChat 2.4]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
Niamkik has joined #ocaml
dhil has quit [Ping timeout: 246 seconds]
jack5638 has quit [Remote host closed the connection]
dhil has joined #ocaml
dhil has quit [Client Quit]
gareppa has joined #ocaml
toppler has quit [Ping timeout: 252 seconds]
gareppa has quit [Remote host closed the connection]
jgkamat has joined #ocaml
toppler has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
kleisli has joined #ocaml
toppler has quit [Ping timeout: 264 seconds]
toppler has joined #ocaml
jbrown has quit [Ping timeout: 246 seconds]
jaar has joined #ocaml
toppler has quit [Ping timeout: 250 seconds]
Haudegen has joined #ocaml
toppler has joined #ocaml
spew has joined #ocaml
warriors has joined #ocaml
toppler has quit [Ping timeout: 246 seconds]
picolino has joined #ocaml
toppler has joined #ocaml
klntsky has quit [Remote host closed the connection]
klntsky has joined #ocaml
jbrown has joined #ocaml
picolino has quit [Ping timeout: 240 seconds]
unyu has quit [Quit: restart]
unyu has joined #ocaml
nullifidian__ has joined #ocaml
toppler has quit [Ping timeout: 240 seconds]
nullifidian_ has quit [Ping timeout: 240 seconds]
toppler has joined #ocaml
Serpent7776 has quit [Quit: Leaving]
gareppa has joined #ocaml
toppler has quit [Ping timeout: 265 seconds]
smazga has joined #ocaml
toppler has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
FreeBirdLjj has joined #ocaml
Traviss__ has joined #ocaml
Traviss__ has quit [Client Quit]
Traviss__ has joined #ocaml
traviss has quit [Ping timeout: 245 seconds]
Traviss__ has quit [Client Quit]
gravicappa has joined #ocaml
traviss has joined #ocaml
Haudegen has joined #ocaml
toppler has quit [Ping timeout: 265 seconds]
picolino has joined #ocaml
traviss has quit [Quit: Leaving]
traviss has joined #ocaml
toppler has joined #ocaml
jbrown has quit [Quit: Leaving]
gareppa has quit [Quit: Leaving]
<narimiran> is there a tool (?) which can tell you if some function is tail-recursive or not?
Haudegen has quit [Ping timeout: 246 seconds]
<companion_cube> you can annotation recursive calls like this: `(f [@tailcall]) x y z`
<companion_cube> and it emits a warning if this is not a tailcall to f
Serpent7776 has joined #ocaml
Haudegen has joined #ocaml
<narimiran> thanks companion_cube, let me try that
toppler has quit [Ping timeout: 240 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
toppler has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 250 seconds]
kowale has joined #ocaml
kowale has quit [Remote host closed the connection]
Vikfret has joined #ocaml
gareppa has joined #ocaml
toppler has quit [Ping timeout: 268 seconds]
toppler has joined #ocaml
ggole has quit [Remote host closed the connection]
ggole has joined #ocaml
haskell_enthusia has joined #ocaml
nullifidian__ is now known as nullifidian
toppler has quit [Ping timeout: 240 seconds]
Haudegen has quit [Quit: Bin weg.]
jnavila has joined #ocaml
toppler has joined #ocaml
gravicappa has quit [Ping timeout: 240 seconds]
jaar has quit [Ping timeout: 276 seconds]
gravicappa has joined #ocaml
gareppa has quit [Quit: Leaving]
nullifidian_ has joined #ocaml
nullifidian has quit [Ping timeout: 240 seconds]
nullifidian_ is now known as nullifidian
toppler has quit [Ping timeout: 240 seconds]
toppler has joined #ocaml
jnavila has quit [Ping timeout: 246 seconds]
bartholin has joined #ocaml
ohama has quit [Ping timeout: 265 seconds]
ohama has joined #ocaml
brillenfux has quit [Ping timeout: 240 seconds]
toppler has quit [Ping timeout: 268 seconds]
bitwinery has joined #ocaml
jnavila has joined #ocaml
Haudegen has joined #ocaml
toppler has joined #ocaml
smazga has quit [Ping timeout: 276 seconds]
smazga has joined #ocaml
toppler has quit [Ping timeout: 265 seconds]
toppler has joined #ocaml
rdivyanshu_ has quit [Quit: Connection closed for inactivity]
klntsky has quit [Remote host closed the connection]
klntsky has joined #ocaml
Hrundi_V_Bakshi has joined #ocaml
gravicappa has quit [Ping timeout: 240 seconds]
kakadu has joined #ocaml
toppler has quit [Ping timeout: 240 seconds]
toppler has joined #ocaml
ggole has quit [Quit: Leaving]
narimiran has quit [Ping timeout: 245 seconds]
neiluj has joined #ocaml
<neiluj> hello !
<neiluj> I wrote a tail recursive function to compute the size of a binary tree : https://privatebin.net/?9596fa69fe4cc13c#AypKM7BAKjfb3QehQG9Yq8StdkGgj5EiDuNZM1dN1t25
<neiluj> but I get stack overflows when I try this function with very large trees, so I'm wondering if there is a way to be more efficient
<companion_cube> it's not tailrecursive in the first Node case
<companion_cube> you probably want to carry a size accumulator as well
<neiluj> companion_cube: size' xs (1 + size' [l] n) is not tail recursive ?
<companion_cube> not the inner size'
<neiluj> ok so to be tail recursive the accumulator should not call the recursive function
<neiluj> well there shouldn't be a call in the accumulator
<companion_cube> well you first compute `1 + size' [l] n`
<companion_cube> and because it's not in tail position, you have a stack frame
<neiluj> i agree with that
<companion_cube> so you get stack overflows
<neiluj> i understand, but the function would work if i had an infinite memory right?
<companion_cube> an infinite stack
<companion_cube> this eats stack
<companion_cube> my version only uses memory
<neiluj> the function calls eats stack yes
<neiluj> yes you're right
<companion_cube> because one of the calls isn't tailrec :)
<neiluj> interesting, i always thought that a function is not tail rec when you do a computation with the recursive function call
<companion_cube> which is what you do here
<neiluj> but i didn't thought it is the case in the accumulator
<companion_cube> well you need to compute the accumulator before you pass it to your function ^^
<neiluj> now it is obvious ^^
<neiluj> indeed
<companion_cube> heh, these things take a bit of time :)
<neiluj> so you merged the double match in one
<neiluj> well thank you very much companion_cube !
<companion_cube> ✔
toppler has quit [Ping timeout: 276 seconds]
<companion_cube> yeah this is just keeping the stack of calls to do as a heap-allocated list
<companion_cube> + an accumulator for the size computed so far
<neiluj> now your function looks even simpler than mine ^^
<neiluj> it's less nested
<companion_cube> years of habit :)
warriors has quit [Quit: Connection closed for inactivity]
toppler has joined #ocaml
smazga has quit [Quit: leaving]
toppler has quit [Ping timeout: 268 seconds]
toppler has joined #ocaml
nullifidian_ has joined #ocaml
nullifidian has quit [Ping timeout: 240 seconds]
jnavila has quit [Ping timeout: 276 seconds]
neiluj has quit [Quit: neiluj]
toppler has quit [Ping timeout: 240 seconds]
Serpent7776 has quit [Quit: leaving]
toppler has joined #ocaml
kakadu has quit [Remote host closed the connection]
toppler has quit [Ping timeout: 240 seconds]
toppler has joined #ocaml
Vikfret has quit [Quit: Leaving]
bitwinery has quit [Read error: Connection reset by peer]
bitwinery has joined #ocaml
bitwinery has quit [Remote host closed the connection]
bitwinery has joined #ocaml
toppler has quit [Ping timeout: 268 seconds]
toppler has joined #ocaml
malina has joined #ocaml
malina has quit [Remote host closed the connection]