companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.12 released: https://ocaml.org/releases/4.12.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
waleee has quit [Ping timeout: 240 seconds]
brettgilio has joined #ocaml
nd__ has quit [Read error: Connection reset by peer]
<cemerick> So `Core_kernel.Set_intf` offers a `to_sequence` fun, but no `of_sequence`. How does one efficiently create a set from a sequence in core?
nd__ has joined #ocaml
<d_bot> <Anurag> cemerick: I believe `of_sequence` will be part of the next version of `base/core_kernel` (I see it in the unreleased base library). In the meantime i'm guessing `Sequence.fold` will be a good way to create a set from a sequence.
<d_bot> <Anurag> the `fold` is what the upcoming `of_sequence` in base also uses: <https://github.com/janestreet/base/blob/c95422a6b5d5dba29c51df3e37b8f50eaff6ad68/src/set.ml#L924-L926>
<companion_cube> Some inspiration from the stdlib? :)
mbuf has joined #ocaml
berberman_ has joined #ocaml
gzj has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
gzj has quit [Ping timeout: 258 seconds]
adanwan has joined #ocaml
jtck has joined #ocaml
wilfred has joined #ocaml
gravicappa has joined #ocaml
jtck has quit [Remote host closed the connection]
bartholin has joined #ocaml
nd__ has quit [Ping timeout: 258 seconds]
nd__ has joined #ocaml
nd___ has joined #ocaml
nd__ has quit [Ping timeout: 258 seconds]
xorpse has joined #ocaml
nd__ has joined #ocaml
xorpse has quit [Quit: ZZZzzz…]
nd___ has quit [Ping timeout: 250 seconds]
xorpse has joined #ocaml
xorpse has quit [Client Quit]
xorpse has joined #ocaml
xorpse has quit [Client Quit]
glassofethanol has joined #ocaml
olle has joined #ocaml
<d_bot> <Aram> How is OCaml typeset in LaTeX papers? In Haskell there's lhs2tex.
adanwan_ has joined #ocaml
adanwan has quit [Ping timeout: 244 seconds]
<Armael> I don't know if we have something similar to lhs2tex for literate programming, but otherwise I just use minted
<Armael> (or a custom listings file when extra trickery is needed)
<Armael> I remember using https://www.lri.fr/~filliatr/ocamlweb/ back in .. 2012
<Armael> (but my experience when writing papers is that you don't do literate programming, you just write latex with code snippets, and for that you use minted/listings)
wilfred has quit [Quit: Connection closed for inactivity]
<d_bot> <Aram> yeah, I don't particularly care about literaly programming. I just want code snippets with very basic syntax highlighting/formatting.
<d_bot> <Aram> I'll take a look at minted, thanks!
<d_bot> <Aram> I see that many (??) OCaml papers replace `'a` with `α`, etc.
xorpse has joined #ocaml
xorpse has quit [Client Quit]
xorpse has joined #ocaml
waleee has joined #ocaml
nd__ has quit [Ping timeout: 250 seconds]
xorpse has quit [Quit: ZZZzzz…]
xorpse has joined #ocaml
nd__ has joined #ocaml
xorpse has quit [Quit: ZZZzzz…]
xorpse has joined #ocaml
xorpse has quit [Client Quit]
berke has joined #ocaml
berke has quit [Quit: leaving]
<Corbin> There's also https://github.com/vijithassar/lit which is quite a different option, embedding any language into literate Markdown.
<companion_cube> @Aram I just use listings
<companion_cube> perhaps with more keywords
zebrag has joined #ocaml
mbuf has quit [Quit: Leaving]
neiluj has joined #ocaml
<neiluj> Hi! Been debugging this function (https://bpa.st/KIHA) for almost a day now, and still puzzled. It reads a file and send the chunk of index j from a file.
<neiluj> Problem is, it seems to only work the first time it is called, or with j equal to the last chunk.
<neiluj> is there anything fishy at a glance?
<neiluj> it seems stuck at the input call
<d_bot> <darrenldl> at brief glance: use <> instead of !=
<neiluj> oh indeed
<neiluj> thanks :)
<d_bot> <darrenldl> not sure why it'd be stuck though
Tuplanolla has joined #ocaml
<neiluj> first the assert is incorrect, as we may fetch an index j lower than the number of chunks
<neiluj> that was the issue
<neiluj> so assert and lwt promises don't go well together
<companion_cube> can't assert stuff on a value not resolved yet :)
<neiluj> haha! thanks, lesson learnt the hard way :)
<neiluj> and indeed, it makes sense when you're reminded about lwt's execution model
olle has quit [Ping timeout: 256 seconds]
ski has joined #ocaml
glassofethanol has quit [Quit: leaving]
mbuf has joined #ocaml
romildo has joined #ocaml
<romildo> It seems that there is not an operator for function composition in the OCaml standard library.
<companion_cube> there is not, indeed
<romildo> How would you write in OCaml the equivalent of the following Haskell expression?
<romildo> map (f . g) lst
<companion_cube> List.map (fun x -> f (g x)) lst
<romildo> thanks
nd___ has joined #ocaml
<romildo> I cannot understand why there is not such operator...
<companion_cube> you can write your own in one line
<companion_cube> OCaml programmers don't care too much about pointfree
<Armael> point-free style also does not work as well in a non-pure language because of the value restriction
nd__ has quit [Ping timeout: 258 seconds]
gravicappa has quit [Ping timeout: 258 seconds]
nd___ has quit [Ping timeout: 252 seconds]
romildo has quit [Quit: Leaving]
mbuf has quit [Quit: Leaving]
<Corbin> Aw, they left. I would add that, in addition to all of that, the composition of functions takes stack space. That was my lesson from last week.
<brettgilio> Has anybody built a fully OCaml tool using Revery? If so, i'd love to see it.
hackinghorn has joined #ocaml
<d_bot> <Et7f3> oni2 👀
<d_bot> <Et7f3> it is written in reason but just for syntax sugar
<brettgilio> I'd really love it if the Revery documentation included parallel documentation in Ocaml.
<neiluj> there's this quickstart for OCaml: https://github.com/revery-ui/revery-quick-start-ocaml
<neiluj> also this library based on revery: https://github.com/osener/bonsai_revery
<brettgilio> neiluj where that documentation loses me is https://github.com/revery-ui/revery-quick-start-ocaml/blob/master/src/SimpleButton.ml#L45 to the bottom
<brettgilio> Like what is happening there?
<brettgilio> It is JSX, right? Like, is that necessary or is there some ppx for jsx that could make that simpler?
<neiluj> I think it is necessary, looks similar to reason-react
<neiluj> (for the little I read about it)
<neiluj> I'd make this quickstart compile first and then play with it
<brettgilio> good idea
<neiluj> but yeah, in OCaml libraries are often underdocumented, so you tend to learn by reproducing/adapting code to your needs.
<brettgilio> It would just be nice if OCaml was treated as a first class citizen sometimes... lol
Tuplanolla has quit [Quit: Leaving.]
brettgilio has quit [Quit: The Lounge - https://thelounge.chat]
brettgilio has joined #ocaml
Fardale has joined #ocaml
<d_bot> <mbacarella> OCaml Cafe starts in 90 minutes.
bartholin has quit [Quit: Leaving]
<d_bot> <monk> as someone who enjoys messing with ocaml and wants to use it more seriously, I do agree/wish that there was a better culture around documentation
<d_bot> <monk> I think Haskell similarly struggles with this, it just has a larger community so the more commonly used libraries get more love over time
<brettgilio> monk: I think a large portion of this will need to change before people begin adopting OCaml more
<brettgilio> the multicore push just isnt going to be enough
<brettgilio> for popularity
<d_bot> <monk> I’m not going to pretend I am an expert or hold a serious opinion on this, but I think solid documentation is definitely a strong basis for long run success
<d_bot> <monk> everyone loves to point to rust these days yes but there’s a good reason why people point to rustdocs etc
<brettgilio> no amount of novel ocaml documentation tooling seems to make this any more common either
<neiluj> odoc is fine
<neiluj> for generating documentation
<brettgilio> I know it is. I wasn't meaning the tooling is not well designed.
<brettgilio> Just that the tooling isn't affecting our culture of documentation enough.
<neiluj> fair enough
<d_bot> <monk> The tooling looks fine from what I’ve seen, it’s much culture/expectation that you should document your code
tizoc has joined #ocaml
<d_bot> <Et7f3> most of the time user rely on interface and typechecker to justify absence of documentation
<brettgilio> I think that is acceptable, sometimes. However, to many people who do not fully understand the type system they are left without the ability to reason their way through the semantics of OCaml.
<brettgilio> Which is part of what prevents OCaml from being adopted.
<brettgilio> (and what lends to the idea that OCaml is only good for compiler construction)
<companion_cube> brettgilio: I find it easier to write basic documentation with odoc
<companion_cube> + an intro in the readme
<brettgilio> companion_cube: I am in agreement. I think this habit needs to be more adoptable by others.
<brettgilio> Beyond just a random assortment of libraries, we just need consistent documentation practices.
<companion_cube> Now I also have a basic github action to keep the doc up to date, it's cool
<brettgilio> I'd argue the documentation is far more important than the libraries, too.
<brettgilio> (Unrelated, is d_bot from discord, or what?)
<neiluj> yep
<brettgilio> I'm a science teacher by day, and I am thinking about starting an after-school hackers club to introduce high schoolers to OCaml and Racket