companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.14.0 released: https://ocaml.org/releases/4.14.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Soni is now known as QueerDOVengeance
rgrinberg has joined #ocaml
chrisz has quit [Ping timeout: 256 seconds]
chrisz has joined #ocaml
<d_bot> <gorilacoding> Anyone have general tips on ocaml code optimization?
<d_bot> <gorilacoding> Thank you!
zebrag has quit [Quit: Konversation terminated!]
waleee has quit [Ping timeout: 260 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bobo has quit [Quit: Konversation terminated!]
Serpent7776 has joined #ocaml
motherfsck has quit [Quit: quit]
bartholin has joined #ocaml
Haudegen has joined #ocaml
olle has joined #ocaml
kaph has quit [Ping timeout: 246 seconds]
bartholin has quit [Quit: Leaving]
Anarchos has joined #ocaml
Nahra has joined #ocaml
dextaa has quit [Remote host closed the connection]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
kaph has joined #ocaml
gravicappa has joined #ocaml
dextaa has joined #ocaml
kaph has quit [Read error: Connection reset by peer]
kaph has joined #ocaml
Anarchos has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Anarchos has joined #ocaml
jlrnick has joined #ocaml
jlrnick has quit [Ping timeout: 248 seconds]
<mclovin> gorilacoding: if you can speak french: https://www.irill.org/videos/OUPS/2021-12/oups-dec21-chambart.html
kaph has quit [Remote host closed the connection]
kaph has joined #ocaml
emp has quit [Ping timeout: 246 seconds]
emp has joined #ocaml
spip has joined #ocaml
neiluj has joined #ocaml
<neiluj> Hi!
<neiluj> Is there a way to define a polymorphic function but restrained to types having access to a specific function ? For instance "let print_array ~label a = Printf.eprintf "%s = %s" label ((Array.map (fun e -> (to_string e) ^ "\n") a) |> Array.to_list |> String.concat "")
<neiluj> where a is an array of elements that can be converted to a string
<neiluj> sorry it's pretty vague
<neiluj> maybe adding a module as an argument having to_string in its signature and binding the module's abstract type t to the type of the elements of a?
<neiluj> if that makes sense
<mclovin> You could just add a `to_string` parameter to `print_array` ?
<neiluj> indeed, that's way simpler!
<neiluj> thanks
kaph has quit [Read error: Connection reset by peer]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
kaph has joined #ocaml
waleee has joined #ocaml
rgrinberg has joined #ocaml
Haudegen has quit [Ping timeout: 248 seconds]
Haudegen has joined #ocaml
spip has quit [Quit: Konversation terminated!]
Anarchos has joined #ocaml
quartz has joined #ocaml
infinity0 has quit [Ping timeout: 260 seconds]
jlrnick has joined #ocaml
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
<quartz> Hello. I'm having trouble compiling my code. The error I'm getting is: reference to unbound regexp name 'digit' on line 90 character 3. https://bpa.st/3JYQ
<d_bot> <NULL> You defined digit as OCaml value and not ocamllex "regexp" (apparently that's how they're called)
<quartz> What is OCaml value?
<d_bot> <NULL> A regular OCaml definition
<quartz> So I need to change line 90 to regexp digit+ as lem...
<quartz> Ahhh that does not work either
<d_bot> <NULL> I think your definitions in the preamble won't work, they need to be put in the ocamllex part
<d_bot> <NULL> I'm talking about digit letter whitespace and newline
<quartz> Lines 25 - 29?
bartholin has joined #ocaml
<d_bot> <NULL> Yes
<quartz> What do you mean by the 'ocamllex part'?
<d_bot> <NULL> After the closing }
<quartz> Hmmmm, OK
<quartz> Now it's telling me: "Error: unbound constructor DEDENT line 30
<quartz> I only defined it once... how can it be a problem?
<d_bot> <NULL> Is it defined in Parser ?
<quartz> Good question
<d_bot> <NULL> Where is it defined ?
<quartz> I'm not sure, I'll check the parser
spip has joined #ocaml
quartz has quit [Quit: WeeChat 3.4]
olle has quit [Ping timeout: 256 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jlrnick has quit [Ping timeout: 248 seconds]
rgrinberg has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Anarchos has joined #ocaml
neiluj has quit [Ping timeout: 248 seconds]
xgqt has quit [Read error: Connection reset by peer]
xgqt has joined #ocaml
neiluj has joined #ocaml
gravicappa has quit [Ping timeout: 268 seconds]
quartz has joined #ocaml
olle has joined #ocaml
<d_bot> <AZAH> Is there a Cheatsheet with all the List operations?
<d_bot> <AZAH> Like a pdf, with examples maybe
<d_bot> <NULL> Not a cheatsheet, but at least it's an exhaustive list
Nahra has quit [Remote host closed the connection]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Corbin> In any CAM, including OCaml, is it expected that the bytecode for folding over a list (starting at the nil-end of the list) will push a stack entry for every element in the list?
kaph has quit [Remote host closed the connection]
kaph has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
dextaa has quit [Ping timeout: 256 seconds]
neiluj has quit [Ping timeout: 260 seconds]
Haudegen has quit [Ping timeout: 272 seconds]
Haudegen has joined #ocaml
<zozozo> Corbin: assuming that fold_left is tail recursive (which it should), it should operate in constant stack space
neiluj has joined #ocaml
<zozozo> So if it pushes a stack entry for recursive calls, I'd expect that entry to replace the current one (which might be implemented as a pop then push, but I have no idea if it's a good idea, pour of it's implemented that way in the CAM)
wyrd has quit [Ping timeout: 240 seconds]
quartz has quit [Quit: WeeChat 3.4]
wyrd has joined #ocaml
bartholin has quit [Quit: Leaving]
<Corbin> zozozo: Curious. Using the labels in https://ocaml.org/api/List.html#1_Iterators, where the list's elements are [b1; b2; ...; bn], how is the list (not) unpacked onto the stack? Wouldn't each of the elements generate a pending stack frame?
<d_bot> <NULL> (Most of) those functions start from the top, so they follow the pointers and don't have to lay the list down in memory
Haudegen has quit [Ping timeout: 272 seconds]
Haudegen has joined #ocaml
<Corbin> NULL: That's interesting. Is there documentation on exactly how this works? I've been reading the CAM and ZINC papers, but haven't quite made it all come together.
Haudegen has quit [Ping timeout: 246 seconds]
<d_bot> <NULL> That's mostly my intuition about how tail-recursion-optimisation works out
neiluj has quit [Quit: Leaving]
<Corbin> Hm. Still puzzled. A list [b1; b2; ...; bn] would be constructed as (cons bn (cons ... (cons b2 (cons b1 (nil))) ... )). So, in a CAM, if we wanted to deconstruct the list, then the only cell we can access first is bn. Accessing the other cells would require pushing the intermediate cells to the stack, I think?
<d_bot> <NULL> OCaml lists are prepended, not appended
<d_bot> <NULL> `[b1; b2; ...; bn]` is `b1 :: b2 :: ... :: bn :: []`
<Corbin> Oh! Okay. For some reason I got convinced that ZINC derivatives like OCaml were the other way around in memory. Well, that's one fewer mystery, thanks.
kaph has quit [Read error: Connection reset by peer]
olle has quit [Ping timeout: 246 seconds]