<d_bot>
<Deadrat> Any approx dates when ocaml lsp will be released with 4.12 support?
mxns has quit [Ping timeout: 276 seconds]
Tuplanolla has quit [Ping timeout: 240 seconds]
<steenuil>
what's the correct syntax for referencing record fields in doc comments?
<steenuil>
actually scratch that
<steenuil>
is it possible to reference a field of an inline record in doc comments?
smondet[m] has quit [Ping timeout: 240 seconds]
tjammer[m] has quit [Ping timeout: 244 seconds]
smondet[m] has joined #ocaml
tjammer[m] has joined #ocaml
orbifx has quit [Quit: orbifx]
mxns has joined #ocaml
mxns has quit [Ping timeout: 240 seconds]
aquijoule__ has joined #ocaml
aquijoule_ has quit [Ping timeout: 264 seconds]
sm2n has quit [Remote host closed the connection]
sm2n has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 240 seconds]
rock64 has quit [Ping timeout: 260 seconds]
decentpenguin has quit [Ping timeout: 264 seconds]
rock64 has joined #ocaml
decentpenguin has joined #ocaml
sm2n has quit [Ping timeout: 240 seconds]
leah2 has quit [Ping timeout: 260 seconds]
leah2 has joined #ocaml
rock64 has quit [Remote host closed the connection]
boxscape has quit [Ping timeout: 264 seconds]
sz0_ has joined #ocaml
rock64 has joined #ocaml
tjammer[m] has quit [*.net *.split]
jimt[m] has quit [*.net *.split]
sz0 has quit [*.net *.split]
banjiewen__ has quit [*.net *.split]
tomjack has quit [*.net *.split]
sz0_ is now known as sz0
banjiewen__ has joined #ocaml
jimt[m] has joined #ocaml
tjammer[m] has joined #ocaml
tomjack has joined #ocaml
theblatte has quit [Ping timeout: 264 seconds]
sm2n has joined #ocaml
sm2n has quit [Remote host closed the connection]
sm2n has joined #ocaml
sm2n has quit [Read error: Connection reset by peer]
sm2n has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 256 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 240 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 245 seconds]
mxns has joined #ocaml
sm2n has quit [Ping timeout: 260 seconds]
mxns has quit [Ping timeout: 240 seconds]
sm2n has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
sm2n has quit [Ping timeout: 246 seconds]
zebrag has quit [Quit: Konversation terminated!]
sm2n has joined #ocaml
mxns has joined #ocaml
theblatte has joined #ocaml
mfp has quit [Ping timeout: 240 seconds]
mxns has quit [Ping timeout: 240 seconds]
mbuf has joined #ocaml
sz0 has quit [Quit: Connection closed for inactivity]
narimiran has joined #ocaml
_whitelogger has joined #ocaml
lopex has quit [Quit: Connection closed for inactivity]
vicfred has quit [Quit: Leaving]
sm2n has quit [Ping timeout: 256 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 258 seconds]
sm2n has joined #ocaml
sm2n_ has joined #ocaml
sm2n has quit [Ping timeout: 265 seconds]
sm2n has joined #ocaml
sm2n_ has quit [Ping timeout: 260 seconds]
decentpenguin has quit [Quit: ZNC crashed or something]
decentpenguin has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
neiluj has quit [Remote host closed the connection]
neiluj has joined #ocaml
neiluj has quit [Changing host]
neiluj has joined #ocaml
sm2n has quit [Read error: Connection reset by peer]
sm2n has joined #ocaml
dinosaure has quit [Quit: WeeChat 2.3]
dinosaure has joined #ocaml
Haudegen has joined #ocaml
benc has joined #ocaml
TheLemonMan has joined #ocaml
olle has joined #ocaml
olle_ has joined #ocaml
sm2n has quit [Ping timeout: 265 seconds]
sm2n has joined #ocaml
sm2n has quit [Ping timeout: 265 seconds]
sm2n has joined #ocaml
benc has quit [Remote host closed the connection]
sm2n_ has joined #ocaml
sm2n has quit [Read error: Connection reset by peer]
olle_ has quit [Remote host closed the connection]
sm2n has joined #ocaml
sm2n_ has quit [Ping timeout: 256 seconds]
benc has joined #ocaml
sm2n has quit [Ping timeout: 260 seconds]
ewd has joined #ocaml
shawnw has joined #ocaml
bartholin has joined #ocaml
sz0 has joined #ocaml
mfp has joined #ocaml
benc has quit [Remote host closed the connection]
orbifx has joined #ocaml
lopex has joined #ocaml
lopex is now known as Guest79714
benc has joined #ocaml
Guest79714 is now known as lopex
boxscape has joined #ocaml
benc_ has joined #ocaml
benc has quit [Read error: Connection reset by peer]
mbuf has quit [Quit: Leaving]
henistein has joined #ocaml
<henistein>
I want to make a fibonacci function that prints the x, I have this : https://pastebin.pl/view/0cfe6dd8 , but is has errors what's wrong there?
<d_bot>
<Butanium> | n when n<3
<d_bot>
<Butanium> will fix it
<d_bot>
<Butanium> you have to know that your function will work but is not optimized at all
<alexey>
henistein: n = 3
<d_bot>
<octachron> Moreover, the function always yield 0. And a double exponential slowdown is more than "not optimized".
<d_bot>
<Butanium> if you want to optimize it you'll have to check what tail recursion is
<d_bot>
<Butanium> *tail call
<d_bot>
<octachron> No. That is not the issue at all here.
<d_bot>
<octachron> The fibonnacci function grows exponentially: il will overflow 64-bit integers before stack call size becomes an issue.
<alexey>
I don't think it is possible to optimize fibonacci with tail recursion. There's a way with matrix exponentiation (or with caching).
<d_bot>
<octachron> The problem is the call to both `fib (n-1)` and `fib (n-2)` that leads to a complexity of ~`2^n`. The fast exponentiation version has a complexity of `O(ln n)`. But a simpler tuple or a memoized version should have a complexity of `O(n)` .
Haudegen has quit [Quit: Bin weg.]
zebrag has joined #ocaml
<d_bot>
<Butanium> alexey: yes you can :
<d_bot>
<Butanium> ```ocaml
<d_bot>
<Butanium> let optiFib n =
<d_bot>
<Butanium> let rec aux x acc1 acc2 =
<d_bot>
<Butanium> if x >n then acc1
<d_bot>
<Butanium> else aux (x+1) acc2 (acc1+acc2)
<d_bot>
<Butanium> in aux 1 0 1;;```
<d_bot>
<octachron> The tail-call optimisation plays a little part here, the important point is to avoid the second recursive call (here by using a tuple).
<d_bot>
<Butanium> Oh I didn't know you could use fast exponentiation for fin sequence :o
<d_bot>
<octachron> This works for any linear recursive sequences.
<henistein>
ok I understand, but I am just making a simple fibonacci function, but I want to print all the numbers, per example, fibonacci 10 : 0,1, 1, 2, 3, 5, 8, 13, 21, 34, 55 , instead of fibonacci 10 : 34
<henistein>
I have this piece of code: let rec fibonacci x = if x < 3 then x - 1 else fibonacci (x-1) + fibonacci (x - 2);; how can I add a print
arecaceae has quit [Remote host closed the connection]
arecaceae has joined #ocaml
<d_bot>
<Christophe> you bind it to a name temporarily: let rec fibonacci n = let fib = ... in print_int fib ; fib
<d_bot>
<Butanium> You can use what I wrote above by adding a print acc1 on every line
<alexey>
Butanium, indeed, but that's not a tail-recursive implementation of the original recursive formula, that's very much for-loop. In this direction of course you can.
tane has joined #ocaml
<d_bot>
<octachron> It is an implementation of the original recursive formula, just expressed as a linear recursion on β^2: ` x_{n+1} = M x_n`
henistein has quit [Ping timeout: 240 seconds]
<d_bot>
<Butanium> Alexey maybe the english term has not the same meaning as the french word "recursion terminale" which is what I did.
mxns has joined #ocaml
mxns has quit [Ping timeout: 245 seconds]
shawnw has quit [Ping timeout: 265 seconds]
<alexey>
No, I understand what you mean, and you're right.
<alexey>
My point was that the original formula works in such a way that computation of f(n) causes computation of f(smaller value); the rewrite doesn't work that way. But of course it's the right way to do the things, I don't disagree here.
Haudegen has joined #ocaml
<alexey>
If you think about factorial, for example: you can write it with tail recursion in such a way that f(n) causes f(n-1), or in the same way as you did with fibonacci.
<alexey>
With fibonacci only your way allows tail recursion.
<alexey>
forget what I said
<alexey>
I'm tired and speaking nonsense
<alexey>
you are completely right, and I'm blabbering
sm2n has joined #ocaml
<alexey>
so brainfart, sorry
mxns has joined #ocaml
<d_bot>
<Cyclomatic Complexity> Will a module type signature substitution `with t := t'` always have the property that if I replaced all `t` by `t'` in the module signature by myself in the same context, I would get the same result?
mxns has quit [Ping timeout: 272 seconds]
<d_bot>
<EduardoRFS> I think so, from what I understand it's exactly like that, as if you made a copy of the module and replaced all `type t`
<d_bot>
<octachron> Yes (except for a bug with ghost type declarations (for private row types and classes))
<d_bot>
<Cyclomatic Complexity> sad, I think I have a counter-example
<d_bot>
<Cyclomatic Complexity> @EduardoRFS Available for a quick call so that you can validate if it is a counter-example, and if it is, making it into a minimal one?
<d_bot>
<octachron> Ah, and in case of name capture too.
<d_bot>
<Cyclomatic Complexity> I might have a case of `name capture`. Can you explain what it means?
<d_bot>
<octachron> If you have `type tmp type t = A of tmp` and you then replace `tmp` with a newly defined type `t`
<d_bot>
<Cyclomatic Complexity> oh yeah
<d_bot>
<Cyclomatic Complexity> then the newly `t` is not bound
<d_bot>
<Cyclomatic Complexity> like, it doesn't retro change the definition of `type t`
<d_bot>
<Cyclomatic Complexity> yeah, not what i am facing then
<d_bot>
<Cyclomatic Complexity> π¦
<d_bot>
<EduardoRFS> but there is any way to do the substitution? Where it would make a recursive type?
<d_bot>
<Cyclomatic Complexity> @octachron
<d_bot>
<Cyclomatic Complexity> I have a `file.ml` and `file.mli`. In a module type signature, I want to perform a substitution on the `type t` in `file.mli`. So I do something like `include module type of File with type t := my_new_thing`. `my_new_thing` is abstract in the current context.
<d_bot>
<Cyclomatic Complexity> This fails. However, copy-pasting the signature in `file.mli`, manually replacing all `t` by `my_new_thing`, makes it work.
<d_bot>
<octachron> You cannot transform a non-recursive definition into a recursive one since module types don't define type, so there is no way to replace `tmp` with the type `t` being defined in the module type.
Tuplanolla has joined #ocaml
<d_bot>
<octachron> @Cyclomatic Complexity : is `t` abstract? What is the error?
<d_bot>
<Cyclomatic Complexity> Let me try to create a minimal example
mxns has joined #ocaml
orbifx has quit [Quit: orbifx]
benc_ has quit [Remote host closed the connection]
benc has joined #ocaml
<d_bot>
<Cyclomatic Complexity> The following works:
<d_bot>
<Cyclomatic Complexity>
<d_bot>
<Cyclomatic Complexity> ```ocaml
<d_bot>
<Cyclomatic Complexity> (* base.ml *)
<d_bot>
<Cyclomatic Complexity> type t = int
<d_bot>
<Cyclomatic Complexity>
<d_bot>
<Cyclomatic Complexity> (* medium.ml *)
<d_bot>
<Cyclomatic Complexity> type t = Base.t
<d_bot>
<Cyclomatic Complexity> let _a : t = 42
<d_bot>
<Cyclomatic Complexity> let b : t = 53
<d_bot>
<Cyclomatic Complexity>
<d_bot>
<Cyclomatic Complexity> (* wrapper.mli *)
<d_bot>
<Cyclomatic Complexity> type t
<d_bot>
<Cyclomatic Complexity> module Medium : sig
<d_bot>
<Cyclomatic Complexity> val b : t
<d_bot>
<Cyclomatic Complexity> end
<d_bot>
<Cyclomatic Complexity> val print_int : t -> unit
<d_bot>
<Cyclomatic Complexity>
<d_bot>
<Cyclomatic Complexity> (* wrapper.ml *)
<d_bot>
<Cyclomatic Complexity> type t = Base.t
<d_bot>
<Cyclomatic Complexity> module Medium = struct
<d_bot>
<Cyclomatic Complexity> include Medium
<d_bot>
<Cyclomatic Complexity> end
<d_bot>
<Cyclomatic Complexity> let print_int : t -> unit = fun n -> Format.printf "%d\n" n
<d_bot>
<Cyclomatic Complexity>
<d_bot>
<Cyclomatic Complexity> (* main.ml *)
<adrien>
please use a pastebin of yuour choice for such lengthy messages
<adrien>
(basically, more than 3 lines is flood)
<d_bot>
<Cyclomatic Complexity> I have edited the message in Discord to contain a pastebin link instead ( https://pastebin.com/477SJDWx ). But I guess the damage is already done for IRC clients, sorry.
benc has quit [Read error: Connection reset by peer]
benc has joined #ocaml
<d_bot>
<Cyclomatic Complexity> @octachron The naive solution, with module substitution, doesn't work: https://pastebin.com/Uk8zcFdW
<d_bot>
<Cyclomatic Complexity> The posted situation is literally a search&replace of the one with substitution
<d_bot>
<octachron> The problem is already here in `medium.mli`: once `Medium.t'` is abstract, there is no way to recover the type equality `Medium.t'`=`Base.t`.
<d_bot>
<Cyclomatic Complexity> But why do we need the type equality? I am just using the signature and performing a substitution
<d_bot>
<Cyclomatic Complexity> We don't need to assert that `Medium.t' = Base.t`
<d_bot>
<Cyclomatic Complexity> I want to replace `t'` with `Base.t`
<d_bot>
<octachron> You cannot once you have hidden the information. It is your implementation that is wrong in the second case.
<d_bot>
<Cyclomatic Complexity> I don't understand why. This is literally a substitution
arecaceae has quit [Remote host closed the connection]
arecaceae has joined #ocaml
motherfsck has quit [K-Lined]
amr has quit [K-Lined]
aquijoule__ has quit [Ping timeout: 256 seconds]
terrorjack has joined #ocaml
TheLemonMan has quit [Ping timeout: 240 seconds]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
mischief has joined #ocaml
<mischief>
hi. can anyone tell me why this happens or how to fix it?
gareppa has joined #ocaml
<mischief>
$ opam install coccinelle.1.0.2
<mischief>
Sorry, no solution found: there seems to be a problem with your request.
<mischief>
No solution found, exiting
<mischief>
blah. i inuited that ocaml was too new, so i ran `opam switch create 4.02.1` and this old ocaml now works for old coccinelle.. i dont get why opam can't tell me that it needs old ocaml.
arecaceae has quit [Remote host closed the connection]
arecaceae has joined #ocaml
slt[m] has joined #ocaml
mxns has quit [Ping timeout: 258 seconds]
narimiran has quit [Ping timeout: 246 seconds]
mxns has joined #ocaml
omni has quit [Read error: Connection reset by peer]
omni has joined #ocaml
mxns has quit [Ping timeout: 272 seconds]
Exagone313 has quit [Quit: see ya!]
Exagone313 has joined #ocaml
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
vsiles has quit [Ping timeout: 276 seconds]
vsiles has joined #ocaml
averell has quit [*.net *.split]
penguwin has quit [*.net *.split]
iZsh has quit [*.net *.split]
Drup has quit [*.net *.split]
shmibs has quit [*.net *.split]
brettgilio_ has quit [*.net *.split]
stux|RC-only has quit [*.net *.split]
landonf has quit [*.net *.split]
White_Flame has quit [*.net *.split]
nore has quit [*.net *.split]
tristanC has quit [*.net *.split]
Johann has quit [*.net *.split]
valtr has quit [*.net *.split]
takside has quit [*.net *.split]
asm89 has quit [*.net *.split]
oznt has quit [*.net *.split]
haskell_enthusia has quit [*.net *.split]
averell has joined #ocaml
iZsh has joined #ocaml
penguwin has joined #ocaml
oznt has joined #ocaml
brettgilio_ has joined #ocaml
shmibs has joined #ocaml
stux|RC-only has joined #ocaml
Drup has joined #ocaml
nore has joined #ocaml
takside has joined #ocaml
tristanC has joined #ocaml
Johann has joined #ocaml
White_Flame has joined #ocaml
valtr has joined #ocaml
haskell_enthusia has joined #ocaml
landonf has joined #ocaml
asm89 has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 245 seconds]
<d_bot>
<mseri> Strange, it usually points out what is the problem. Is it the latest version of opam? There is no upper bound on ocaml though, I think the solver is not finding a solution for some reason
<mischief>
d_bot: i use opam from ubuntu 20.04.
<d_bot>
<mseri> Then yeah it should be recent
<d_bot>
<mseri> Were you using a specific opam switch or the system switch?
<mischief>
the system one.
<mischief>
when i switch to an old ocaml, it works.
<d_bot>
<mseri> Does it work with a more recent non-system switch? (Sorry for wasting your time)
<d_bot>
<mseri> I wonder of num or camlp4, which are special wrt the system switch, may be the culprit
<mischief>
i frankly did not try any other versions
<d_bot>
<mseri> Still, can you also tell me what opam βversion says? The error message seems the one from opam 1
<mischief>
i am not a ocaml user, but i am dependent on coccinelle to operate linux backports
<d_bot>
<mseri> π
<mischief>
so i know very little about this stuff
<mischief>
$ opam --version
<mischief>
2.0.5
<mischief>
this ?
terrorjack has joined #ocaml
mxns has joined #ocaml
<d_bot>
<mseri> Oh yes, and I did remember incorrectly. The engine producing the error reports has been rewritten in opam 2.1.0~beta4 (I always forget that I use the beta sorry), so it will be released sometimes soon but is not yet there. That should have pointed to a clearer reason for the failure. Uninformative messages are rare in 2.0 but still happen from time to time π