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
Nahra has quit [Quit: leaving]
mfp has quit [Ping timeout: 276 seconds]
kleisli has quit [Remote host closed the connection]
kleisli has joined #ocaml
keep-learning[m] has joined #ocaml
jao- has joined #ocaml
jao has quit [Ping timeout: 265 seconds]
jao- has quit [Ping timeout: 265 seconds]
jao has joined #ocaml
jao has quit [Ping timeout: 265 seconds]
j9m has quit [Quit: ZNC 1.7.1 - https://znc.in]
yomimono has quit [Ping timeout: 276 seconds]
yomimono has joined #ocaml
tormen has joined #ocaml
tormen_ has quit [Ping timeout: 252 seconds]
ycjung has quit [Quit: WeeChat 2.6]
kleisli has quit [*.net *.split]
toppler has quit [*.net *.split]
tizoc has quit [*.net *.split]
theglass has quit [*.net *.split]
nullifidian has quit [*.net *.split]
greenbagels has quit [*.net *.split]
slice has quit [*.net *.split]
Nikkel has quit [*.net *.split]
mrd has quit [*.net *.split]
kark has quit [*.net *.split]
Niamkik has quit [*.net *.split]
catern has quit [*.net *.split]
cthuluh has quit [*.net *.split]
iAmerikan has quit [*.net *.split]
eagleflo has quit [*.net *.split]
philtor has quit [*.net *.split]
crowley95 has quit [*.net *.split]
emias has quit [*.net *.split]
delysin has quit [*.net *.split]
maker has quit [*.net *.split]
_habnabit has quit [*.net *.split]
lobo has quit [*.net *.split]
Amaan has quit [*.net *.split]
engil has quit [*.net *.split]
swistak35 has quit [*.net *.split]
chindy has quit [*.net *.split]
vicfred has joined #ocaml
gravicappa has joined #ocaml
bartholin has quit [Read error: Connection reset by peer]
bartholin_ has joined #ocaml
bartholin_ has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
narimiran has joined #ocaml
amiloradovsky has quit [Ping timeout: 250 seconds]
keep_learning has joined #ocaml
keep_learning has quit [Client Quit]
kjak has quit [Ping timeout: 268 seconds]
kjak has joined #ocaml
kjak has quit [Ping timeout: 265 seconds]
ggole has joined #ocaml
Serpent7776 has joined #ocaml
Haudegen has joined #ocaml
dborisog has joined #ocaml
mbuf has joined #ocaml
mbuf has quit [Read error: Connection reset by peer]
count3rmeasure has joined #ocaml
mbuf has joined #ocaml
keep_learning has joined #ocaml
kjak has joined #ocaml
kjak has quit [Ping timeout: 250 seconds]
ygrek has joined #ocaml
jaar has joined #ocaml
jao has joined #ocaml
engil has joined #ocaml
engil has joined #ocaml
kakadu has joined #ocaml
theglass has joined #ocaml
theglass has joined #ocaml
theglass has quit [Changing host]
jao has quit [Ping timeout: 265 seconds]
tizoc has joined #ocaml
mrd has joined #ocaml
cthuluh has joined #ocaml
Nikkel has joined #ocaml
toppler has joined #ocaml
swistak35 has joined #ocaml
crowley95 has joined #ocaml
emias has joined #ocaml
philtor has joined #ocaml
eagleflo has joined #ocaml
_habnabit has joined #ocaml
delysin has joined #ocaml
Amaan has joined #ocaml
lobo has joined #ocaml
mrd is now known as Guest87253
greenbagels has joined #ocaml
crowley95 is now known as Guest68587
Niamkik has joined #ocaml
maker has joined #ocaml
chindy has joined #ocaml
lobo is now known as Guest37567
Niamkik is now known as Guest4
kleisli has joined #ocaml
slice has joined #ocaml
iAmerikan has joined #ocaml
kark has joined #ocaml
kakadu has quit [Ping timeout: 252 seconds]
kakadu has joined #ocaml
stux|RC has quit [Read error: Connection reset by peer]
catern has joined #ocaml
stux|RC has joined #ocaml
rotucer has joined #ocaml
kakadu has quit [Ping timeout: 245 seconds]
kakadu_ has joined #ocaml
rotucer has quit [Quit: Quit]
iAmerikan has quit [Quit: WeeChat 2.6]
andrewalker has quit [Quit: ZNC 1.6.2 - http://znc.in]
<Nikkel> Is there any way to compare abstract data types in Ocaml?
<Nikkel> sorry algebraic
<vsiles> Nikkel: I think you can't avoid defining the comparison function yourself (or generate one with ppx ord or something like that)
<zozozo> Nikkel: the polymorphic comparison works on algebraic datatypes generally, but if you need a precise behavior (such as ignoring some field), you'll need to define the comparison function yourself
<Nikkel> zozozo: dang
<Nikkel> I basically just use the ADT as an enum
<Nikkel> no field contents
<Nikkel> zozozo: I just used compare :) it works, thanks
<zozozo> if it's just an enum, the poly compare will wokr fine, ^^
<zozozo> (it will just be a bit slower than a hand-written one, but it shouldn't matter)
free_beard has joined #ocaml
gareppa has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
ofzyh has quit [Remote host closed the connection]
<vsiles> zozozo: good to know
kakadu_ has quit [Ping timeout: 245 seconds]
kakadu has joined #ocaml
jaar has quit [Ping timeout: 250 seconds]
jaar has joined #ocaml
Haudegen has joined #ocaml
jaar_ has joined #ocaml
jaar has quit [Ping timeout: 248 seconds]
Guest4 has quit [Quit: WeeChat 2.6]
Niamkik has joined #ocaml
kakadu has quit [Ping timeout: 245 seconds]
kakadu_ has joined #ocaml
<zozozo> Nikkel: so I did some benchs, and it looks like a handwritten comparison function (either through enumerating the quadratic number of cases, or using a discriminant function), is about twice as fast as the polymorphic compare (see https://gist.github.com/Gbury/0320133b9ce3422341e54b4b2e3fdc15#file-comp-res-L1 )
<zozozo> the poly compare is alreayd quite fast and most likely not to be a bottleneck though
<ggole> Hmm, why the match in discr? The result is the same if you just unconditionally do _discr a - _discr b
<zozozo> ggole:right, I just ahve the habig of algebraic types with arguments (in which case you want to call some comparison functions on the arguments of constructors)
<zozozo> (and it seems I can't type without typos anymore, :p )
<ggole> Well, the point is that I don't think any of those comparisons are as efficient as they could be
<zozozo> ggole:let me try the discr without match
<ggole> You might want to try something like let stdlib (a : t) b = Pervasives.compare a b, since the compiler recognises comparisons of an integral type (if the type is obvious at the site of comparison)
<zozozo> from what I recall, the compiler recognizes comparisons between builtin types, but not "integral types" (but I could misremember or just be wrong, ^^)
<ggole> It considers a datatype with all nullary constructors to be integral.
<ggole> eg, uses caml_int_compare
<zozozo> ggole: indeed you're right, with the type annotations, all functions perform basically the same
luna_is_here has joined #ocaml
gareppa has quit [Quit: Leaving]
count3rmeasure has quit [Quit: Leaving]
andreas303 has quit [Ping timeout: 260 seconds]
andreas303 has joined #ocaml
sagax has quit [Ping timeout: 252 seconds]
FreeBirdLjj has joined #ocaml
greenbagels has quit [Changing host]
greenbagels has joined #ocaml
spew has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 248 seconds]
sagax has joined #ocaml
<Nikkel> Is it possible to print output within a QCheck test?
jao has joined #ocaml
oni-on-ion has joined #ocaml
<spew> you can just print stuff yes
<spew> sometimes I do that if I'm really confused
<spew> you get a lot of noise
<spew> best person to ask is companion_cube I would think
FreeBirdLjj has joined #ocaml
<companion_cube> Nikkel: depends on the test runner, I think
<companion_cube> alcotest tends to store output somewhere
vicfred has quit [Quit: Leaving]
FreeBirdLjj has quit [Ping timeout: 250 seconds]
mbuf has quit [Remote host closed the connection]
<spew> yeah I was just using QCheck_runner.run_tests
betux has joined #ocaml
smazga has joined #ocaml
<Nikkel> companion_cube: Okay. Thanks :)
<Nikkel> Is there any way I can trigger af Js_of_ocaml call to happen after every React model step?
brettgilio has quit [Ping timeout: 245 seconds]
Guest37567 is now known as lobo
lobo is now known as Guest52304
Guest52304 has quit [Changing host]
Guest52304 has joined #ocaml
Guest52304 is now known as lobo
ziyourenxiang has quit [Ping timeout: 268 seconds]
free_beard has quit [Remote host closed the connection]
Haudegen has quit [Quit: Bin weg.]
Serpent7776 has quit [Quit: Leaving]
yomimono has quit [Ping timeout: 276 seconds]
betux has quit [Quit: betux]
betux1 has joined #ocaml
betux1 is now known as betux
dborisog has quit [Ping timeout: 265 seconds]
mononote- has joined #ocaml
mononote has left #ocaml ["Disconnected: Received SIGTERM"]
mononote- is now known as mononote
smazga has quit [Quit: leaving]
Haudegen has joined #ocaml
oni-on-ion has quit [Remote host closed the connection]
Serpent7776 has joined #ocaml
bartholin has joined #ocaml
gravicappa has quit [Ping timeout: 265 seconds]
jaar_ has quit [Ping timeout: 248 seconds]
jnavila has joined #ocaml
ggole has quit [Quit: Leaving]
TheLemonMan has joined #ocaml
gareppa has joined #ocaml
rosterok has joined #ocaml
narimiran has quit [Ping timeout: 246 seconds]
brettgilio has joined #ocaml
kark has quit [Remote host closed the connection]
kleisli has quit [Ping timeout: 268 seconds]
ygrek has quit [Ping timeout: 265 seconds]
betux has quit [Ping timeout: 276 seconds]
brettgil` has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
gareppa has quit [Quit: Leaving]
Haudegen has joined #ocaml
jnavila has quit [Remote host closed the connection]
Hrundi_V_Bakshi has joined #ocaml
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
bronsen has quit [Quit: WeeChat 2.6]
bronsen has joined #ocaml
grandy______ has joined #ocaml
grandy______ has quit [Client Quit]
isd has joined #ocaml
<isd> Hey all. I've some code examples in the wild using an open! construct. What does the exclamation point do? I haven't been able to find info on that.
<isd> Aha, thanks.
<isd> Interestingly, all the examples I've seen just use plain identifiers, so it seems like they could just use regular open...
Serpent7776 has quit [Quit: leaving]
flux has quit [Remote host closed the connection]
flux has joined #ocaml
kakadu_ has quit [Remote host closed the connection]
jco has joined #ocaml
<jco> hello
<isd> jco: Ahoy
<jco> hey isd! I do not understand why I can't translate this function: https://sebsauvage.net/paste/?672308d6e8dc4cf5#gw72NV2bQjWVdMhziR7dWGmoOQK8w2CEY+mrjrtzu4E=
<jco> into this https://sebsauvage.net/paste/?5edd5f3236c9cb91#WRvvK3JuZH1M+0nP8kd9SZ8htTs8TaqemcPLjL6N8mk=
<jco> well the change make the function no longer work
<jco> and it just seem illogical, because the second expression is just a concise rewrite of the other
<jco> btw this is dijkstra
<lyxia> jco: what's the error
ziyourenxiang has joined #ocaml
<jco> lyxia: well the function doesn't terminate with the second expression instead of the first one
<lyxia> these are not equivalent because the second one tests the condition even after you've set target_reached = true.
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<jco> ahhhh this is it!
<lyxia> BTW doing a comparison with PQueue.empty is quite redundant with pattern-matching PQueue.get_min...
<jco> lyxia: why? it can be made simpler?
<jco> oh yes
<jco> if get min fails then the pqueue is empty
<jco> lyxia: it looks like I'd better do a pattern match on the get min then
<lyxia> yes
<jco> but then the while construction seems trickier to keep
Hrundi_V_Bakshi has quit [Ping timeout: 245 seconds]
<lyxia> pretty good reason to not do it :)
<isd> Yeah, I would just not bother with the while; it's not even saving you any code.
<jco> indeed, it doesn't add that much value to the program, although it could look fancier
<jco> right
<jco> thank you both!