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/
Soni has quit [Ping timeout: 248 seconds]
rwmjones has quit [Ping timeout: 268 seconds]
rwmjones has joined #ocaml
perrierjouet has joined #ocaml
rwmjones_ has joined #ocaml
rwmjones has quit [Ping timeout: 240 seconds]
Haudegen has quit [Ping timeout: 268 seconds]
lisbeths has joined #ocaml
Soni has joined #ocaml
azimut has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
azimut has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chrisz has quit [Ping timeout: 260 seconds]
chrisz has joined #ocaml
rgrinberg has joined #ocaml
waleee has quit [Ping timeout: 256 seconds]
genpaku has quit [Remote host closed the connection]
deadmarshal has quit [Remote host closed the connection]
genpaku has joined #ocaml
Techcable has quit [Ping timeout: 268 seconds]
mbuf has joined #ocaml
deadmarshal has joined #ocaml
troydm has quit [Ping timeout: 268 seconds]
xd1le has joined #ocaml
bgs has joined #ocaml
Techcable has joined #ocaml
Haudegen has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bgs has quit [Remote host closed the connection]
lisbeths has quit [Quit: Connection closed]
troydm has joined #ocaml
Serpent7776 has joined #ocaml
random-jellyfish has joined #ocaml
jao has quit [Ping timeout: 260 seconds]
calvnce has joined #ocaml
mro has joined #ocaml
hsw_ has joined #ocaml
hsw has quit [Ping timeout: 248 seconds]
Serpent7776 has quit [Ping timeout: 240 seconds]
calvnce has quit [Quit: Ping timeout (120 seconds)]
random-jellyfish has quit [Quit: Client closed]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Ping timeout: 240 seconds]
mro has joined #ocaml
spip has quit [Read error: Connection reset by peer]
spip has joined #ocaml
Serpent7776 has joined #ocaml
mro has quit [Ping timeout: 268 seconds]
keyboard has joined #ocaml
mro has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
dnh has joined #ocaml
mro has quit [Remote host closed the connection]
rwmjones_ is now known as rwmjones
mro has joined #ocaml
calvnce has joined #ocaml
mro has quit [Quit: Leaving...]
neiluj has joined #ocaml
<neiluj> Hello! How do you get a pointer to the i-th array for an array of arrays? because matrix.(i) gives the i-th row, not a pointer to the rows starting from index i
calvnce has quit [Ping timeout: 260 seconds]
olle has joined #ocaml
szkl has quit [Quit: Connection closed for inactivity]
<neiluj> hmm, going to use bigstrings
bartholin has joined #ocaml
random-jellyfish has joined #ocaml
bartholin has quit [Quit: Leaving]
calvnce has joined #ocaml
wingsorc has quit [Ping timeout: 240 seconds]
calvnce has quit [Ping timeout: 260 seconds]
calvnce has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
<Fardale> neiluj: there is not really pointer in OCaml. What do you want to do with such pointer?
<neiluj> just to share the reading of a buffer to some processes, hence they need a pointer to a given segment of the buffer
<neiluj> bu now I'm switching to bigarrays
<neiluj> speaking of which, what is the representation of the type 'b supposed to be in https://v2.ocaml.org/api/Bigarray.Genarray.html?
<neiluj> what is the difference between type 'a and 'b? is it possible to assign to 'a an abstract type? maybe not for 'b?
<neiluj> it also seems that bigstringaf does some operations faster like blit, also exposes memcmp... but works only for 1D byte arrays, which can't be casted to 'a elements without using Obj.magic
<sim642> You can see the point of 'b here: https://v2.ocaml.org/api/Bigarray.html#TYPEkind
<sim642> Basically, multiple low-level types can map to the same Ocaml type
<neiluj> thanks! so you can only choose between the types that are already provided by the GADT?
<neiluj> like Char,Int,...
<neiluj> for instance what if 'a has a representation that require N chars?
<neiluj> will 'b=Char suffice?
<sim642> You can't actually arbitrarily choose them
<neiluj> "Bigarrays can only contain integers and floating-point numbers" so no you're limited to these types
<neiluj> okay then I'll select byte arrays and add some C bindings for the getter and setter
<neiluj> is it really worth it to use multidimensional arrays provided by Bigarray instead of handling it yourself?
<neiluj> seems easy enough, wondering about possible performance gains (wrt. cache usage)
<sim642> Pretty sure you'd just be duplicating functionality that's already there
<neiluj> yeah, let's not reinvent the wheel!
<neiluj> thanks again :)
<neiluj> no need for C stubs, you can get the bytes that you need with the bigarray .{} syntax, then collect them and get your bytes :)
<neiluj> may be way less efficient than a memcpy with the right offset though
<sim642> How would memcpy help though? You'd still need to convert the N bytes to your whatever OCaml type 'a
<neiluj> no the representation of 'a is just a sequence of N bytes
Haudegen has joined #ocaml
<sim642> I think you can just take 1D slices out of a 2D array then
<sim642> it might not even copy anything, just remember the offset pointer internally
<neiluj> exactly
<neiluj> but then i'd have to get each byte of the slice, and concatenate them
<sim642> Why? The slice already directly represents those bytes
<neiluj> oh then I misunderstood. What is a slice? is it an ocaml type?
<sim642> I just mean Bigarray.Array2.slice_left
<sim642> That's just an Array1
<neiluj> oh didn't know that! but is there a way to cast it to bytes without an extra allocation?
<neiluj> that's what I meant by collecting the bytes of the slice to form a byte sequence Bytes.t
<sim642> That probably requires an inevitable copy indeed
<neiluj> but yeah, slice_left is neat! to bad you have to get each element of a slice in this case...
<sim642> You might be able to use the bigstringaf package though
<sim642> It seems to provide some low-level C implementations for char bigarray and string/bytes conversions
<neiluj> good point! indeed there is blit_to_bytes
<neiluj> happy customer :)
hsw has joined #ocaml
hsw_ has quit [Ping timeout: 260 seconds]
<olle> s
<olle> oops
random-jellyfish has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
hackinghorn has quit [Ping timeout: 255 seconds]
gwizon has quit [Remote host closed the connection]
bgs has joined #ocaml
waleee has joined #ocaml
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mro has joined #ocaml
Tuplanolla has joined #ocaml
hackinghorn has joined #ocaml
TakinOver has quit [Remote host closed the connection]
TakinOver has joined #ocaml
neiluj has quit [Quit: WeeChat 3.6]
foocraft has joined #ocaml
mro has quit [Remote host closed the connection]
olle has quit [Remote host closed the connection]
bgs has quit [Remote host closed the connection]
Haudegen has quit [Quit: Bin weg.]
gwizon has joined #ocaml
mro has joined #ocaml
mro has quit [Quit: Leaving...]
Serpent7776 has quit [Quit: WeeChat 1.9.1]
jao has joined #ocaml
mbuf has quit [Quit: Leaving]
xd1le has quit [Quit: xd1le]
bartholin has joined #ocaml
Haudegen has joined #ocaml
rgrinberg has joined #ocaml
olle has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mro has joined #ocaml
gwizon has quit [Quit: Lost terminal]
rgrinberg has joined #ocaml
mro has quit [Remote host closed the connection]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
foocraft has quit [Quit: Leaving]
rgrinberg has joined #ocaml
motherfsck has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
calvnce has quit [Ping timeout: 260 seconds]
bobo_ has joined #ocaml
spip has quit [Ping timeout: 256 seconds]
rgrinberg has joined #ocaml
jao has quit [Remote host closed the connection]
jao has joined #ocaml
azimut_ has quit [Ping timeout: 255 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wingsorc has joined #ocaml
olle has quit [Ping timeout: 256 seconds]
rgrinberg has joined #ocaml
bartholin has quit [Quit: Leaving]
Haudegen has quit [Ping timeout: 240 seconds]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]