companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.2.0 released: https://ocaml.org/releases/5.2.0 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
pi3ce has joined #ocaml
raskol has quit [Ping timeout: 248 seconds]
<discocaml> <deepspacejohn> You can use String.to_seq to match on individual characters in a functional manner, similar to a list.
<discocaml> <qrpnxz> Unlike Haskell, these are just bytes though. If you want Unicode scalar values, you'll have to roll your own stream using the `Uchar` module.
pi3ce has quit [Ping timeout: 260 seconds]
pi3ce has joined #ocaml
<discocaml> <darrenldl> i am guilty of converting string to char list unless it's a bottlenecking region of the code : v
<discocaml> <darrenldl> actually no, i do that more for ad hoc command parsing where you have a list of words
<discocaml> <darrenldl> for char i think it reaches into angstrom territory, which isn't too bad
<discocaml> <darrenldl> how long is your string?
raskol has joined #ocaml
<dh`> I have a thing that converts string to int list after decoding utf-8 :-|
<dh`> can't remember why I didn't use list uchar, I think uchar didn't seem to offer much
<discocaml> <bpjennierose> Hi anyone available to help?
<dh`> just ask your question, don't ask to ask
<dh`> asking to ask produces either silence or facetious "no" responses
neuroevolutus has joined #ocaml
Serpent7776 has joined #ocaml
bartholin has joined #ocaml
neuroevolutus has quit [Quit: Client closed]
cr1901_ has joined #ocaml
cr1901 has quit [Ping timeout: 260 seconds]
bartholin has quit [Quit: Leaving]
toastal has joined #ocaml
toastal has left #ocaml [#ocaml]
toastal has joined #ocaml
quernd805 has joined #ocaml
quernd80 has quit [Ping timeout: 244 seconds]
quernd805 is now known as quernd80
alexherbo2 has joined #ocaml
<discocaml> <gooby_clown> Sirppi: It's less about instructions and more about language semantics. "Smart" language usually means it has a lot of case-per-case semantics, which overall makes it hard for you as a programmer to express your intent because you need to think about what the language will do in this or that situation. This is generally why we try to have simple and general interfaces whenever possible, be that a language or an API
gentauro has quit [Ping timeout: 255 seconds]
reynir has quit [Ping timeout: 260 seconds]
p4bl0 has joined #ocaml
reynir has joined #ocaml
<p4bl0> hello all, I have a question about the possibility in OCaml to use the same constructor name in two different types. Since when is that possible and what was the motivation to allow it?
gentauro has joined #ocaml
<p4bl0> (I asked the same question on Reddit but got no answer as of yet: https://www.reddit.com/r/ocaml/comments/1gb11uz/same_constructor_name_for_different_types/)
<p4bl0> (ah, there's been a comment on Reddit, but it doesn't really answer my questions)
leah2 has quit [Ping timeout: 244 seconds]
<p4bl0> and now there's an answer: it was introduced in 4.01 with the idea that "keeping shared and concise names across types can be worth the price of adding a handful of type annotation"
<octachron> Please don't repeat comments accross medium, having a split discussion is already annoying enough
f[x] has joined #ocaml
leah2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
<p4bl0> I felt like asking here and not telling here that I had my answer elsewhere would be rude, but okay
alexherbo2 has joined #ocaml
leah2 has quit [Quit: Sprechen Sie noch? Wird noch gesprochen? Ich trenne.]
leah2 has joined #ocaml
leah2 has quit [Ping timeout: 252 seconds]
bartholin has joined #ocaml
Phandal_ has joined #ocaml
Phandal_ has quit [Client Quit]
leah2 has joined #ocaml
user__ has joined #ocaml
f[x] has quit [Remote host closed the connection]
Exa has quit [Quit: see ya!]
ddakx has joined #ocaml
Exa has joined #ocaml
ddakx has quit [Quit: leaving]
<companion_cube> the motivation is that it's a pain to prefix every constructor and field name
alexherbo2 has quit [Remote host closed the connection]
<discocaml> <yawaramin> this ☝️
gooby323 has joined #ocaml
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
Serpent7776 has quit [Ping timeout: 260 seconds]
gooby323 has quit [Quit: Konversation terminated!]
neiluj has joined #ocaml
<neiluj> Hi! Is it possible to not open globally the Stdlib? some variant names are clashing with modules from the stdlib in my app
<octachron> modules and constructor variants live in a different name spaces,there names cannot clash.
<octachron> and normally local modules have a higher priority and shadow Stdlib modules
gooby323 has joined #ocaml
cr1901_ is now known as cr1901
Tuplanolla has joined #ocaml
<gooby323> I could benchmark myself, but in case it has already been looked into, does emitting unnecessary effects (unnecessary in the sense they are handled trivially) affect performance by a noticeable degree?
semarie has quit [Quit: WeeChat 4.4.2]
<neiluj> thx octachron
semarie has joined #ocaml
spew has joined #ocaml
contificate has joined #ocaml
<contificate> gooby323: I shouldn't expect so. You should consult the "retrofitting" paper, where I think they have measurements. I believe when you raise an effect, it must traverse the links to find the correct fiber with the corresponding handler (?) which is a linear operation. In practice though, the depth of the linked fibers is apparently very low.
<gooby323> contificate: ah I see, cheers, I'll check out the paper as well
<contificate> The "handled trivially" part is kind of enforced in that the continuations are one-shot, which has major benefit in avoiding copying frames. I believe it just relinks the to the parent and pivots the stack.
<companion_cube> oh look at that, contificate going for the greybeard points :p
<companion_cube> welcome to IRC m8
<contificate> Direct implementations of multi-shot control tend to be implemented whereby "shift" actually is shifting frames to the heap, such that they can be reinstated at arbitrary points (when k is invoked - which is a higher-order function in some impls, and can be stored, applied, etc. several times).
neiluj has quit [Ping timeout: 245 seconds]
<contificate> I'm actually only posting via IRC because I'm still in the office. They seem to disallow IRC, so I'm on web.libera.
gareppa has joined #ocaml
contificate has quit [Quit: Client closed]
toastal has left #ocaml [Error from remote client]
contificate has joined #ocaml
<gooby323> I propose that the OCaml community shifts to XMPP, where we can have the features of a modern chat application, while not being on a proprietary platform (the D-word)
<contificate> Don't IRC users use some kind of self-bot to have message history etc.? That's the part that kind of annoys me about IRC, it's all very ephemeral.
<gooby323> cube iirc just stays connected to here 24/7 for the history, some channels have web history that you can access externally, I just hate the ad-hoc aspect of it
<discocaml> <deepspacejohn> isn't there an OCaml matrix chat?
<gooby323> There might be but I think I prefer XMPP, Matrix seems less federated than it claims
<contificate> IRC just isn't good for sharing code snippets
<gooby323> I heard there was a never version of IRC that supposedly has more features, but I don't remember hearing of anyone actually using it
contificate has quit [Quit: Client closed]
<discocaml> <moe00732> IRCv3 iirc
neiluj has joined #ocaml
neiluj has quit [Client Quit]
<gooby323> Right that's the one, but you realise eventually that the userbase is mostly what gives value to a chat platform, a perfect platform is useless if you haven't got the people you want to talk to there :(
gooby323 has quit [Quit: Konversation terminated!]
user__ has quit [Remote host closed the connection]
Anarchos has joined #ocaml
<discocaml> <bbatsov> True that!
gooby323 has joined #ocaml
Serpent7776 has joined #ocaml
gooby323 has quit [Quit: Konversation terminated!]
neiluj has joined #ocaml
<neiluj> Hi! When building a library with C stubs with flambda on arm64, errors like these ones appear: /tmp/build_6c52ed_dune/camlasm277de9.s:339278:16: error: index must be an integer in range [-256, 255].
<neiluj> str x30, [sp, #48952]
<neiluj> does that ring a bell?
gooby323 has joined #ocaml
neiluj has quit [Ping timeout: 245 seconds]
spew has quit [Ping timeout: 260 seconds]
spew has joined #ocaml
<discocaml> <baptiste.exe> rate my code /10 let rec f l =
<discocaml> <baptiste.exe> if l = [] then []
<discocaml> <baptiste.exe> else if List.tl l = [] then [[List.hd l]]
<discocaml> <baptiste.exe> else
<discocaml> <baptiste.exe> let a = List.hd l in
<discocaml> <baptiste.exe> let b = List.hd (List.tl l) in
<discocaml> <baptiste.exe> if a < b then
<discocaml> <baptiste.exe> let rest = f (List.tl l) in
<discocaml> <baptiste.exe> (a :: List.hd rest) :: List.tl rest
<discocaml> <baptiste.exe> else
<discocaml> <baptiste.exe> [[a]] @ f (List.tl l)
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe> let rec longueurmax l =
<discocaml> <baptiste.exe> let x = f l in
<discocaml> <baptiste.exe> if x = [] then 0
<discocaml> <baptiste.exe> else
<discocaml> <baptiste.exe> let a = longueurmax (List.tl l) in
<discocaml> <baptiste.exe> max (List.length (List.hd x)) a
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe> let rec maxcroissante l =
<discocaml> <baptiste.exe> let x = f l in
<discocaml> <baptiste.exe> let longeur_max = longueurmax l in
<discocaml> <baptiste.exe> if x = [] then []
<discocaml> <baptiste.exe> else if (List.length (List.hd x)) = longeur_max then List.hd x
<discocaml> <baptiste.exe> else maxcroissante (List.tl l)
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe>
<discocaml> <._null._> Don't paste blocks of code in this channel
<discocaml> <baptiste.exe> rate my code```/10 let rec f l =
<discocaml> <baptiste.exe> if l = [] then []
<discocaml> <baptiste.exe> else if List.tl l = [] then [[List.hd l]]
<discocaml> <baptiste.exe> else
<discocaml> <baptiste.exe> let a = List.hd l in
<discocaml> <baptiste.exe> let b = List.hd (List.tl l) in
<discocaml> <baptiste.exe> if a < b then
<discocaml> <baptiste.exe> let rest = f (List.tl l) in
<discocaml> <baptiste.exe> (a :: List.hd rest) :: List.tl rest
<discocaml> <baptiste.exe> else
<discocaml> <baptiste.exe> [[a]] @ f (List.tl l)
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe> let rec longueurmax l =
<discocaml> <baptiste.exe> let x = f l in
<discocaml> <baptiste.exe> if x = [] then 0
<discocaml> <baptiste.exe> else
<discocaml> <baptiste.exe> let a = longueurmax (List.tl l) in
<discocaml> <baptiste.exe> max (List.length (List.hd x)) a
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe> let rec maxcroissante l =
<discocaml> <baptiste.exe> let x = f l in```
<discocaml> <baptiste.exe> let longeur_max = longueurmax l in
<discocaml> <baptiste.exe> if x = [] then []
<discocaml> <baptiste.exe> else if (List.length (List.hd x)) = longeur_max then List.hd x
<discocaml> <baptiste.exe> else maxcroissante (List.tl l)
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe>
<discocaml> <baptiste.exe> sorry
<discocaml> <._null._> Don't edit either
gareppa has quit [Quit: WeeChat 4.1.1]
raskol has quit [Ping timeout: 252 seconds]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Everything has joined #ocaml
cr1901 has quit [Quit: Leaving]
Anarchos has joined #ocaml
cr1901 has joined #ocaml
Serpent7776 has quit [Ping timeout: 252 seconds]
bartholin has quit [Quit: Leaving]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Anarchos has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Anarchos has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
gooby323 has quit [Quit: Konversation terminated!]
Anarchos has joined #ocaml
Everything has quit [Quit: leaving]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
motherfsck has quit [Read error: Connection reset by peer]
motherfsck has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]