companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.11 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.11/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
mxns has joined #ocaml
mxns has quit [Ping timeout: 240 seconds]
nullcone has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 272 seconds]
mxns has joined #ocaml
borne has quit [Ping timeout: 260 seconds]
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 240 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 240 seconds]
amiloradovsky has quit [Remote host closed the connection]
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
peterbb has joined #ocaml
peterbb has quit [Remote host closed the connection]
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
Jeanne-Kamikaze has quit [Quit: Leaving]
adrianbrink has quit [Ping timeout: 260 seconds]
zv has quit [Ping timeout: 256 seconds]
adrianbrink has joined #ocaml
bjorkint0sh has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
bjorkintosh has quit [Ping timeout: 260 seconds]
BitPuffin has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
BitPuffin has joined #ocaml
mxns has quit [Quit: ZNC 1.8.2 - https://znc.in]
mxns has joined #ocaml
mxns has quit [Ping timeout: 246 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 240 seconds]
madroach_ has joined #ocaml
mxns has joined #ocaml
madroach has quit [Ping timeout: 256 seconds]
mxns has quit [Ping timeout: 260 seconds]
Haudegen has quit [Ping timeout: 260 seconds]
nullcone has quit [Quit: Connection closed for inactivity]
mxns has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
mfp has quit [Ping timeout: 256 seconds]
madroach has joined #ocaml
madroach_ has quit [Ping timeout: 256 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
mxns has joined #ocaml
objmagic has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
narimiran has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
mxns has joined #ocaml
mxns has quit [Client Quit]
mxns has joined #ocaml
_whitelogger has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
objmagic has joined #ocaml
objmagic has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mxns has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
mxns has quit [Ping timeout: 240 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 272 seconds]
mxns has joined #ocaml
mxns has quit [Client Quit]
mxns has joined #ocaml
mxns has quit [Quit: ZNC 1.8.2 - https://znc.in]
mxns has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
FreeBirdLjj has joined #ocaml
wonko7 has joined #ocaml
kanishkaa[m] has quit [Quit: Idle for 30+ days]
Tuplanolla has joined #ocaml
dhil has joined #ocaml
bartholin has joined #ocaml
webshinra has quit [Remote host closed the connection]
webshinra has joined #ocaml
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
narimiran has quit [Ping timeout: 240 seconds]
bartholin has quit [Ping timeout: 268 seconds]
sm2n has joined #ocaml
bartholin has joined #ocaml
gareppa has joined #ocaml
borne has joined #ocaml
gareppa has quit [Remote host closed the connection]
Haudegen has joined #ocaml
mxns has joined #ocaml
narimiran has joined #ocaml
mfp has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
bartholin has quit [Ping timeout: 256 seconds]
waleee-cl has joined #ocaml
bartholin has joined #ocaml
bartholin has quit [Ping timeout: 256 seconds]
borne has quit [Ping timeout: 260 seconds]
FreeBirdLjj has quit []
bartholin has joined #ocaml
wonko7 has quit [Ping timeout: 246 seconds]
andreas303 has quit [Remote host closed the connection]
andreas303 has joined #ocaml
FreeBirdLjj has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
Anarchos has joined #ocaml
mxns has quit [Ping timeout: 256 seconds]
DanC has quit [Quit: ZNC 1.6.6+deb1ubuntu0.2 - http://znc.in]
DanC has joined #ocaml
FreeBirdLjj has quit []
FreeBirdLjj has joined #ocaml
wonko7 has joined #ocaml
borne has joined #ocaml
objmagic has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
mxns has joined #ocaml
<d_bot> <inkbottle> I want to turn `fd` and `sa` into `string` (below). I understand there are several options, all `ppx` based though?
<d_bot> <inkbottle> I should probably use something like `ppx_sth_conv` (`ppx_sexp_conv` or `ppx_yojson_conv`), and/or `sexplib` (`sexplib0`...)?
<d_bot> <inkbottle> I'd appreciate pointers about that. How to do it: the simple way.
<d_bot> <inkbottle> ```ocaml
<d_bot> <inkbottle> let* fd, sa = Lwt_unix.accept sock in```
<d_bot> <joris> https://github.com/ahrefs/devkit/blob/95fcc51507adcfa715bb138189b1aea2e67174c3/cache.mli#L22 some years ago I did that. It does not directly remove stale elements but I use iter plus remove to do that on some places. Also it is not directly lru but two level lru to improve hit rate @Lupus
bartholin has quit [Ping timeout: 264 seconds]
<d_bot> <joris> (had lot of services serving thousands of requests per second with very large number of entries so lru was not working well unless the cache size was very big hence the generational setup, which performs much better when there is like 1% of request that frequently accessed and 99% that are cold
<Anarchos> is establish_server a good server to use ?
<companion_cube> redis has a least frequently used system, too
<d_bot> <joris> Yeah I don't claim to have invented anything. To be honest there is probably a better algo that this, I just stacked two lrus it is not really lfu. But it performs very well in practice.
<mfp> joris: sounds like the 2Q algorithm
bartholin has joined #ocaml
<mfp> http://www.vldb.org/conf/1994/P439.PDF for comparison to LRU and LRU/k
<mrvn> joris: So anything that gets a hit in the first LRU gets moved to the second LRU?
<mrvn> I once used a heap with <time since last access> * <num hits> as key. But then every update is O(log n).
<mfp> I once bumped into this trick in some OCaml code (by Jean-Christophe Filliâtre maybe?): keep a counter per bucket; on hit, increment, on miss, decrement, replace if counter < 0 and reset to 1. A value will remain cached if it represents over 50% of the accesses to that bucket.
objmagic has quit [Quit: gone...]
mxns has quit [Ping timeout: 260 seconds]
neiluj has joined #ocaml
mxns has joined #ocaml
mxns has quit [Quit: ZNC 1.8.2 - https://znc.in]
mxns_ has joined #ocaml
mxns_ has quit [Ping timeout: 256 seconds]
neiluj has quit [Quit: leaving]
mxns has joined #ocaml
<Anarchos> why this does not work :
<Anarchos> let f ?(a=1) ~b = 1
<Anarchos> let g() = f ~b
<Anarchos> i would expect f to be applied to the default value for a and b, instead it evaluates to a partial function
<Armael> I think you have to add a extra () argument to f (and provide it in g) to get that kind of behavior: let f ?(a = 1) ~b () = 1;; let g () = f ~b ();;
mxns has quit [Ping timeout: 260 seconds]
<Anarchos> Armael i guessed that, but isn't it contradictory to the manual ? if i do «f ~b» , 'a' should be instantiated to its default value
borne has quit [Ping timeout: 260 seconds]
<Armael> well optional/labelled arguments can be reordered
<Armael> I think the fact that you get a partial application comes from that
mxns has joined #ocaml
aaaaaa has joined #ocaml
<d_bot> <Lupus> @hannes @joris thanks for pointers regarding LRU, will look into both!
mxns has quit [Ping timeout: 268 seconds]
aaaaaa has left #ocaml [#ocaml]
mxns has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
<d_bot> <joris> @mfp right indeed. I guess I should read the papers and make it better someday
tryte has quit [Ping timeout: 240 seconds]
<d_bot> <joris> Right. I first tried to use a heap but the gc pressure was too hight for the usecase but I guess technically a heap is better
<d_bot> <joris> @mfp nice trick!
<d_bot> <joris> Oh i guess I should not use threads as it is messy on irc
mxns has quit [Ping timeout: 260 seconds]
tryte has joined #ocaml
bartholin has quit [Ping timeout: 268 seconds]
<mrvn> Anarchos: If "f ~b" would apply "a" as well then you couldn't write "f ~b=1 ~a=5"
<mrvn> It's a quirk in ocaml that optional arguments always need a unlabeled one so the compiler sees that th application is final and inserts all the missing optional ones.
mxns has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
hnOsmium0001 has joined #ocaml
mxns has joined #ocaml
bartholin has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 272 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]
mxns has joined #ocaml
drewolson4 has joined #ocaml
drewolson has quit [Ping timeout: 240 seconds]
drewolson4 is now known as drewolson
mxns has quit [Ping timeout: 264 seconds]
mxns has joined #ocaml
<d_bot> <inkbottle> I've posted that in #beginners. I still have no clues on how to do it, or something along the same line.
<d_bot> <inkbottle> ```ocaml
<d_bot> <inkbottle> type hello = Lwt_unix.file_descr [@@deriving sexp];;```
jnavila has joined #ocaml
mxns has quit [Ping timeout: 268 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
Jeanne-Kamikaze has joined #ocaml
<d_bot> <mnxn> `Lwt_unix.file_desc` is abstract: https://ocsigen.org/lwt/5.3.0/api/Lwt_unix#2_Operationonfiledescriptors
<d_bot> <mnxn> there is no way to print it like that without knowing how it's implementation
<d_bot> <mnxn> You should write your own function that uses `Lwt_unix.state`, `Lwt_unix.unix_file_descr` and the functions in the `Unix` modules to get all the data you need to print it
mxns has joined #ocaml
<d_bot> <beheddard> You can make it treat the type as opaque or ignore it.
<d_bot> <beheddard> `(M.t[@sexp.opaque])`
mxns has quit [Ping timeout: 246 seconds]
<d_bot> <inkbottle> Tx, first step in that direction did work.
mxns has joined #ocaml
dhil has quit [Ping timeout: 240 seconds]
mxns has quit [Ping timeout: 268 seconds]
steenuil__ has joined #ocaml
amiloradovsky has joined #ocaml
mxns has joined #ocaml
steenuil_ has quit [Ping timeout: 246 seconds]
mxns has quit [Ping timeout: 268 seconds]
mxns has joined #ocaml
<d_bot> <inkbottle> And I read the other way to do it, or not to do it, above. So I believe it's settled.
mxns has quit [Ping timeout: 272 seconds]
<d_bot> <beheddard> For the deriving libraries like deriving_yojson etc, writing your own function that matches the name that it is looking for is always an option
bartholin has quit [Ping timeout: 265 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
neiluj has joined #ocaml
neiluj has joined #ocaml
<neiluj> Hello!
<d_bot> <inkbottle> If it is in the https://github.com/ocsigen/deriving family, as I understand it is, it is using camlp4, and I understand it is superseded by ppx.
<neiluj> trying to execute some processes with Lwt_process.exec, combined with Lwt_main.run to execute them
<neiluj> but for some reason it crashes, and i can't see the exception raised (even by setting Lwt.async_exception_hook)
<neiluj> is it correct to use Lwt_main.run in this case?
<neiluj> More generally it seems that Stdio.printf doesn't print anything
bartholin has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 256 seconds]
narimiran has quit [Quit: leaving]
bartholin has quit [Ping timeout: 272 seconds]
mxns has joined #ocaml
bartholin has joined #ocaml
Jeanne-Kamikaze has quit [Ping timeout: 272 seconds]
tane has joined #ocaml
<neiluj> nevermind, i had some misconceptions with lwt
neiluj has quit [Quit: leaving]
Anarchos has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
bartholin has quit [Quit: Leaving]
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
Anarchos has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
Anarchos has joined #ocaml
<Anarchos> how to #trace inner defined functions ?
<companion_cube> extract them so they're not inner
<Anarchos> companion_cube i wonder why there is not a #trace f.g notation as for modules
<Armael> I'm surprised that #trace still exists in 2020
<Anarchos> Armael it is useful for recursive functions to see which step receives wrong arguments
<zozozo> I always go for some printing/logging at the begining of the function for that instead of #trace, :p
<Anarchos> zozozo which implies writing code to be deleted , and a compilation
<zozozo> yeah, though to be more accurate, I rarely need to do that, and instead, it's more algorithmic problems I need to debug, and for that, adding good logging that stays in the code is a good idea anyway
<Anarchos> zozozo sure. i use it to debug simple problems, not algorithmic ones
<zozozo> well, it works on toy examples, but eventually, you need to debug codes that is quite far/deep inside of a code base, and then...
wonko7 has quit [Ping timeout: 260 seconds]
jnavila has quit [Ping timeout: 260 seconds]
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
urek has joined #ocaml
noonien has quit [Quit: Ping timeout (120 seconds)]
noonien has joined #ocaml
artymort has quit [Ping timeout: 240 seconds]
artymort has joined #ocaml
minimario has joined #ocaml
guanohhh has quit [Quit: Connection closed for inactivity]
<minimario> hi! how can I load a file with all its dependencies into utop?
<minimario> i tried #mod_use "blah.ml" but it didn't work
<minimario> not sure what's the proper way to do this