humasect has quit [Remote host closed the connection]
humasect has joined #ocaml
mro has joined #ocaml
mro has quit [Ping timeout: 256 seconds]
mbuf has quit [Ping timeout: 256 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mbuf has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
tomku has quit [Ping timeout: 256 seconds]
jlrnick has joined #ocaml
tomku has joined #ocaml
shawnw has joined #ocaml
jlrnick has quit [Ping timeout: 268 seconds]
humasect has quit [Quit: Leaving...]
pmk has joined #ocaml
Serpent7776 has joined #ocaml
<d_bot>
<orbitz> @Valzou I have a bunch of functor applications
pmk has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
spip has joined #ocaml
bobo has quit [Ping timeout: 256 seconds]
orbifx has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
jlrnick has joined #ocaml
bartholin has joined #ocaml
bobo has joined #ocaml
spip has quit [Ping timeout: 268 seconds]
mro has joined #ocaml
wingsorc has quit [Quit: Leaving]
<d_bot>
<mefyl> Anyone hitting this merlin error as soon as there is a file name collision `Several source files in your path have the same name, and merlin doesn't know which is the right one` ? I get this very often, but I'm not sure if that's an error in my setup or to be expected.
mro has quit [Remote host closed the connection]
hyphen has quit [Ping timeout: 260 seconds]
mro has joined #ocaml
jlrnick has quit [Remote host closed the connection]
hyphen has joined #ocaml
mro has quit [Remote host closed the connection]
<d_bot>
<Et7f3> Have you two file that are named exactly the same ?
orbifx has quit [Quit: orbifx]
<ns12>
Hello, does anyone have code that shows how to implement fold_right in terms of fold_left?
<vsiles>
why would you do such a thing ?
<ns12>
This is for educational purposes. I already have an implementation of fold_left in terms of fold_right.
jlrnick has joined #ocaml
Anarchos has joined #ocaml
<ns12>
let fold_left f init l = (List.fold_right (fun elem k acc -> k (f acc elem)) l Fun.id) init
* Anarchos
greets everyone
<ns12>
I am pretty exhausted by the fold_left above, so I'm wondering if anyone has a working implementation of fold_right in terms of fold_left that I can study.
<d_bot>
<NULL> How about swapping fold_left for fold_right and adequately moving around the order of arguments?
<d_bot>
<NULL> The mechanism for applying to f in reverse should be the same
<ns12>
One way is: let fold_right f l init = List.fold_left (fun acc elem -> f elem acc) init (List.rev l)
<ns12>
But that is not the one I'm looking for, even though it happens to be tail recursive.
Everything has joined #ocaml
hyphen has quit [Ping timeout: 250 seconds]
hyphen has joined #ocaml
<d_bot>
<NULL> `let fold_right f l init = List.fold_left (fun k el acc -> k (f el acc)) Fun.id l init` this is what I meant by moving around the order of arguments
<Anarchos>
NULL i always find the type of fold_left/flod_right very helpful, did you keep them in sight ?
<d_bot>
<NULL> I did ? This fold_right has the same type as `List.fold_right` if that's what you mean
<Anarchos>
i mean, compare List.fold_left with List.fold_right
<d_bot>
<NULL> Again, not sure what you mean: those have different types, but so what ?
<Anarchos>
NULL maybe i don't understand your question...
<ns12>
Thank you NULL.
<d_bot>
<NULL> I didn't ask any question "I did ?" is (supposed to be) a suspended assertion, about the same meaning as "I did, did I ?"
waleee has joined #ocaml
mro has joined #ocaml
mro has quit [Ping timeout: 250 seconds]
epony has quit [Read error: Connection reset by peer]
hyphen has quit [Ping timeout: 250 seconds]
jlrnick has quit [Remote host closed the connection]
hyphen has joined #ocaml
jlrnick has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
Techcable has quit [Remote host closed the connection]
gravicappa has quit [Ping timeout: 240 seconds]
Techcable has joined #ocaml
shawnw has quit [Ping timeout: 256 seconds]
<d_bot>
<mefyl> Yes, but in different libraries. More specifically:
<d_bot>
<mefyl> ```user-error: Several source files in your path have the same name, and merlin doesn't know which is the right one: /home/mefyl/dev/routine/api/schemas/src/recurrence.ml, /home/mefyl/dev/routine/api/_opam/lib/mandate/recurrence.ml, /home/mefyl/dev/routine/api/schemas/src/recurrence.ml```
<d_bot>
<mefyl> there is one in my sources, and one that comes from a library. The one from the sources is even listed twice. What's surprising is that it's the latest merlin with the latest emacs configuration and the latest dune, so I'd think everybody has this issue, but there is hardly any relevant mention when searching for this error, so I must be doing something wrong
<d_bot>
<mefyl> This happens when using `merlin-locate` on a `include Mandate.Recurrence` line, so with the help of dune it's pretty clear the right file is `/home/mefyl/dev/routine/api/_opam/lib/mandate/recurrence.ml`
epony has joined #ocaml
epony has quit [Ping timeout: 240 seconds]
waleee has quit [Ping timeout: 256 seconds]
bartholin has quit [Ping timeout: 260 seconds]
mro has quit [Quit: Leaving...]
bartholin has joined #ocaml
mbuf has quit [Quit: Leaving]
epony has joined #ocaml
spip has joined #ocaml
bobo has quit [Ping timeout: 260 seconds]
gravicappa has joined #ocaml
gwizon has joined #ocaml
rgrinberg has joined #ocaml
gwizon has quit [Quit: Lost terminal]
<d_bot>
<Et7f3> (never used merlin but what I understande) merlin alone doesn't read dune file but ocaml platform does get knowledge of dune file with dune-rpc. so try to switch
Anarchos has quit [Quit: Vision[]: i've been blurred!]
rgrinberg has quit [Ping timeout: 240 seconds]
zebrag has joined #ocaml
kakadu has quit [Remote host closed the connection]
<companion_cube>
Atomic is a lot of fun, I must say
<companion_cube>
not that I really can test what I write, but it's cool
<d_bot>
<darrenldl> that's the neat part, you dont
<d_bot>
<darrenldl> just close all concurrency issues with "cant reproduce" : D
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ralu has joined #ocaml
gentauro has quit [Ping timeout: 256 seconds]
mro has joined #ocaml
epony has joined #ocaml
epony has quit [Ping timeout: 240 seconds]
ralu has quit [Ping timeout: 252 seconds]
gentauro has joined #ocaml
mro has quit [Quit: Leaving...]
gravicappa has quit [Ping timeout: 250 seconds]
rgrinberg has joined #ocaml
<d_bot>
<josé> 👋 i'm experiencing couple of issues with tuareg, where would be the best place to seek for help?
<d_bot>
<Butanium (@me on answer)> I'd say discuss.ocaml.org or opening an issue on github
<d_bot>
<Butanium (@me on answer)> But idk tuareg at all
vicfred_ has joined #ocaml
vicfred has quit [Ping timeout: 260 seconds]
<d_bot>
<josé> okay, thanks!
ralu has joined #ocaml
epony has joined #ocaml
bobo has joined #ocaml
spip has quit [Ping timeout: 256 seconds]
Anarchos has joined #ocaml
zebrag has quit [Ping timeout: 256 seconds]
Serpent7776 has quit [Quit: leaving]
vicfred_ has quit [Quit: Leaving]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 276 seconds]
azimut_ has quit [Remote host closed the connection]
azimut has joined #ocaml
<energizer>
when i read about pattern matching i see it's a replacement for ifs and predicate functions. i'm wondering how general it is. is there something for using a bool-returning function as a predicate? or is that a bad idea?
<energizer>
for example, `let is_digit = function '0' .. '9' -> true | _ -> false` Can is_digit be used as a pattern?
<companion_cube>
no, it cannot
<companion_cube>
only in a `when is_digit c` guard
<energizer>
ok
<dh`>
energizer: it's specifically about enumerated/sum types
<energizer>
where it=pattern matching ?
<dh`>
yes
<dh`>
so you have type emulsion = OIL of 'a | WATER of 'b
<dh`>
you have a value x of type emulsion
<dh`>
you write match x with | OIL xa -> stuff about xa | WATER xb -> stuff about xb
<dh`>
that's all it's for, but that turns out to be a lot
<dh`>
(well, that and you can also match on string constants, which is not quite the same thing but ultimately pretty similar)
<energizer>
you can't match on number literals?
<dh`>
oh, yes you can
<dh`>
just rarely comes up
<d_bot>
<NULL> Basically, patterns aren't inlined at all
<dh`>
you can also match on bools
<d_bot>
<NULL> So they have to be syntactically what you want