<shamelessshill>
Hello folks, newbie to OCaml here ... have some sample code that I've been playing with (binary search tree) - https://paste.rs/NY8.ml
<shamelessshill>
I have marked the specific question in the commments `(* HERE ... *)` for the function `print_dict_entry`.
<shamelessshill>
So, my question is - how do I make a type generically printable? In Haskell, I could slap on a typeclass, but there are not typeclasses in OCaml, right? Searching online mentioned something about modules, but I haven't reached there yet. (Note that I'm only using the stdlibg that caomes bundled with the OCaml distro for now).
<shamelessshill>
any simple way, or simply wait till I learn about modules?
<shamelessshill>
(for now, since I'm using key value pairs of type int x string for my tree, I can make do with `print_int`, but that's a very bad hack, of course.)
<waleee>
not sure about the default stdlib but you probably have something in base or core for deriving printing stuff
<shamelessshill>
waleee: Ah, I see. Thank you!
shamelessshill has left #ocaml [#ocaml]
chrisz has quit [Ping timeout: 252 seconds]
chrisz has joined #ocaml
jao has quit [Ping timeout: 268 seconds]
nd__ has joined #ocaml
troydm has quit [Ping timeout: 252 seconds]
motherfsck has quit [Ping timeout: 268 seconds]
nd__ has quit [Ping timeout: 265 seconds]
mbuf has joined #ocaml
motherfsck has joined #ocaml
waleee has quit [Remote host closed the connection]
waleee has joined #ocaml
Techcable has quit [Ping timeout: 256 seconds]
Techcable has joined #ocaml
waleee has quit [Ping timeout: 252 seconds]
motherfsck has quit [Ping timeout: 252 seconds]
troydm has joined #ocaml
azimut has joined #ocaml
nd__ has joined #ocaml
nd__ has quit [Ping timeout: 272 seconds]
shamelessshill has joined #ocaml
Haudegen has joined #ocaml
bgs has joined #ocaml
shamelessshill has quit [Quit: leaving]
troydm has quit [Ping timeout: 272 seconds]
nd__ has joined #ocaml
trev has joined #ocaml
motherfsck has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
nd__ has quit [Ping timeout: 252 seconds]
azimut has joined #ocaml
azimut has quit [Remote host closed the connection]
bgs has quit [Remote host closed the connection]
azimut has joined #ocaml
nd__ has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
mro has joined #ocaml
bgs has joined #ocaml
nd__ has quit [Ping timeout: 272 seconds]
bgs has quit [Remote host closed the connection]
motherfsck has quit [Ping timeout: 252 seconds]
Serpent7776 has joined #ocaml
bartholin has joined #ocaml
troydm has joined #ocaml
nd__ has joined #ocaml
hsw has quit [Quit: Leaving]
hsw has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
olle has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
bartholin has quit [Quit: Leaving]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mbuf has quit [Read error: Connection reset by peer]
mbuf has joined #ocaml
azimut has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.7.1]
perrierjouet has joined #ocaml
mro has quit [Remote host closed the connection]
shamelessshill has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
keyboard has joined #ocaml
xd1le has quit [Quit: xd1le]
mbuf has quit [Ping timeout: 272 seconds]
mbuf has joined #ocaml
spip has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
<Leonidas>
Is there a function in the C FFI that allows me to copy a string from C but also specify a length?
<Leonidas>
I see caml_copy_string but that presumably stops at the first \0
<Leonidas>
Ah, caml_alloc_initialized_string seems to do the job
wingsorc has quit [Ping timeout: 256 seconds]
keyboard has quit [Ping timeout: 256 seconds]
azimut has joined #ocaml
shamelessshill has quit [Quit: leaving]
bgs has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
azimut has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
x22x22x has quit [Ping timeout: 252 seconds]
troydm has quit [Ping timeout: 252 seconds]
Haudegen has joined #ocaml
alexherbo2 has joined #ocaml
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #ocaml
jao has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
motherfsck has joined #ocaml
mro has joined #ocaml
mro has quit [Read error: Connection reset by peer]
mro has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
Haudegen has quit [Quit: Bin weg.]
alexherbo2 has joined #ocaml
troydm has joined #ocaml
alexherbo2 has quit [Ping timeout: 260 seconds]
nd__ has quit [Ping timeout: 246 seconds]
Tuplanolla has joined #ocaml
mro has quit [Remote host closed the connection]
nd__ has joined #ocaml
mro has joined #ocaml
nd__ has quit [Ping timeout: 272 seconds]
nd__ has joined #ocaml
mro has quit [Ping timeout: 246 seconds]
nd__ has quit [Ping timeout: 252 seconds]
mro has joined #ocaml
nd__ has joined #ocaml
Haudegen has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mbuf has quit [Quit: Leaving]
nd__ has quit [Ping timeout: 255 seconds]
nd__ has joined #ocaml
nd__ has quit [Ping timeout: 256 seconds]
nd__ has joined #ocaml
nd__ has quit [Client Quit]
azimut has joined #ocaml
jao has quit [Ping timeout: 272 seconds]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Ping timeout: 260 seconds]
jao has joined #ocaml
VY2 has joined #ocaml
olle has quit [Ping timeout: 260 seconds]
waleee has joined #ocaml
mro_ has joined #ocaml
mro has quit [Ping timeout: 255 seconds]
waleee has quit [Ping timeout: 260 seconds]
waleee has joined #ocaml
mro_ has quit [Read error: Connection reset by peer]