companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.0 released(!!1!): https://ocaml.org/releases/5.0.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
czy has quit [Ping timeout: 255 seconds]
Tuplanolla has quit [Quit: Leaving.]
waleee has quit [Ping timeout: 240 seconds]
wingsorc has quit [Ping timeout: 245 seconds]
chrisz has quit [Ping timeout: 255 seconds]
chrisz has joined #ocaml
david2 has joined #ocaml
david2 has quit [Client Quit]
average has joined #ocaml
azimut has quit [Ping timeout: 252 seconds]
average has quit [Quit: Connection closed for inactivity]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
azimut has joined #ocaml
bartholin has joined #ocaml
bartholin has quit [Quit: Leaving]
Serpent7776 has joined #ocaml
azimut has quit [Ping timeout: 252 seconds]
mro has joined #ocaml
palainp has joined #ocaml
keyle has joined #ocaml
<discocaml> <codebycc> Hi everyone I’m still experiencing troubles making on making contributions is anyone open to a zoom call or something to help me out
dnh has joined #ocaml
ec has quit [Ping timeout: 252 seconds]
ec has joined #ocaml
quernd809 has joined #ocaml
quernd80 has quit [Ping timeout: 264 seconds]
quernd809 is now known as quernd80
average has joined #ocaml
yziquel has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
waleee has joined #ocaml
bartholin has joined #ocaml
average has quit [Quit: Connection closed for inactivity]
infinity0 is now known as Guest8761
Guest8761 has quit [Killed (iridium.libera.chat (Nickname regained by services))]
infinity0 has joined #ocaml
omegatron has quit [Quit: Power is a curious thing. It can be contained, hidden, locked away, and yet it always breaks free.]
azimut has joined #ocaml
habnabit_ has quit [Quit: ZNC - http://znc.sourceforge.net]
habnabit_ has joined #ocaml
waleee has quit [Ping timeout: 272 seconds]
yziquel has quit [Quit: Client closed]
mro has quit [Ping timeout: 240 seconds]
Tuplanolla has joined #ocaml
waleee has joined #ocaml
waleee has quit [Ping timeout: 260 seconds]
waleee has joined #ocaml
<discocaml> <kumnadin_31037> hi everyone i am call kum nadin i will please like to work on this project in Ocaml impliment a dark mode for ocaml.org. sorry for coming inn late😆
waleee has quit [Ping timeout: 255 seconds]
waleee has joined #ocaml
mro has joined #ocaml
mro has quit [Ping timeout: 255 seconds]
mro has joined #ocaml
mro has quit [Ping timeout: 240 seconds]
mro has joined #ocaml
nulloranje has joined #ocaml
nulloranje has quit [Client Quit]
azimut has quit [Quit: ZNC - https://znc.in]
azimut has joined #ocaml
bartholin has quit [Quit: Leaving]
<discocaml> <barconstruction> I am trying to solve an exercise.
<discocaml> <barconstruction> It is not for a class, it is for my own edification.
<discocaml> <barconstruction> ```
<discocaml> <barconstruction> type 'a tree = Node of ('a * (('a tree) list))
<discocaml> <barconstruction> let map f = function
<discocaml> <barconstruction> | Node (x, c) -> (Node (f x), List.map (map f) c)
<discocaml> <barconstruction> ```
<discocaml> <barconstruction> I hope it is clear what this code does.
<discocaml> <barconstruction> It just applies the function `f` to every element in the tree.
<discocaml> <barconstruction> `map : ('a -> 'b) -> 'a tree -> 'b tree`
<discocaml> <Kali> you need `rec` after `let`, or `map` will be unbound in its body
<discocaml> <barconstruction> oh yeah lol
<discocaml> <barconstruction> ```
<discocaml> <barconstruction> type 'a tree = Node of ('a * (('a tree) list))
<discocaml> <barconstruction> let rec map f = function
<discocaml> <barconstruction> | Node (x, c) -> (Node (f x), List.map (map f) c)
<discocaml> <barconstruction> ```
<discocaml> <barconstruction> anyway
<discocaml> <Kali> just a note, edits here resend on the irc side— use #beginners for help
<discocaml> <Kali> your parentheses are also wrong, it should be `Node ((f x), List.map (map f) c)`
<discocaml> <barconstruction> The challenge is to implement this in a stack safe way for deep trees.
<discocaml> <barconstruction> I have thought of two ways of doing this.
<discocaml> <barconstruction> One involves keeping a fairly complicated accumulator using a list which contains the elements of the tree in reverse topological order, together with a map or similar data structure which keeps track of each node's parent.
<discocaml> <barconstruction> This I am pretty sure I can do but it seems ugly.
<discocaml> <barconstruction>
<discocaml> <barconstruction> The second solution would be to use continuation passing style. This seems like it could be more elegant, but I can't figure out how to do it.
<discocaml> <barconstruction> I would like a hint or suggestion as to how it is implemented.
<discocaml> <barconstruction> yeah sorry discord doesn't have syntax highlighting or merlin or whatever.
<discocaml> <Kali> it does, though: use \`\`\`ocaml rather than just \`\`\`
<discocaml> <barconstruction> oh that's neat.
<discocaml> <Kali> let's move to #beginners
dh` has joined #ocaml
mro has quit [Quit: Leaving]
mro has joined #ocaml
micro_ has quit [Ping timeout: 248 seconds]
mro has quit [Quit: Leaving]
micro has joined #ocaml
<discocaml> <Et7f3 (@me on reply)> but you want to translate to what ? another human language for article ? or you want to migrate from php ? I know a tool for the opposite https://github.com/jordwalke/rehp
<h0rror> 5.1.0 has been out for some weeks, the topic should be updated :)
Serpent7776 has quit [Ping timeout: 255 seconds]
dnh_ has joined #ocaml
dnh has quit [Ping timeout: 264 seconds]
dnh_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<src> I expected to run out of stack space with regards to the `take` function, but I don't when I run this in utop... are both functions somehow tail recurisve by chance?
<src> (I didn't really set out to write them tail recursive, I just wrote them and no they work w/out running out of stack space, so I'm surprised...)
<src> s/no/now
waleee has quit [Ping timeout: 255 seconds]
chrisz has quit [Ping timeout: 264 seconds]
chrisz has joined #ocaml