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
malc_ has quit [Ping timeout: 260 seconds]
SquidDev has quit [Quit: Ping timeout (120 seconds)]
SquidDev has joined #ocaml
SquidDev has quit [Quit: Ping timeout (120 seconds)]
SquidDev has joined #ocaml
ollehar has quit [Ping timeout: 246 seconds]
ollehar has joined #ocaml
eric23 has joined #ocaml
tsmc_ has joined #ocaml
vicfred has quit [Quit: Leaving]
jbrown has quit [Ping timeout: 256 seconds]
eric23 has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
zv has quit [Ping timeout: 258 seconds]
malc_ has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
malc_ has quit [Remote host closed the connection]
gaussian has joined #ocaml
h14u has quit [Quit: Leaving]
vicfred has joined #ocaml
malc_ has joined #ocaml
malc_ has quit [Ping timeout: 265 seconds]
aaaaaa has joined #ocaml
snowpanda has joined #ocaml
narimiran has joined #ocaml
malc_ has joined #ocaml
hlisp has joined #ocaml
snowpanda has quit [Quit: Leaving...]
hlisp has quit [Client Quit]
_whitelogger has joined #ocaml
osa1 has joined #ocaml
vicfred has quit [Remote host closed the connection]
vicfred has joined #ocaml
tane_ has joined #ocaml
Haudegen has joined #ocaml
tsmc_ has quit [Quit: Connection closed for inactivity]
mbuf has joined #ocaml
vicfred has quit [Remote host closed the connection]
vicfred has joined #ocaml
defolos has joined #ocaml
<defolos> https://github.com/ocaml/opam#community mentions to ask in the #freenode_#opam:matrix.org channel on freenode about opam, but that channel does not exist for me. Is that info outdated or did I mess up using irc?
dckc has quit [Ping timeout: 256 seconds]
<Leonidas> if you join the channel, it starts to exist! :p
madroach_ has quit [Ping timeout: 256 seconds]
<defolos> it just started to exist, but I'm hardly qualified to answer anything about opam
madroach has joined #ocaml
dckc has joined #ocaml
<Drup> the #opam channel used to be separated, but It's not really necessary anymore, just ask here
<defolos> this is extremely noobish, but how would I get all the dependent packages out of an opam file in ocaml?
<defolos> I'm mostly an ocaml beginner and couldn't really find anything in the opam API docs that looked like parse_opam_file
<Drup> defolos: `opam show -f depends file.opam`
<defolos> Drup: thanks, but I'll need to do further fiddling with the dependencies, so just printing them to stdout is not enough
<Drup> ah, you want to query them programatically
<d_bot> <craigfe> (You would need `--just-file ./file.opam`, otherwise it'd try to find the package `file` with version `opam`)
<Drup> the API is ... a bit difficult to navigate, I don't remember how you do that
<d_bot> <craigfe> `opam-file-format` will do that for you (and is what `opam` itself uses). https://opam.ocaml.org/packages/opam-file-format/
<defolos> <d_bot "<craigfe> `opam-file-format` wil"> ah, thanks, I think I've stumbled over that already
malc_ has left #ocaml ["ERC (IRC client for Emacs 28.0.50)"]
olle_ has joined #ocaml
olle has joined #ocaml
ggole has joined #ocaml
brown121407 has joined #ocaml
jbrown has joined #ocaml
sagax has quit [Ping timeout: 272 seconds]
sagax has joined #ocaml
infinity0 has quit [Ping timeout: 240 seconds]
infinity0 has joined #ocaml
jco has joined #ocaml
<jco> hi!
<jco> ok, so something interesting is going on here
<jco> if the commented part is uncommented, the post_comment function is not evaluated
<jco> i think i messed up with the different binds on the monads
andreas303 has quit [Remote host closed the connection]
nicoo has quit [Remote host closed the connection]
cantstanya has quit [Write error: Broken pipe]
cantstanya has joined #ocaml
nicoo has joined #ocaml
andreas303 has joined #ocaml
<Fardale> jco: there is a "*)" that does not match any "(*"
<jco> right, i fix this (i did thi mistake while pasting)
<Fardale> And there is a missing parenthesis if you remove the comment
<jco> oh yeah
<Fardale> I think you should just past the uncommented version
<jco> so basically it executes up to the git push --delete command (and it looks like it does it twice)
<Fardale> git push is commented in your code
<jco> it works if i get rid of the match on Str.split and just run post_comment
<jco> Fardale: right, but even commenting it yields the same problem: post_comment is not executed
<jco> (in this example i've changed the format of the body so that only the id is in the first line)
<Fardale> Are you sure that your pattern matching is correct?
<jco> absolutely sure (i ran it with the "found" and "extracted" comments)
<jco> the variables are properly extracted
<jco> this yields me thinking that i've made an error in the chain of operations (with the bind operator on the results)
<Fardale> It is hard to tell, I can not run this example
<Fardale> Does this program terminate directly after the match?
<jco> right, i should probably make a minimal example
<jco> well no, it executed the git push command
<jco> but it may be the case that it stopped just after
<jco> that would explain that the comment wasn't posted
<Fardale> What does the main part of the program do after the call to Lwt.async ?
aaaaaa has quit [Quit: leaving]
<jco> it's waiting for other requests, this bit of code is part of the callback function of the server
<jco> but when i remove the async (with which i can retrieve the errors and print them), the server returns an internal error to the client
rockethead has joined #ocaml
<jco> but what surprises me is that it happens with the call to git push commented
<jco> so the only difference here is the extra match on Str.split and Lwt.async
<def> Str has global state, if Lwt yields, then the result of Str.matched_group can be incorrect
<def> e.g. don't use Str in a concurrent blocks.
<jco> oh
<jco> what does global state mean?
<def> things that can be modified by another call to Str.
<jco> i see
<def> if you have two concurrent calls to Str (for instance the function in your example is called twice), their state will interfere
<def> the solution is to call Str.matched_group before the bind.
<def> | [id; _; _; _] -> let message = Str.matched_group 2 body in ...
<jco> ok, i did not thought about concurrency issues here
<jco> many thanks
<jco> and thanks Fardale too for helping with this stuff :)
Haudegen has quit [Quit: Bin weg.]
<flux> actually Str is internally unsafe as well
<flux> while its interface screams concurrency-unsafety, it uses the same interface internally.
<flux> I think I found this out by using `Str.split` and _sometimes_ getting weird answers
<flux> but that only affects cases where you use OCaml threading
<flux> ..possibly in the future the impact might be larger, given we're going to get actual multi-core concurrency and that possibly Lwt or Async might adopt support for it (fingers crossed)
<jco> yep, i can confirm that this was my issue
muskan has joined #ocaml
dckc has quit [Ping timeout: 260 seconds]
dckc has joined #ocaml
Haudegen has joined #ocaml
brown121407 has quit [Remote host closed the connection]
Ankhers has quit [Quit: ZNC 1.8.0 - https://znc.in]
brown121407 has joined #ocaml
Ankhers has joined #ocaml
brown121407 has quit [Remote host closed the connection]
rockethead has quit [Quit: rockethead]
brown121407 has joined #ocaml
waleee-cl has joined #ocaml
osa1 has quit [Ping timeout: 240 seconds]
olle_ has quit [Remote host closed the connection]
olle has quit [Read error: Connection reset by peer]
brown121407 has quit [Remote host closed the connection]
ollehar has quit [*.net *.split]
towel has quit [*.net *.split]
ski has quit [*.net *.split]
ziman has quit [*.net *.split]
penguwin has quit [*.net *.split]
wildsebastian has quit [*.net *.split]
sadiq_ has quit [*.net *.split]
tobiasBora2 has quit [*.net *.split]
robi has quit [*.net *.split]
p4bl0 has quit [*.net *.split]
engil has quit [*.net *.split]
johnel has quit [*.net *.split]
p4bl0 has joined #ocaml
sadiq_ has joined #ocaml
ollehar has joined #ocaml
ziman has joined #ocaml
tobiasBora2 has joined #ocaml
ski has joined #ocaml
engil has joined #ocaml
robi has joined #ocaml
towel has joined #ocaml
penguwin has joined #ocaml
wildsebastian has joined #ocaml
johnel has joined #ocaml
<companion_cube> it's kind of stupid, but could we actually modify `Str` to provide a global-free interface, implement the old stuff in terms of it, and deprecate the old stuff?
<def> ... Yep.
<companion_cube> (but would this linger on for years? :p)
<companion_cube> wooooah the implementation has a small VM in C!?
<def> yep, yep. Yep.
<companion_cube> I mean, why not
<companion_cube> I never bothered to measure the perf compared to Re
muskan has quit [Ping timeout: 245 seconds]
<companion_cube> now I wonder :D
muskan has joined #ocaml
<Drup> please measure :)
<companion_cube> any idea of benchmarks? :p
<def> companion_cube: I think it is a simple backtracking VM.
<companion_cube> "simple" yeah yeah, it's just quite cool
<def> very efficient for simple things like string search, but it can degenerate with disjunctions (I saw exponential runtimes)
<companion_cube> ah, for `(a|b)` it'll try a first and backtrack? right
<companion_cube> `(a*b|a*c)` must be very bad for `a{100000}c` indeed :D
<companion_cube> (I don't have the imagination for more interesting examples right now)
<def> Though your example might be compiled efficiently because of the common prefix :)
<companion_cube> ah, it sees that?
osa1 has joined #ocaml
<def> I don't remember exactly :/
<companion_cube> ok, so, looking at the code, it's mostly a matter of making `re_match` use a struct instead of local variables, I imagine?
<def> I just remember that it should not take much work ;)
<def> So probably, yes.
<companion_cube> yeah there's a bunch of static variables
jco has quit [Ping timeout: 246 seconds]
<companion_cube> these could be put into a struct I guess
jco has joined #ocaml
osa1 has quit [Ping timeout: 272 seconds]
<jco> hum so i've got a function which returns a (bool, string) result Lwt.t
<jco> i'd like to pass the result to a function if it evaluates to bool
<jco> bool Lwt.t
<companion_cube> ugh, I don't have the time :(((
raver has quit [Quit: Gateway shutdown]
raver has joined #ocaml
<jco> ok, i managed to do it
oturtle_ has quit [Ping timeout: 256 seconds]
porchetta has quit [Ping timeout: 260 seconds]
oturtle_ has joined #ocaml
jco has quit [Quit: WeeChat 2.7]
porchetta has joined #ocaml
Exagone314 is now known as Exagone313
gaussian37 has joined #ocaml
gaussian37 has quit [Client Quit]
gaussian31 has joined #ocaml
gaussian31 has quit [Client Quit]
porchetta has quit [Ping timeout: 272 seconds]
porchetta has joined #ocaml
zv has joined #ocaml
superherointj has joined #ocaml
<superherointj> I have a function that it's implementation requires an instance of a Map (data structure / key-value) for each execution of it. Map in OCaml is a module. Is it possible to embed a map to function implementation somehow? Maybe I am looking something else. I need a mutable map like key-value datastructure to use inside a function. But it will be executed several times, and each execution cannot influence other executions.
<superherointj> *looking for
<octachron_> superherointj, you can use a local module "let M = Map.Make(...) in", or directly use a hashtable if you seek a mutable map
<superherointj> Thanks!
osa1 has joined #ocaml
<superherointj> let StagesMap = Map.Make(Int) in print_endline "yay";; (* Should this work? *)
<superherointj> Ok. found it! let module StagesMap = Map.Make(Int) in print_endline "yay";; (* works *)
mbuf has quit [Quit: Leaving]
porchetta has quit [Ping timeout: 246 seconds]
porchetta has joined #ocaml
osa1 has quit [Ping timeout: 256 seconds]
SrPx has quit [Ping timeout: 244 seconds]
muskan has quit [Remote host closed the connection]
SrPx has joined #ocaml
_tjr_ has quit [Quit: quitting]
t-j-r has joined #ocaml
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
oriba has joined #ocaml
ggole has quit [Quit: Leaving]
vesper11 has quit [Ping timeout: 260 seconds]
vesper11 has joined #ocaml
porchetta has quit [Ping timeout: 240 seconds]
porchetta has joined #ocaml
Jesin has quit [Quit: Leaving]
narimiran has quit [Ping timeout: 246 seconds]
jbrown has quit [Ping timeout: 260 seconds]
tane_ has quit [Quit: Leaving]
porchetta has quit [Ping timeout: 272 seconds]
porchetta has joined #ocaml
oriba has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
porchetta has quit [Ping timeout: 240 seconds]
porchetta has joined #ocaml
superherointj has quit [Quit: Leaving]
Haudegen has quit [Quit: Bin weg.]
ollehar has quit [*.net *.split]
towel has quit [*.net *.split]
tobiasBora2 has quit [*.net *.split]
ski has quit [*.net *.split]
ziman has quit [*.net *.split]
penguwin has quit [*.net *.split]
wildsebastian has quit [*.net *.split]
sadiq_ has quit [*.net *.split]
robi has quit [*.net *.split]
p4bl0 has quit [*.net *.split]
engil has quit [*.net *.split]
johnel has quit [*.net *.split]
oturtle has joined #ocaml
oturtle_ has quit [Ping timeout: 265 seconds]
porchetta has quit [Ping timeout: 260 seconds]
porchetta has joined #ocaml
ollehar has joined #ocaml
ski has joined #ocaml
towel has joined #ocaml
ziman has joined #ocaml
p4bl0 has joined #ocaml
johnel has joined #ocaml
sadiq_ has joined #ocaml
engil has joined #ocaml
robi has joined #ocaml
wildsebastian has joined #ocaml
tobiasBora2 has joined #ocaml
penguwin has joined #ocaml