<jedb>
according to ocaml.org, the only difference between let and let rec is that the latter binds names to values in the pattern matching before evaluating the definitions
<jedb>
yet "let (a,b) = (1,2)" is legal while "let rec (a,b) = (1,2)" is not
<jedb>
what's going on here?
calvnce73 has quit [Quit: Client closed]
taupiqueur has joined #ocaml
taupiqueur has quit [Client Quit]
dnh has joined #ocaml
taupiqueur has joined #ocaml
jedb has quit [Ping timeout: 250 seconds]
taupiqueur18 has joined #ocaml
taupiqueur18 has quit [Client Quit]
taupiqueur has quit [Remote host closed the connection]
jedb has joined #ocaml
random-jellyfish has joined #ocaml
taupiqueur has joined #ocaml
taupiqueur has quit [Remote host closed the connection]
random-jellyfish has quit [Client Quit]
spip has quit [Read error: Connection reset by peer]
spip has joined #ocaml
taupiqueur has joined #ocaml
<kakadu>
About type inference. With single definition we typecheck and perform generalization after that. What to do with mutual type definitions? I'm not sure when genertalization should take place, we might get too restricted types... Any useful link/paper?
<jedb>
that doesn't seem to explain why let rec is more restrictive than let
<jedb>
it just makes note that it is
wingsorc has quit [Ping timeout: 246 seconds]
calvnce46 has joined #ocaml
<gahr>
what would be the use case for wanting a pattern match on the lhs?
taupiqueur has quit [Remote host closed the connection]
<jedb>
well, I ran into this issue when writing a long let expression with various intermediate values that refer to other values in a function that does division on polynomials
<jedb>
part of that involved retrieving coefficient/exponent pairs and quotient/remainder pairs
<jedb>
hence the (a,b) pattern
<jedb>
so I'd say the general use case would be functions that return multiple values
taupiqueur has joined #ocaml
jlrnick has quit [Ping timeout: 272 seconds]
<gahr>
uhm so your (a, b) is destructuring the return of a function application you have on the rhs?
<jedb>
yes
<gahr>
I might be misunderstanding, but I don't think you need it to be a let rec
<gahr>
you're not defining a new function
<jedb>
true, it doesn't need to be a let rec, and indeed it works just fine as a lot of nested "let ... in" lines
<jedb>
I just reached for let rec first because of how the values get used in defining other values, under the assumption that the only difference between let and let rec was the ability to reference the names before the definitions are done in let rec
<zozozo>
jedb: basically, the problem is that you cannot inspect the "inside" of a value being recursively defined inside of its own definition
<zozozo>
Here, you recursively define a tuple, and thus you cannot read its field before it is defined
<zozozo>
Basically, you should not use recursive definition of values unless you absolutely need it
<jedb>
so only use let rec when you need to reference something in its own definition then, I guess?
<zozozo>
Yup
<gahr>
yep
<jedb>
the piles of nested "let ... in" lines still just seem conceptually off to me...
<gahr>
can you share a sketch of how you would like your code to look like, if you could use let rec?
<gahr>
I'm not sure I fully understand your expectation
<zozozo>
jedb: it is idiomatic code to write "let a = ... in let b = ... in ..."
<zozozo>
And align all let bindings with the same indentation
<jedb>
gahr: what I would have expected, coming from other languages, is that "let ... in" would increase the indentation, thus making a sequence of them produce unreasonably indented code
wonko has quit [Ping timeout: 250 seconds]
Haudegen has quit [Quit: Bin weg.]
<jedb>
that idiomatic OCaml doesn't do that, having them all on the same indentation as zozozo says, thus seems off to me even though it's fine
<zozozo>
Yeah, if you increase indentation with each let, then it's annoying to read
<zozozo>
But it's the same as of you increased indentation with each variable declaration/assignment in C :it's obviously not a great idea, so one should just not do that
<jedb>
more been comparing it to Haskell
<zozozo>
I don't have a lot of experience with Haskell, so I can't really give a comparison, :p
<gahr>
still not sure I get how that would be different with a let rec
<gahr>
can you share some pseudo-code of how you thought it would work?
<zozozo>
jedb: if you want, I can share some examples of what some idiomatic code can look like (particularly when you use successive let bindings)
<jedb>
no need, I'm already halfway through a small project that involves lablgtk, so plenty of successive let bindings in sequential code involved there
<jedb>
gahr: it wouldn't be significantly different, really
<jedb>
for comparison, in Haskell a let expression is actually a let rec except with the ability to pattern match, indentation is semantically significant, and you do typically increase indentation after the 'in'
cedric has joined #ocaml
Haudegen has joined #ocaml
troydm has quit [Ping timeout: 250 seconds]
mg has quit [Quit: boot]
azimut has joined #ocaml
taupiqueur has quit [Remote host closed the connection]
mg has joined #ocaml
reynir has quit [Ping timeout: 260 seconds]
Tuplanolla has joined #ocaml
wonko has joined #ocaml
calvnce has quit [Quit: Client closed]
waleee has joined #ocaml
zebrag has joined #ocaml
rgrinberg has joined #ocaml
jlrnick has joined #ocaml
bgs has joined #ocaml
jlrnick has quit [Ping timeout: 272 seconds]
dextaa has quit [Quit: Leaving]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dextaa has joined #ocaml
azimut has quit [Ping timeout: 258 seconds]
dextaa4 has joined #ocaml
dextaa has quit [Ping timeout: 250 seconds]
dextaa4 is now known as dextaa
dextaa has quit [Ping timeout: 272 seconds]
dextaa has joined #ocaml
dextaa has quit [Client Quit]
dextaa has joined #ocaml
rgrinberg has joined #ocaml
hackinghorn has quit [Changing host]
hackinghorn has joined #ocaml
hackinghorn is now known as hacking-haunt
dextaa has quit [Quit: Leaving]
dextaa has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
Tuplanolla has quit [Ping timeout: 250 seconds]
manicennui has joined #ocaml
Serpent7776 has quit [Quit: WeeChat 1.9.1]
taupiqueur has joined #ocaml
azimut has joined #ocaml
Tuplanolla has joined #ocaml
taupiqueur has quit [Remote host closed the connection]
taupiqueur has joined #ocaml
taupiqueur has quit [Ping timeout: 244 seconds]
calvnce46 has quit [Quit: Client closed]
x88x88x has quit [Ping timeout: 252 seconds]
oisota1 has joined #ocaml
grobe0ba has quit [Ping timeout: 252 seconds]
justache has joined #ocaml
klu_ has joined #ocaml
klu_ has quit [Changing host]
klu_ has joined #ocaml
johnel has quit [Ping timeout: 252 seconds]
SquidDev5 has joined #ocaml
drewolson0 has joined #ocaml
johnel has joined #ocaml
dme2_ has joined #ocaml
klu has quit [Ping timeout: 252 seconds]
SquidDev has quit [Ping timeout: 252 seconds]
SquidDev5 is now known as SquidDev
grobe0ba has joined #ocaml
oisota has quit [Ping timeout: 252 seconds]
Techcable has quit [Ping timeout: 252 seconds]
drewolson has quit [Ping timeout: 252 seconds]
dme2 has quit [Ping timeout: 252 seconds]
drewolson0 is now known as drewolson
oisota1 is now known as oisota
rks` has quit [Ping timeout: 252 seconds]
CalimeroTeknik has quit [Ping timeout: 252 seconds]
pie_ has quit [Ping timeout: 252 seconds]
justHaunted has quit [Ping timeout: 252 seconds]
Johann has quit [Ping timeout: 252 seconds]
cross has quit [Ping timeout: 252 seconds]
pie_ has joined #ocaml
rks` has joined #ocaml
Techcable has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cross has joined #ocaml
x88x88x has joined #ocaml
Serpent7776 has joined #ocaml
ctk has joined #ocaml
dme2_ is now known as dme2
<olle>
00:09.370 CLIENT conflict!
<olle>
What's the next step after this useless debug output?
rgrinberg has joined #ocaml
<olle>
(opam)
humasect has joined #ocaml
Johann has joined #ocaml
justache is now known as justHaunted
wonko has quit [Ping timeout: 250 seconds]
kakadu has quit [Quit: Konversation terminated!]
<olle>
Reported error on package owner issue tracker
humasect has quit [Quit: Leaving...]
ctk is now known as CalimeroTeknik
CalimeroTeknik has quit [Changing host]
CalimeroTeknik has joined #ocaml
Serpent7776 has quit [Ping timeout: 240 seconds]
Haudegen has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bartholin has quit [Quit: Leaving]
rgrinberg has joined #ocaml
humasect has joined #ocaml
humasect has quit [Remote host closed the connection]
jao has joined #ocaml
mbuf has quit [Quit: Leaving]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
troydm has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jlrnick has joined #ocaml
dextaa2 has joined #ocaml
wingsorc has joined #ocaml
dextaa has quit [Ping timeout: 240 seconds]
dextaa2 is now known as dextaa
Anarchos has joined #ocaml
Stumpfenstiel has joined #ocaml
wingsorc has quit [Quit: Leaving]
Anarchos has quit [Ping timeout: 255 seconds]
zebrag has quit [Ping timeout: 250 seconds]
bgs has quit [Remote host closed the connection]
wingsorc has joined #ocaml
terrorjack has quit [Ping timeout: 240 seconds]
terrorjack has joined #ocaml
wingsorc has quit [Remote host closed the connection]
jlrnick has quit [Ping timeout: 255 seconds]
wingsorc has joined #ocaml
rgrinberg has joined #ocaml
bobo_ has joined #ocaml
spip has quit [Ping timeout: 240 seconds]
cedric has quit [Quit: Konversation terminated!]
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
taupiqueur has joined #ocaml
Haudegen has quit [Read error: Connection reset by peer]
Stumpfenstiel has quit [Read error: Connection reset by peer]
taupiqueur has quit [Remote host closed the connection]
taupiqueur has joined #ocaml
Haudegen has joined #ocaml
Stumpfenstiel has joined #ocaml
taupiqueur has quit [Remote host closed the connection]
olle has quit [Ping timeout: 250 seconds]
Tuplanolla has quit [Quit: Leaving.]
zebrag has joined #ocaml
taupiqueur has joined #ocaml
taupiqueur has quit [Remote host closed the connection]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]