Leonidas changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.13.0 released: https://ocaml.org/releases/4.13.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
olle has quit [Ping timeout: 250 seconds]
AeroNotix has joined #ocaml
sleepydog has quit [Quit: ZNC 1.8.2 - https://znc.in]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
AeroNotix has quit [Quit: WeeChat 3.4]
rgrinberg has quit [Ping timeout: 240 seconds]
wyrd has quit [Ping timeout: 276 seconds]
wyrd has joined #ocaml
rgrinberg has joined #ocaml
sleepydog has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.4]
pieguy128 has quit [Ping timeout: 268 seconds]
perrierjouet has joined #ocaml
pieguy128 has joined #ocaml
pieguy128_ has joined #ocaml
pieguy128 has quit [Ping timeout: 250 seconds]
wyrd has quit [Remote host closed the connection]
wyrd has joined #ocaml
vicfred has quit [Quit: Leaving]
adanwan has joined #ocaml
mbuf has joined #ocaml
<ns12> rgrinberg: In Opium, how do I make the logs appear when using the "logger" middleware? For example, this will not show any logs: https://paste.debian.net/plain/1228297
<ns12> For the logs to appear, I found that I need to add: Logs.set_reporter (Logs_fmt.reporter ()); Logs.set_level (Some Logs.Info);
<ns12> Is this documented somewhere is Opium?
waleee has quit [Ping timeout: 240 seconds]
mbuf has quit [Read error: Connection reset by peer]
mbuf has joined #ocaml
spip has joined #ocaml
bobo_ has quit [Ping timeout: 256 seconds]
gravicappa has joined #ocaml
bgs has joined #ocaml
Haudegen has joined #ocaml
motherfsck has quit [Quit: quit]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
motherfsck has joined #ocaml
<d_bot> <joris> hello, wondering if anyone has a project uses dune and ppx that properly generates modules index with description with odoc or if it is specific to my environnement ?
caasih has quit [Ping timeout: 252 seconds]
caasih has joined #ocaml
gravicappa has quit [Ping timeout: 250 seconds]
<d_bot> <darrenldl> does "production ready" mean much of anything to anyone here?
gravicappa has joined #ocaml
<d_bot> <antron> yes 🙂
wyrd has quit [Quit: Lost terminal]
<d_bot> <joris> when you finished writing the code, it's production ready
jlrnick has joined #ocaml
mro has joined #ocaml
<d_bot> <darrenldl> how do you personally define it?
<d_bot> <p1xelHer0> code gets finished? 😮
<d_bot> <darrenldl> hm, bar seems pretty low then
<d_bot> <darrenldl> aighty, time to remove the spooky "dont use in production" warning
<d_bot> <orbitz> Use at your own risk!
<d_bot> <darrenldl> : D
<d_bot> <antron> 😄
<d_bot> <antron> depends on what it is. for an app, "if it's stupid and it works, it's not stupid"
<d_bot> <antron> for a published library, thorough tests, docs, good api, there is experience using it and it has withstood some beating 🙂
<d_bot> <darrenldl> ah i see, cheers
olle has joined #ocaml
szkl has joined #ocaml
wyrd has joined #ocaml
bartholin has joined #ocaml
kakadu has joined #ocaml
gravicappa has quit [Ping timeout: 240 seconds]
spip has quit [Quit: Konversation terminated!]
gravicappa has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
dalek-caan has joined #ocaml
<companion_cube> How do you define "finishing" @joris?:p
pippijn has quit [Ping timeout: 256 seconds]
pippijn has joined #ocaml
<d_bot> <dinosaure> as "never" I hope
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
mro has joined #ocaml
<d_bot> <joris> @companion_cube once you implemented 70% of the planned feature, it is roughly finished
<d_bot> <joris> :p
<companion_cube> :D
mro has quit [Read error: Connection reset by peer]
mro_ has joined #ocaml
<d_bot> <darrenldl> library with 0.7x multiplier
<d_bot> <darrenldl> hm
<ns12> So, is OCaml finished? ;-)
<d_bot> <glennsl> Good thing plans never change
mro_ has quit [Remote host closed the connection]
pippijn has quit [Ping timeout: 240 seconds]
pippijn has joined #ocaml
mro has joined #ocaml
* qwr . o O ( if unix 6th edition was roughly finished, then its about 70% of freebsd? ;) )
mro has quit [Remote host closed the connection]
Haudegen has quit [Quit: Bin weg.]
<d_bot> <VPhantom> I "finished" writing some code in the past, but I don't think I'd call much of it "production-ready", even that which ended up "in production". It's been "production-tested" by now though, but it'll never feel "ready". 😛
mro has joined #ocaml
gravicappa has quit [Ping timeout: 250 seconds]
<d_bot> <zakkor> Any idea why "method" is used in object syntax instead of just "let"?
<d_bot> <mefyl> because the content is evaluated when you `obj#meth`, not at the declaration point, which `let` would imply
<d_bot> <antron> `method` has a hidden argument (the `obj` in `obj#meth`)
<d_bot> <antron> even if it appears to have no arguments syntactically, the body is suspended
<d_bot> <zakkor> I see, thanks
Haudegen has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<d_bot> <octachron> It would be also slightly confusing to have `let` for methods and `val` for instance values.
<companion_cube> isn't it because object types don't have values?
<companion_cube> only methods
<octachron> Object types only have methods, but I am not sure how that follow? Since `let` are not allowed at the toplevel of objects, rewriting `let` to `method` would work.
<companion_cube> ah sure
<companion_cube> but it's a good design decision, it's not the same as `let … in`
<companion_cube> the bad decision was toplevel let :)
spip has joined #ocaml
mro has quit [Remote host closed the connection]
<hackinghorn> why when I see they define new types, its always "type t ="? why t?
<companion_cube> it's a convention
<companion_cube> like naming the first param `self` in python
mro has joined #ocaml
<octachron> `t` (as a shortcut for type) is the neutral name for new type, it convey the information that it is the main type of the module and that the type is intended to be referenced as `Module_name.t`.
<octachron> Since expanding the name to `Module_name.module_name` is redundant.
<hackinghorn> interesting, thankss
<companion_cube> I wish people use `self` more in OCaml too :p
gravicappa has joined #ocaml
mro has quit [Remote host closed the connection]
<Fardale> In which context do you want to see self?
<hackinghorn> I sometimes name new types that have specific names and make things structural like in C/C++, do they do that in OCaml?
<companion_cube> Fardale: (self:t)
<companion_cube> almost always
<hackinghorn> ah, I see they do that sometimes
<Fardale> Hum, I don't understand, self refer to the object itself in python, I don't see how to apply it to ocaml
<companion_cube> well, when you have a module with `type t = …`
<companion_cube> most functions will take one parameter of type t
<companion_cube> which is the one I usually call `self`
<Corbin> Fardale: `self` comes from the language Self, an ancestor of Python and ECMAScript with prototypes and objects.
waleee has joined #ocaml
<d_bot> <monk> odoc is pretty straightforward but has small rules here and there that affect output of generated documentation from my own experience with bespoke project layout, etc. can you be more specific with what might be wrong?
<d_bot> <monk> i am hesitant to open source my current dumb little project but it does show how to use a decent amount of odoc for a beginner...
mro has joined #ocaml
<companion_cube> what does your project do? :)
<d_bot> <monk> i'm just trying to put together a library that documents various algorithms and data structures in ocaml!
<d_bot> <VPhantom> I bookmarked <https://ocaml.github.io/odoc/odoc_for_authors.html> and refer to it quite often.
<d_bot> <monk> most of it will be taken from popular resources or adapted from texts like Pearls of Functional Algorithm Design by Bird
<d_bot> <VPhantom> For code and data samples, `{[ ... ]}` and `{v ... v}` are especially handy.
<d_bot> <monk> @joris this is an essential reference for odoc, i had it open all the time when first getting started
<d_bot> <monk> im also trying to do things like showing mutable vs immutable implementations, something OCaml really shines at demonstrating
<companion_cube> so, another stdlib? :D
<d_bot> <VPhantom> 😛
<d_bot> <monk> haha aaaaabsolutely not, no attempts at optimization will be made unless they're common to naive implementations 😆
<d_bot> <monk> i had to talk myself out of re-using the implemented data structures across the library as an act of mercy/pragmatism to make sure i just get it done lol
waleee has quit [Ping timeout: 240 seconds]
<d_bot> <monk> OCaml's capacity for mutability is obviously widely advertised, but i still find myself thinking it's undersold tbh
waleee has joined #ocaml
<d_bot> <monk> it's Just Neat to see a mutable implementation right next to an immutable one
rgrinberg has joined #ocaml
waleee has quit [Ping timeout: 256 seconds]
szkl has quit [Quit: Connection closed for inactivity]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<sleepydog> I'm trying to profile an OCaml program with linux `perf` and I'm wondering if/how tail calls are represented. Does anyone know if a tail call will add to the stack in a perf profile?
<sleepydog> I'm assuming they won't, and that if I see a recursive function adding to the stack, it's not tail recursive
<sleepydog> but i don't know if that's correct
mbuf has quit [Quit: Leaving]
<d_bot> <monk> presumption is that since ocaml does have tail recursion and ocamlc will optimize for it (when it sees it), you will not see additional stack frames added when a given function/program recurses down
<d_bot> <monk> for a given function that is in tail recursive form
jlrnick has quit [Ping timeout: 268 seconds]
<sleepydog> yea, that's what I thought, but I'm seeing a function i thought was tail recursive adding to the stack. so i guess i made a mistake with it. thanks!
<d_bot> <monk> i don't want to lead you astray, maybe i don't know enough about ocaml's allocation strategy for handling recursive functions.
<d_bot> <monk> at risk of being trite, you could try a basic program that runs `List.fold_left` (tail recursive) and `List.fold_right` (not tail recursive on some non-trivial input and see what perf shows you
<sleepydog> i guess it's possible there's extra info in the perf profile, like a frame counter or something. i'm not *that* familiar with perf
<sleepydog> that's a good idea
<d_bot> <monk> > i guess it's possible there's extra info in the perf profile, like a frame counter or something. i'm not that familiar with perf
<d_bot> <monk> yeah that was another suspicion that made me hesitant to speak further
<d_bot> <monk> let us know!
<octachron> Also for checking that a recursive call is in tail position, you can annotate it with `(f[@tailcall]) ... `
<sleepydog> ah, i just read the function a bit closer and it's absolutely not a tail call :)
<sleepydog> i focused too much on the signature and not the call site
<d_bot> <monk> who amongst us
<d_bot> <monk> that's a cool fact octachron...
Haudegen has quit [Quit: Bin weg.]
<d_bot> <boris> hi guys, why i need to use this?
<d_bot> <boris> if i use [] -> [];; they return me empty list
<d_bot> <boris> tag me when reply thx ❤️
<d_bot> <orbitz> @boris i think you can figure it out if you walk through it
<d_bot> <NULL> If you follow the flow, you return nothing but what you push to the `[]` case, so if you return `[]` there that's what you're always going to get.
<d_bot> <NULL> Note that you should match on `[]` instead of `_` to still get the exhaustivity check
<d_bot> <boris> I see , tysm
rgrinberg has joined #ocaml
mro has quit [Remote host closed the connection]
bartholin has quit [Quit: Leaving]
vicfred has joined #ocaml
vicfred has quit [Client Quit]
kakadu has quit [Quit: Konversation terminated!]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
gwizon has quit [Quit: Lost terminal]
Haudegen has joined #ocaml
dalek-caan has quit [Quit: dalek-caan]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
szkl has joined #ocaml
ouestbillie has joined #ocaml
azimut_ has joined #ocaml
<ouestbillie> ive been meaning to learn ocaml for a while, tried on and off but a good reference book is a must for me, can't find anything that looks decent on amazon
<ouestbillie> real world ocaml looked decent but it's horribly out of data
<olle> Huh?
<olle> They are working on a new version, it's freely available online
<ouestbillie> s/data/date
azimut has quit [Ping timeout: 276 seconds]
<d_bot> <Anurag> There’s a new version available at https://dev.realworldocaml.org/
<ouestbillie> oh, okay, still they rely on their jane street libraries no?
<olle> Why do you need a good reference book, tho?
<ouestbillie> just the way I learn, i go through a book to get a good mental map of the language and then start writing
<d_bot> <Anurag> For print books, Beginning OCaml, and More OCaml by John Whitington are also excellent resources.
<olle> But high level concepts don't change
<ouestbillie> yeah I have the SML book, thought I'd start with that since thats as stable as it gets...
<ouestbillie> i also don't want a book that spends 200 pages explaining folds and whatno, im interested in what makes ML languages what they are, mostly the type system and then Ocaml idiosyncracies...
<olle> ouestbillie: Just hang out here :) I learned OCaml in this channel 10 years ago
<ouestbillie> olle: good rec, i think imma do that
<olle> RWO didn't exist then, tho
<ouestbillie> just surprised theyre arent more references given how popular ocaml is getting, especially for everything compiler related
<ouestbillie> (i wanna write one for chest hair lol)
<d_bot> <monk> i would say use the cs3110 course if you want to learn fp and ocaml from first principles, more or less
<d_bot> <monk> rwoc is if you don't care to understand what is happening per se, just want to get going with ocaml
<d_bot> <monk> it's a good text, that is not a criticismm
<ouestbillie> whynotboth.jpg
<d_bot> <NULL> If you want to learn more through channels, Discord's #beginners has more beginner stuff going through (and also more advanced stuff)
noddy_ has quit [Quit: WeeChat 3.4]
mro has joined #ocaml
<ouestbillie> i mean, i have a decent grasp of FP, what interests me is like, you know, ml stuff, like how to use HM properly
noddy has joined #ocaml
<d_bot> <monk> i would suggest reading ch 1-5, 7-8 of cs31110 and anything you haven't learned at that point you'll pick up from rwoc or any other resource
<d_bot> <monk> cs3110 also has the benefit of problem sets
<d_bot> <monk> that are good and useful for review, comprehension
<d_bot> <NULL> Re #beginners, I'm not saying it will be what interests you, but that will be more to pick from
<d_bot> <monk> > i also don't want a book that spends 200 pages explaining folds and whatno, im interested in what makes ML languages what they are, mostly the type system and then Ocaml idiosyncracies...
<d_bot> <monk> @ouestbillie cs3110 is good at doing precisely this
<d_bot> <monk> for each major lang feature of ocaml, the author quickly goes over the static and dynamic semantics of how they're interpreted by ocaml. it's very nice for understanding the logic of program execution in ocaml.
mro has quit [Remote host closed the connection]
waleee has joined #ocaml
noddy has quit [Quit: WeeChat 3.4]
noddy has joined #ocaml
Tuplanolla has joined #ocaml
mro has joined #ocaml
noddy has quit [Quit: WeeChat 3.4]
noddy has joined #ocaml
noddy has quit [Client Quit]
noddy has joined #ocaml
mro has quit [Remote host closed the connection]
<d_bot> <joris> i know about it, thank you 🙂 it is pretty well written. The problem is i'm not getting started, i pulling hairs to maintain things that stopped working 😦
<d_bot> <joris> and it seems that module synopsis are not attached when a ppx is involved, even on a fresh switch. So i assume it is a bug but i'm not sure, maybe it is specific to something i didn't realized
<d_bot> <joris> this user manual is pretty good though
<d_bot> <monk> rip, hope it gets figured out
<d_bot> <monk> i wish odoc allowed for basic mathematical type setting but, outside of pulling in a large dependency, that's a problem i wouldn't wish upon most people lol
<companion_cube> there's {^ and {_, whcih I had forgotten about
ouestbillie has quit [Ping timeout: 240 seconds]
ouestbillie has joined #ocaml
pieguy128_ has quit [Ping timeout: 240 seconds]
pieguy128 has joined #ocaml
gravicappa has quit [Ping timeout: 268 seconds]
mro has joined #ocaml
Corbin has quit [Ping timeout: 240 seconds]
Colt has quit [Quit: Leaving]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
beise has quit [Read error: Connection reset by peer]
beise has joined #ocaml
rgrinberg has joined #ocaml
mro has quit [Quit: Leaving...]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<d_bot> <Jektrix> I think a book that's more project-based would be good. How to complete projects, how to structure them in an idiomatic way, designing idiomatic APIs
Tuplanolla has quit [Quit: Leaving.]
<d_bot> <Jektrix> cs3110 and realworldocaml seem to focus more on teaching one concept at a time, from there you really just need to start looking at other peoples Githubs or just trying shit out. It'd be nice if that process was shortened a bit by a more industrial book
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
<d_bot> <monk> just discovered a **deep** appreciation for janestreet's s-exp libraries because i'm not sure there is another easy way of testing & enforcing representation invariants of these data structures i'm writing right now
<d_bot> <monk> and i find it funny that the RWOC book basically introduces sexp's for this specific use-case among others lol
olle has quit [Ping timeout: 268 seconds]
<companion_cube> In what way does it help with invariants?
<d_bot> <monk> i just wanted a very dirty and cheap way of introspecting the structure of eg a RB tree and ensure that i was implementing Okasaki's algorithm correctly
<d_bot> <monk> and deriving sexp -> sexp.of_string achieved that pretty easily for me
<d_bot> <monk> honestly it would probably be lest prone to just construct the correct sexp equivalent instead of relying on string comparison but yeah
<d_bot> <monk> either way
<d_bot> <monk> does that make sense as a solution?
pippijn has quit [Remote host closed the connection]
pippijn has joined #ocaml
Haudegen has quit [Ping timeout: 256 seconds]