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
klntsky has quit [Remote host closed the connection]
klntsky has joined #ocaml
serge has joined #ocaml
ansiwen_ has joined #ocaml
chindy_ has joined #ocaml
serge has quit [Ping timeout: 265 seconds]
serpent has joined #ocaml
Cypi_ has joined #ocaml
twain has joined #ocaml
def`_ has joined #ocaml
serge has joined #ocaml
ansiwen has quit [Quit: ZNC 1.7.1 - https://znc.in]
chindy has quit [Quit: No Ping reply in 180 seconds.]
chewbranca has quit [Read error: Connection reset by peer]
tsani has quit [Ping timeout: 272 seconds]
chewbranca has joined #ocaml
Serpent7776 has quit [Ping timeout: 272 seconds]
rom1504 has quit [Ping timeout: 272 seconds]
fre2 has quit [Ping timeout: 272 seconds]
Cypi has quit [Ping timeout: 272 seconds]
haskell_enthusia has quit [Ping timeout: 272 seconds]
chewbranca has joined #ocaml
def` has quit [Ping timeout: 272 seconds]
chewbranca has quit [Changing host]
chewbranca has joined #ocaml
chewbranca has quit [Changing host]
tsani has joined #ocaml
fre2 has joined #ocaml
webshinra has quit [Remote host closed the connection]
sspi__ has quit [Read error: Connection reset by peer]
rfv has quit [Write error: Connection reset by peer]
chewbranca has quit [Read error: Connection reset by peer]
jmct has quit [Read error: Connection reset by peer]
monad_cat has quit [Read error: Connection reset by peer]
spew has quit [Read error: Connection reset by peer]
nullcone has quit [Read error: Connection reset by peer]
sspi__ has joined #ocaml
monad_cat has joined #ocaml
jmct has joined #ocaml
serge has quit [Ping timeout: 268 seconds]
rfv has joined #ocaml
spew has joined #ocaml
webshinra has joined #ocaml
chewbranca has joined #ocaml
dckc has quit [Ping timeout: 272 seconds]
nullcone has joined #ocaml
igitoor has quit [Remote host closed the connection]
igitoor has joined #ocaml
smazga has quit [Quit: leaving]
Adso_of_Jelq has quit [Ping timeout: 272 seconds]
Adso_of_Jelq has joined #ocaml
igitoor has joined #ocaml
igitoor has quit [Changing host]
rom1504 has joined #ocaml
dckc has joined #ocaml
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
spew has quit [Quit: Connection closed for inactivity]
picolino has quit [Quit: ZNC - http://znc.in]
picolino has joined #ocaml
serge has joined #ocaml
serge has quit [Ping timeout: 268 seconds]
brettgilio has joined #ocaml
nicoo has quit [Ping timeout: 240 seconds]
cranix_ has quit [Ping timeout: 268 seconds]
nicoo has joined #ocaml
h112 has joined #ocaml
h11 has quit [Ping timeout: 265 seconds]
tianon has quit [Ping timeout: 265 seconds]
h112 is now known as h11
tianon has joined #ocaml
malina has quit [Remote host closed the connection]
serge has joined #ocaml
serge has quit [Ping timeout: 265 seconds]
cranix has joined #ocaml
serge has joined #ocaml
serge_ has joined #ocaml
serge has quit [Read error: Connection reset by peer]
serge_ has quit [Ping timeout: 260 seconds]
serge has joined #ocaml
serge has quit [Ping timeout: 260 seconds]
decentpenguin has joined #ocaml
decentpenguin has quit [Client Quit]
olle has quit [Ping timeout: 268 seconds]
olle has joined #ocaml
serge has joined #ocaml
serge has quit [Ping timeout: 268 seconds]
mfp has quit [Ping timeout: 246 seconds]
serge has joined #ocaml
Haudegen has quit [Ping timeout: 268 seconds]
serge_ has joined #ocaml
serge has quit [Read error: Connection reset by peer]
mfp has joined #ocaml
serge_ has quit [Ping timeout: 272 seconds]
serge has joined #ocaml
serge has quit [Read error: Connection reset by peer]
serge has joined #ocaml
serge has quit [Ping timeout: 240 seconds]
serge has joined #ocaml
serge has quit [Read error: Connection reset by peer]
serge has joined #ocaml
serge has quit [Ping timeout: 268 seconds]
mfp has quit [Ping timeout: 272 seconds]
dborisog has joined #ocaml
mahmudov has quit [Ping timeout: 260 seconds]
tormen_ has joined #ocaml
tormen has quit [Ping timeout: 268 seconds]
nullifidian has joined #ocaml
nullifidian__ has quit [Ping timeout: 265 seconds]
ziyourenxiang has quit [Quit: Leaving]
mbuf has joined #ocaml
serge has joined #ocaml
NSA_Spy has quit [Ping timeout: 248 seconds]
serge has quit [Ping timeout: 268 seconds]
<nicolaus> good day, what do you usually do whenever you have a function which has multiple parameters in which i mean more than 3. Do you store it like a type/struct?
<nicolaus> because with 3 you can just func (param1, param2, param3) right? how about 4 params?
<def`_> func param1 param2 param3 is more common, and that generalizes well to param 4
<nicolaus> lol, compiler does not allow capital letters on first letter of the function
<nicolaus> thanks
gravicappa has joined #ocaml
vicfred has joined #ocaml
serge has joined #ocaml
serge has quit [Ping timeout: 268 seconds]
narimiran has joined #ocaml
nullifidian has quit [Read error: Connection reset by peer]
nullifidian has joined #ocaml
serge has joined #ocaml
bartholin has quit [Quit: Leaving]
serge has quit [Ping timeout: 265 seconds]
rpcope has quit [Ping timeout: 248 seconds]
serge has joined #ocaml
rpcope has joined #ocaml
serge has quit [Ping timeout: 268 seconds]
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
serge has joined #ocaml
serge has quit [Ping timeout: 268 seconds]
serge has joined #ocaml
serge has quit [Read error: Connection reset by peer]
serge has joined #ocaml
serge_ has joined #ocaml
serge has quit [Read error: Connection reset by peer]
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
serge_ has quit [Ping timeout: 260 seconds]
serge has joined #ocaml
serge has quit [Ping timeout: 272 seconds]
serge has joined #ocaml
serge has quit [Read error: Connection reset by peer]
serge has joined #ocaml
serge has quit [Ping timeout: 272 seconds]
serge has joined #ocaml
serge has quit [Ping timeout: 260 seconds]
serge has joined #ocaml
serge has quit [Ping timeout: 240 seconds]
serge has joined #ocaml
<mbuf> nicolaus, a name with a capital letter is for a Module
serge has quit [Ping timeout: 260 seconds]
serge has joined #ocaml
serge has quit [Ping timeout: 268 seconds]
ziyourenxiang has joined #ocaml
tmhoang has quit [Quit: Alpine Linux, the security-oriented, lightweight Linux distribution]
Exagone313 has quit [Ping timeout: 260 seconds]
Exagone313 has joined #ocaml
<Leonidas> or a Constructor
vicfred has quit [Quit: Leaving]
serge has joined #ocaml
serge has quit [Read error: Connection reset by peer]
serge_ has joined #ocaml
m_oss has joined #ocaml
nullcone has quit [Quit: Connection closed for inactivity]
kleisli has quit [Ping timeout: 240 seconds]
Guest4791 has quit [Quit: leaving]
Haudegen has joined #ocaml
zolk3ri has joined #ocaml
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
dhil has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
jim7j1ajh is now known as jimt
mfp has joined #ocaml
<hannes> anyone can help me with Hashtbl.t intuition? I understand it does O(1) (well, O(hashfn)) lookup, add, remove. that's fine -- but I'm interested in the (worst-case) memory complexity... let's say I created a hashtbl with initial size 10, and now push more and more elements into it. once i reached 11, it needs to grow -- does this mean "allocate sufficiently big array for 20 keys and copy the existing
<hannes> around"? or does it grow the array -- i.e. will the memory being used (for keys only) be 30 in a brief time period?
<Armael> hannes: yeah, peak memory consumption during resize is "size of the old array" + "size of the new array"
<hannes> Armael: thanks, and there is actually a copy of the array content (i.e. the keys) going on? which means in a huge table that may take some time!?
<Armael> (incidentally, the size of the underlying array is going to be the next power of 2, for hashing reasons)
<Armael> yes
<Armael> it's amortized O(1)
<hannes> Armael: do you know whether there's any code that shrinks the hashtable at a point (i.e. during remove?)
<Armael> there ought to be, but there isn't at the moment
<Armael> that something that I wanted to implement at some point
<Armael> that's *
<hannes> thank you.. this basically means (I am interested in worst-case space and time) that hashtables are pretty unpredictable.. and i should revert all their uses to these nice and kind Map.t structures :)
<Armael> mmh, perhaps
<Armael> I'm not sure whether maps are worst-case O(logn) or amortized O(logn)
<Armael> worst-case O(logn) is more likely
<hannes> lookup is afaict worst-case O(log n), while add/remove may re-balance the tree and thus may have only amortized O(log n) -- but I'm sure others in here know much better
<Armael> right, yes, you're probably correct
<hannes> and re-balancing depends on the concrete tree (red-black / avl), and i forgot the exact details
<Armael> but then allocating a new array (for the hashtable) might be quite fast in practice as well, i'm not sure
<Armael> it might be best to measure how hashtables/maps perform in practice for your application
<hannes> Armael: sure. I actually do this ;) and in the "common case" / amortized, certainly a hashtable is "nicer", but when you look at the 95% or 99%, you get one request with a huge delay (that's where the hashtbl needed to grow)
<Armael> ok, that makes sense then
<hannes> or instead huge delay a peak (of n * 2) in the memory consumption
<Armael> (googling "real time hash tables" yields some results that look interesting)
<Armael> but indeed hashtables don't look too good for a real-time application
<hannes> this whole line of thought is mainly due to https://github.com/mirage/qubes-mirage-firewall/issues/93 -- and discoveries that the Lru library pre-allocates a hashtable of size "capacity" (if taking 256 * 1024 as capacity means ~2MB for the key array)
<hannes> (the opam library lru, using Lru.M -- Lru.F is based on maps)
averell has quit [Quit: .]
<Armael> wrt shrinking, do you actually remove entries from the cache, or does it grow monotonically?
<Armael> (ie would you have a use for hashtable shrinking')
<Armael> ?*
<hannes> Armael: I don't have a use for shrinking, I was curious whether such an action is triggered (and thus leading to some more "unexpected" time/space potentially being burned by a "Hashtbl.remove")
<Armael> ok
FreeBirdLjj has joined #ocaml
<Armael> this workshop article describes the implementation of a realtime hashtable where the cost of resizing is spread along several operations https://users.cs.northwestern.edu/~sef318/docs/hashtables.pdf
mbuf has quit [Quit: Leaving]
<Armael> I haven't looked at the details, but according to their numbers, the performance is 10-20x slower in the average case, which is not so impressive I guess
<hannes> thanks :)
<Armael> using maps is probably a more pragmatic solution indeed
ggole has joined #ocaml
averell has joined #ocaml
averell has quit [Remote host closed the connection]
averell has joined #ocaml
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
kakadu_ has joined #ocaml
serpent is now known as Serpent7776
kakadu has quit [Ping timeout: 240 seconds]
j14159 has quit [Read error: Connection reset by peer]
JSharp has quit [Ping timeout: 265 seconds]
lopex has quit [Ping timeout: 260 seconds]
FreeBird_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 260 seconds]
chewbranca has quit [Read error: Connection reset by peer]
serge_ has quit [Remote host closed the connection]
FreeBird_ has quit [Remote host closed the connection]
serge_ has joined #ocaml
rfv has quit [Ping timeout: 245 seconds]
stephe has quit [Ping timeout: 260 seconds]
serge_ has quit [Ping timeout: 272 seconds]
chewbranca has joined #ocaml
JSharp has joined #ocaml
rfv has joined #ocaml
stephe has joined #ocaml
lopex has joined #ocaml
j14159 has joined #ocaml
dhil has quit [Ping timeout: 252 seconds]
Haudegen has quit [Ping timeout: 260 seconds]
n00by-n00by-doo has joined #ocaml
nullcone has joined #ocaml
kleisli has joined #ocaml
serge_ has joined #ocaml
malina has joined #ocaml
serge__ has joined #ocaml
serge_ has quit [Ping timeout: 260 seconds]
CcxWrk has quit [Ping timeout: 240 seconds]
CcxWrk has joined #ocaml
mbuf has joined #ocaml
spew has joined #ocaml
tane has joined #ocaml
tane has quit [Client Quit]
<dmbaturin> Is it possible to either a) make ocamlc read the source from stdin b) make ocaml typecheck the input but not evaluate it?
m_oss has quit [Quit: Leaving]
<companion_cube> you mean not compile it to files? I don't think so
kleisli has quit [Ping timeout: 272 seconds]
<spew> there is a typecheck only flag
<spew> there used to be at least
<spew> -i, right?
<companion_cube> it produces code, but yeah, good point
<spew> ah right
<companion_cube> it prints the signature, I mean
<spew> yes
<spew> didn't realize that it also produces code
<companion_cube> it might produce a .cmi ? not sure
<spew> no you're right
<spew> the second time
<spew> it doesn't produce code
<spew> in this fog of confusion, it is what we want it to be
<spew> I don't think it can read from stdin though
<octachron> There is also "-stop-after typing"
<companion_cube> ohhhh nice
smazga has joined #ocaml
<Armael> isn't this a very recent addition though?
dhil has joined #ocaml
<octachron> It is
kleisli has joined #ocaml
andreas303 has quit [Quit: andreas303]
andreas303 has joined #ocaml
<dmbaturin> spew: Yes, ocamlc has a -stop-after flag even, but it has no option to read from stdin, at least I can't see it.
<dmbaturin> I want to make invalid examples in https://ocaml-book.baturin.org/ fail the build (unless explicitly marked as invalid).
<dmbaturin> If I can do it without a wrapper script that saves code to file for passing it to ocamlc, that would be perfect.
<ggole> ocamlc -impl /dev/stdin "should work", but it actually fails with an unsupported seek error. Basically the compiler is written to consume files, not streams.
<dmbaturin> I don't mind a wrapper script, but I wonder if a PR for -stop-after option for ocamlc is worth a try.
<dmbaturin> * for ocaml, sorry
mahmudov has joined #ocaml
gareppa has joined #ocaml
ygrek__ has joined #ocaml
Haudegen has joined #ocaml
vicfred has joined #ocaml
tane has joined #ocaml
gareppa has quit [Quit: Leaving]
kleisli has quit [Ping timeout: 272 seconds]
tane has quit [Quit: Leaving]
kleisli has joined #ocaml
<Armael> a lot of types ? :-)
<dmbaturin> * typos
<dmbaturin> Some custom styling for purposely invalid code samples is probably a good idea too.
<octachron> Would it not be even safer to run the code?
<dmbaturin> octachron: I thought about it, but code that requires user input or file can easily cause failures even if it's correct.
<octachron> You could use a prelude that mocks those io functions for the test/book environment
<dmbaturin> I thought about it too, but there are other issues, e.g. infinite loops.
<dmbaturin> Intentional infinite loops demonstrations, that is.
mbuf has quit [Quit: Leaving]
jmiven has quit [Quit: brb]
jmiven has joined #ocaml
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]
smazga has quit [Ping timeout: 272 seconds]
smazga has joined #ocaml
<Leonidas> dmbaturin: haha, I read your conversation just after I read bodil's tweet praising the rust doc tools for actually compiling the code samples to ensure they work
<dmbaturin> Leonidas: My pipeline compiles _inline_ examples rather than external listings. Yes, I did it for the hack value.
<Leonidas> I'd love to contribute though I find writing a *good* book is a pretty difficult effort that requires lot of concentrated effort
<companion_cube> ocaml-mdx also helps for this kind of things
<companion_cube> at least I use it in readmes
theglass has left #ocaml ["https://quassel-irc.org - La chat diventa comoda. Ovunque."]
<dmbaturin> Leonidas: Well, any help is welcome, even just beta reading and pointing out issues.
<Leonidas> companion_cube: would be great to have that integrated in odoc :-)
<companion_cube> ah man, yeah
<Leonidas> I'd love my documentation to barf saying that the code example doesn't even compile :)
<companion_cube> odoc is super neat, it just lacks a bit in features sometimes (like I discovered that {!module_list} wasn't implemented)
<companion_cube> I'd love that too
<companion_cube> especially when you update code
<companion_cube> helps updating the code
<companion_cube> the docs*
<Leonidas> dmbaturin: I've starred it now, so yeah
<Leonidas> dmbaturin: it would be nice if you could create a sort of outline what you imagine it to be so people can pick things and there is a path toward "finishing" it
<dmbaturin> Good point.
<dmbaturin> I also need to improve navigation.
<companion_cube> dmbaturin: how will the book differ from RWO?
<Leonidas> I really wish a new "release" of RWO would come out
<companion_cube> one without JST stuff
<companion_cube> oooops :-°
<Leonidas> one without camlp4 would be enough for me
<companion_cube> ahahahah
<companion_cube> I should write "real grump ocaml" without JST nor ppx stuff
<Leonidas> when I read RWO I did't even like Core, but I have to admit that the book is well written
<dmbaturin> companion_cube: It's free as in freedom first of all (CC-BY-SA). I outlined the other points in the Principles on https://ocaml-book.baturin.org
<Leonidas> and not boring for people who know programming already
<Leonidas> this is why I dislike most books since they tell me how to write functions. yeah, duh, thanks.
<Leonidas> RWO and the Dlang book were really nice
<companion_cube> hmmm, I've only looked at the D online stuff, which is pretty rad
<Leonidas> I wanted to use D since it sounded all very sensible (like, learning from being burned by C++) but now that Rust came along there isn't much reason anymore
<Leonidas> the plan is now to steal all the good Rust ideas and bring them to OCaml :)
<companion_cube> I wish D had some of the good stuff from rust
<companion_cube> like, D with a rust-like syntax, and sum types, would be pretty cool
<dmbaturin> Leonidas: I felt like telling people about function bindings and currying was worth it, since people coming from say JS will not know it, and people who come from Haskell know what to safely skip.
<Leonidas> dmbaturin: sure, and if you have a good explanation how currying, named parameters and default parameters work then it is an interesting read even for haskellers
<dmbaturin> The book is also a bit bourbakist in spirit, so yeah.
<dmbaturin> The named/default parameter section should be expanded.
kleisli has quit [Ping timeout: 268 seconds]
<dmbaturin> I should either add multiple selectors support to lambdasoup or hack soupault itself to eliminate this bit of inelegance: https://github.com/dmbaturin/ocaml-book/blob/master/soupault.conf#L89-L101
<dmbaturin> There's even an open issue in lambdasoup with some ideas, but it's not exactly trivial.
<companion_cube> is that config in toml ?
<dmbaturin> Yep.
<companion_cube> I never looked at soupault, because I don't like html, but it looks pretty powerful
<dmbaturin> The book source is in markdown, which is automatically converted with cmark.
tane has joined #ocaml
<companion_cube> how do you put classes then? :)
<dmbaturin> ```ocaml
ArthurStrong has joined #ocaml
<dmbaturin> cmark translates ```foo it to class='language=foo', not sure if it's in the markdown standard or not.
<companion_cube> seems like it's in the standard indeed
<companion_cube> oh and it skips the rest, quite nice
<companion_cube> meaning that mdx is compliant
<dmbaturin> Skips code blocks without ocaml lang spec?
<companion_cube> no, if you write ```ocaml expect=foo … or whatever, it just picks `ocaml` as the language
<dmbaturin> Ah, I see.
<dmbaturin> Though what I said also appears to be true.
<companion_cube> it's pretty cool that the standard specifies `language=foo`
<dmbaturin> Curiously, the spec doesn't mandate it.
<dmbaturin> There's quite some room for malevolent compliance. :)
<companion_cube> ugh :D
dhil has quit [Ping timeout: 260 seconds]
<dmbaturin> Anyway, you can specify any preprocessor, or multiple preprocessors for different file extensions.
olle has quit [Ping timeout: 268 seconds]
olle has joined #ocaml
dborisog has quit [Ping timeout: 260 seconds]
kleisli has joined #ocaml
olle has quit [Ping timeout: 260 seconds]
<dmbaturin> On a side note, I'm seriously thinking of writing an alterantive to to.ml that would use polymorphic variants like JSON libs do. to.ml's lenses are cool if you know exactly what you are looking for and are happy to ignore wrongly typed values, but if you want to pass chunks of the config to plugins or allow type conversions, it gets unwieldy.
olle has joined #ocaml
<companion_cube> to.ml's API has always been all over the place
<companion_cube> if you want to write a simple parser+printer with poly variants, seriously, go for it
<dmbaturin> I'm also feeling an urge to stick Menhir's incremental API to every place my hands can reach ever since I learnt how to make declarative parse errors with it. ;)
<dmbaturin> TOML is context-free enough to make meaningful error reporting easy, or not too onerous to make.
<dmbaturin> Well, LR(1)-unambiguous, even.
<dmbaturin> What to name it? pvtoml?
gareppa has joined #ocaml
rwmjones has quit [Quit: ZNC - 1.6.0 - http://znc.in]
rwmjones has joined #ocaml
kakadu has joined #ocaml
<Leonidas> atoml :p
<companion_cube> eztoml
<companion_cube> yotoml ?
<dash> froml
gareppa has quit [Quit: Leaving]
zolk3ri has quit [Remote host closed the connection]
bartholin has joined #ocaml
<dmbaturin> yoml
ggole has quit [Quit: Leaving]
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
ocaml459 has joined #ocaml
jnavila has joined #ocaml
ocaml459 has quit [Client Quit]
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
ocaml459 has joined #ocaml
ocaml459 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
pablo[m]3 has quit [*.net *.split]
artart78 has quit [*.net *.split]
artart78 has joined #ocaml
narimiran has quit [Ping timeout: 260 seconds]
gravicappa has quit [Ping timeout: 240 seconds]
malina has quit [Ping timeout: 260 seconds]
kakadu has quit [Ping timeout: 240 seconds]
kakadu has joined #ocaml
kakadu__ has joined #ocaml
kakadu has quit [Ping timeout: 260 seconds]
n00by-n00by-doo has quit [Ping timeout: 260 seconds]
brettgilio has quit [Ping timeout: 246 seconds]
brettgilio has joined #ocaml
jnavila has quit [Ping timeout: 256 seconds]
ygrek__ has quit [Ping timeout: 268 seconds]
tane has quit [Quit: Leaving]
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
<Leonidas> tomiou
TheLemonMan has joined #ocaml
kjak has quit [Quit: leaving]
kakadu__ has quit [Remote host closed the connection]
NSA_Spy has joined #ocaml
ArthurStrong has quit [Quit: leaving]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
mahmudov has quit [Remote host closed the connection]
vicfred has quit [Quit: Leaving]
smazga has quit [Quit: leaving]