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/
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
Anarchos has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
spip has joined #ocaml
Guest7956 has quit [Ping timeout: 256 seconds]
spip is now known as Guest8932
rgrinberg has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
gravicappa has joined #ocaml
gravicappa has quit [Ping timeout: 256 seconds]
gravicappa has joined #ocaml
shawnw has joined #ocaml
rgrinberg has quit [Ping timeout: 240 seconds]
rgrinberg has joined #ocaml
gravicappa has quit [Ping timeout: 256 seconds]
shawnw has quit [Quit: Leaving]
Serpent7776 has joined #ocaml
gravicappa has joined #ocaml
jlrnick has joined #ocaml
shawnw has joined #ocaml
Haudegen has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bartholin has joined #ocaml
cedric has joined #ocaml
cedric has quit [Client Quit]
olle_ has joined #ocaml
<hackinghorn> I would like to find all dir/test* files but Sys.readdir does not expand the *. Is there something that expand the "*" for me in this case?
<Fardale> I would find all files in dir/ and then filter to keep only the test*.
perrierjouet has quit [Quit: WeeChat 3.3]
perrierjouet has joined #ocaml
Everything has joined #ocaml
xiongxin has joined #ocaml
Anarchos has joined #ocaml
waleee has joined #ocaml
<d_bot> <zakkor> What is more commonly used: Base or Batteries?
<d_bot> <dinosaure> @companion_cube
Haudegen has quit [Quit: Bin weg.]
<companion_cube> I imagine it's base > containers > batteries, but i don't have numbers
jlrnick has quit [Remote host closed the connection]
<companion_cube> Afaik no one but Unix junkie uses batteries anymore
waleee has quit [Ping timeout: 240 seconds]
namkeleser has joined #ocaml
waleee has joined #ocaml
chrisz has quit [Ping timeout: 240 seconds]
chrisz has joined #ocaml
namkeleser has quit [Quit: Client closed]
<d_bot> <VPhantom> Really? I had never heard of Containers until today. 🤔
<companion_cube> 😔
<d_bot> <VPhantom> I know, I'm sorry…
<d_bot> <VPhantom> I learned initially with Real World OCaml (so, Base/Core) and then heard about a duality with Batteries in places like StackOverflow, where I haven't seen Containers come up very often.
<d_bot> <VPhantom> It'd be interesting to hear from long-time users (I'm just a rookie) what use cases might distinguish the three libraries.
<d_bot> <darrenldl> used core/core kernel for a while, my overall experience is it doesnt work very well with |> cause many arguments are labelled
<d_bot> <darrenldl> containers generally have the usual convenience functions you'd want
Haudegen has joined #ocaml
xiongxin has quit [Quit: xiongxin]
namkeleser has joined #ocaml
waleee has quit [Ping timeout: 240 seconds]
waleee has joined #ocaml
<companion_cube> SO for OCaml is pretty sparse, I think
<smondet[m]> used all of them and/or made my own at some point over the past couple of decades. I think JaneSt's “t comes first, label everything else” is the best approach, by far. The lower mental overhead and the gain in readability/maintainability out-weights any perceived inconvenience.
shawnw has quit [Ping timeout: 256 seconds]
<companion_cube> it's not the only dimension though
waleee has quit [Ping timeout: 240 seconds]
<d_bot> <VPhantom> I like argument ordering predictability. I also naturally use a "t first" approach in my own work ever since my C days decades ago. I think it fits very naturally with OCaml's currying.
<companion_cube> backward compatibility is also a practical concern, as can be (depending on your taste) compatibility with the stdlib
<companion_cube> @VPhantom sometimes "t last" works best with currying and |> though.
namkeleser has quit [Quit: Client closed]
<d_bot> <VPhantom> I do get a kick lately, of seeing how far I can go with just the Stdlib. And yes, first and last have special uses depending on what I'm doing. I tend to naturally place types first (for currying) and I/O references last (for piping).
<d_bot> <Patate> What do you mean by "t first" and "t last" aproach?
<d_bot> <Patate> is it something like
<d_bot> <Patate> apply : t -> f:(t-> unit) -> unit
<d_bot> <Patate> vs
<d_bot> <Patate> apply : f:(t-> unit) -> t -> unit
<d_bot> <Patate> ?
<companion_cube> yeah
<d_bot> <Patate> Oh ok
<companion_cube> e.g `Map.set: key -> 'a -> 'a t -> 'a t`
<companion_cube> so you can do `Map.empty |> Map.set 1 true |> Map.set 2 false |> Map.set 3 true`
<companion_cube> (if you have a int map)
<d_bot> <Patate> I see
<d_bot> <Ulugbek> Not particularly OCaml question, but I have a UDP socket that I send from and receive to a lot of packets in a short amount of time. I have a hypothesis that there is congestion in the socket because with logging turned on my application throughput goes much higher while with logging turned off the throughput is x100 less. I think that logging to stdout is taking time away from the sender and thus decreases the congestion.
<d_bot> <Ulugbek> Any idea on how to debug or solve such a problem?
<d_bot> <reynir> I have a `(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t` but I really want a `(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t`. Isn't there a way to reinterpret the bigarray? been staring at the docs for a while now
<d_bot> <darrenldl> @Ulugbek oh logging on sender? was really confused as i thought you meant logging on receiver
<companion_cube> @reynir I don't think you can have that, it'll always be a char array with a underlying int8
<d_bot> <Ulugbek> my application is a node in a decentralized system, where applications broadcast packets to each other
<companion_cube> (as far as I can tell)
<d_bot> <darrenldl> is your code async?
<d_bot> <Ulugbek> yes
<d_bot> <darrenldl> is it public?
waleee has joined #ocaml
<reynir> Hm okay
<reynir> now I'm frustrated :D
Guest8932 has quit [Ping timeout: 245 seconds]
Guest8932 has joined #ocaml
<d_bot> <Patate> I did not thought there would be a discord server dedicated to ocaml! This is pretty cool!
<d_bot> <VPhantom> I thought bigarrays could have different layouts applied to them? 🤔 With `genarray_of_array1` and co.
<d_bot> <VPhantom> Sorry I mean with `Bigarray.reshape`
<companion_cube> layouts yes, but the type vs underlying storage type are relatively fixed
<companion_cube> you can turn your thing into a 3D byte array if you want
<companion_cube> it'll still be `char`
<d_bot> <VPhantom> Ah yes I see they're matched in the signature. Bummer.
<d_bot> <Patate> Why do you need this @VPhantom ?
<companion_cube> you can go from char to int, but it means packing chars 4 by 4 or 8 by 8
<companion_cube> (so the result is 4 or 8× shorter)
<d_bot> <VPhantom> @Patate It's in reference to the question by @reynir and since I'm starting to learn how to do buffers and I/O with Bigarray I took an interest. 😉
<d_bot> <Patate> I am not sure this is what they wanted
<d_bot> <Patate> Oh yes, I mistook you for reynir ^^
<d_bot> <Patate> The goal is to see each int8_unsigned as an int instead of a char, am I right?
waleee has quit [Ping timeout: 240 seconds]
waleee has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Anarchos has joined #ocaml
waleee has quit [Ping timeout: 240 seconds]
waleee has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
jonasbits has quit [Ping timeout: 268 seconds]
bartholin has quit [Quit: Leaving]
<reynir> yea
kakadu has quit [Remote host closed the connection]
<reynir> well, I'm trying to use a bigarray from one API with another API, and one treats them as chars and the other as ints, but as far as I understand (and I don't understand bigarray very well) the underlying type in memory is 8bit unsigned ints
jonasbits has joined #ocaml
<Drup> reynir: there was a PR to add an operation to change the kind as you say
<Drup> something by gasche, iirc
<reynir> Ah
<reynir> curious what happened with that PR
Haudegen has joined #ocaml
<d_bot> <Patate> Oh ok, I understand better now
<d_bot> <Patate> There might be a hack to this, as after all they are both arrays of int8_unsigned internally... But I have no clue how to do it...
<d_bot> <EduardoRFS> Can pattern matching on a first class module change the type of an abstract type? Like it happens when matching on GADTs.
olle_ has quit [Ping timeout: 256 seconds]
<d_bot> <Patate> What do you mean by pattern matching a first class module?
zebrag has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
<d_bot> <octachron> Not currently, there are not type equation to introduce when pattern matching on a first class modules
<companion_cube> how are equations handled, internally? rewriting?
olle_ has joined #ocaml
<d_bot> <Alistair> Is there any documentation on how gadts are implemented?
<d_bot> <octachron> The current implementation works by adding a temporary expansion to an abstract type through the environment (which is why GADTs can only refine abstract types).
<d_bot> <octachron> I fear that the documentation are the few articles on the subject, the few comments in the code and the code itself.
<d_bot> <Alistair> I've read the ambivalent types paper, but it was rather unclear on a couple things and I was looking to see whether the code could clarify anything
vicfred has joined #ocaml
<d_bot> <hcarty> @reynir IIRC there was a post on the discuss forum showing how to use ctypes to cast bigarrays between different types but the same memory representation
<d_bot> <hcarty> https://discuss.ocaml.org/t/cast-bigarray-kind/8469/6 is the thread I was thinking of
Tuplanolla has joined #ocaml
<Corbin> https://news.ycombinator.com/item?id=29594762 is there any merit to this complaint? AFAICT they're just being tribal, but it would be nice to know about such issues.
gravicappa has quit [Ping timeout: 252 seconds]
<companion_cube> that's 100% bullshit
<Armael> this looks like standard HN shitposting? very few factual elements are being discussed there
<companion_cube> s/few/none/
<Leonidas> Corbin: well, that post doesn't factuate anything, really. "the way Haskell or Ocaml are built" means nothing
<Leonidas> Like, does the poster dislike the build system? the fact that they are both written in C? Who knows!
<companion_cube> you could replace by "python and php" and it'd be at least as accurate
<Leonidas> > They both have a single relevant implementation
<Leonidas> Which is true for nearly all languages.
<companion_cube> > OCaml is moving too fast
<companion_cube> lolllllolol
<Leonidas> Notable exceptions include Java (which has... like two relevant implementations) and maybe C/C++?
<Leonidas> Yes, the moving too fast thing is ridiculous
<Leonidas> > Ocaml lacks good docs
<Leonidas> This might be the possibly best substatiated claim but this is getting better.
<Leonidas> and honestly the ocaml manual is not much worse than the python manual.
rond_ has joined #ocaml
<Leonidas> so yeah, total shitposting
<d_bot> <Kakadu> > ... the language's functional programming style and clear expressiveness made it possible for code reviews to be performed by traders [from Janestreet] who were not programmers...
<d_bot> <Kakadu> Do you know how to factcheck this sentence from wikipedia? It could be true but I never heard about it before
<d_bot> <VPhantom> I have read it in posts by Yaron Minsky. Possibly the ACM post from way back, actually. Digging…
<d_bot> <VPhantom> Huh, I thought he said it in <https://queue.acm.org/detail.cfm?id=2038036> (2011) but I can't find the quote I have in mind in there. 🤔
Serpent7776 has quit [Quit: leaving]
cedric has joined #ocaml
waleee has quit [Ping timeout: 260 seconds]
waleee has joined #ocaml
vicfred has quit [Quit: Leaving]
Anarchos has quit [Ping timeout: 256 seconds]
cedric has quit [Quit: Konversation terminated!]
rond_ has quit [Quit: Client closed]
rgrinberg has joined #ocaml
rond_ has joined #ocaml
rond_ has quit [Quit: Client closed]
olle_ has quit [Ping timeout: 256 seconds]