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/
Tuplanolla has quit [Quit: Leaving.]
spip has quit [Quit: Konversation terminated!]
Stumpfenstiel has quit [Ping timeout: 265 seconds]
<discocaml> <masterbuilder> Are there any downsides to using Bigarray.Genarray instead of a Bigarray with specific dimensions?
<discocaml> <masterbuilder> and if so what's the best way to map a file to a specific type of Bigarray? since Unix.map_file returns a Genarray
oriba has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
masterbuilder has quit [Quit: Lost terminal]
masterbuilder has joined #ocaml
wingsorc has quit [Remote host closed the connection]
wingsorc has joined #ocaml
wingsorc has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 255 seconds]
wingsorc has joined #ocaml
chrisz has quit [Ping timeout: 252 seconds]
chrisz has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
trillion_exabyte has quit [Ping timeout: 255 seconds]
azimut_ has joined #ocaml
trillion_exabyte has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
trev has joined #ocaml
Techcable has quit [Ping timeout: 250 seconds]
bartholin has joined #ocaml
<discocaml> <lukstafi> In principle yes, but in practice? From taking a look at the code I don't remember specific optimizations, but would welcome to stand corrected.
Techcable has joined #ocaml
Haudegen has joined #ocaml
trev has quit [Remote host closed the connection]
Tuplanolla has joined #ocaml
neiluj has joined #ocaml
<neiluj> Hello! So I'm writing some bindings to a C library were most inputs/outputs of the functions are a special "recursive" type GEN (which is a pointer to long to have kind of an array of adresses to GEN objects), allowing for some kind of genericity (in this case, you can thus have polynomials (GEN) with coefficients in a special field or whatever (of type GEN). So the bindings are not type safe in
<neiluj> that you could compose objects to build nonsensical mathematical objects.
<neiluj> How would you design a type safe wrapper over these bindings
<neiluj> thought about GADTs to have a single type for all GEN objects but it might be overkill
<neiluj> *where
spip has joined #ocaml
<neiluj> either have a type for each kind of GEN type, or a single sum type for all GEN types, or even a GADT where each constructor maps to a function between subtypes (so a DSL I suppose?) and have an evaluation function
<neiluj> the last approach might be too heavy
olle has joined #ocaml
Serpent7776 has joined #ocaml
genpaku has quit [Read error: Connection reset by peer]
genpaku has joined #ocaml
wingsorc has quit [Ping timeout: 246 seconds]
wingsorc__ has joined #ocaml
amk_ has joined #ocaml
amk has quit [Read error: Connection reset by peer]
amk_ is now known as amk
amk has quit [Remote host closed the connection]
amk has joined #ocaml
horninghack has quit [Ping timeout: 246 seconds]
Anarchos has joined #ocaml
<adrien> I'm sorry to sin and to Obj.magic a queue into a list but it's really much faster
<Anarchos> adrien :)
<adrien> the wonderful thing is that once you've done that, your list updates as you push to the queue
<Anarchos> adrien don't we have double side linked list ? We could cons at top or end of the list
<discocaml> <masterbuilder> I see, so is there a way to convert a Genarray into a flat 1D array for example?
<discocaml> <masterbuilder> or is there a library that offers map_file but without the genericity
<adrien> queue to list through Obj.magic is really an exception for conversions: I'm actually not entirely sure how it works
<adrien> (I thought I was sure, and now I'm not sure anymore)
<adrien> when you say flat 1D array, what would be the type of the elements?
<discocaml> <froyo> adrien:
<zozozo> adrien: that's a really bad idea, because the conversation "lies" about the mutability of things
<zozozo> Even if a queue's cell structure shares the same representation than lists
<adrien> zozozo: I know all guarantees disappear; I was mostly trying to see the cost of a million prepends + rev
<discocaml> <masterbuilder> 32 bit int for example
<discocaml> <masterbuilder> I mean aren't you already asking Genarray to try to create an array with specific dimensions and it will fail if it can't? So in theory you could have a bunch of functions like `map_file_array1` etc., and I think no-op conversions for Bigarrays wouldn't be dubious at all, right?
Anarchos has quit [Ping timeout: 255 seconds]
<neiluj> emacs (tuareg mode) is so slow with a 7000LOC file :'(
<neiluj> how do you fix it?
<discocaml> <masterbuilder> neiluj: are you using native-comp?
<discocaml> <masterbuilder> also wow what file is that? 7K is too much for my taste, I draw the line at 1K personally
<neiluj> yes pgtk+nativecomp
<neiluj> 7K because it's C bindings
<discocaml> <masterbuilder> I see
<neiluj> maybe split the Ctypes functor into several ones?
<discocaml> <masterbuilder> Yeah probably a good idea
<neiluj> so it's a known issue of native comp?
<neiluj> (thanks by the way for pointing this out)
<discocaml> <masterbuilder> No I have definitely opened larger files than that before, not in tuareg-mode though, it may be a little slow to start up but then fine after that
<discocaml> <masterbuilder> So maybe an issue with tuareg-mode or if you use lsp maybe it's slowness on the lsp side
<neiluj> hmm good idea lsp perform better
<neiluj> *may perform
<discocaml> <froyo> elisp problem not ocaml problem :^)
Anarchos has joined #ocaml
hornhack has joined #ocaml
sagax has quit [Quit: Konversation terminated!]
Anarchos has quit [Ping timeout: 276 seconds]
<discocaml> <val patate: unit Lazy.t> neiluj: about your "GEN", you cannot really have type-safe binding if it is not type-safe in the original language...
<discocaml> <val patate: unit Lazy.t> You can allow only for construction of valid values from ocaml, but if you get them from another program, they will always have the possibility of being complete garbage...
<discocaml> <val patate: unit Lazy.t> (I hope I did not misunderstood your problem)
Anarchos has joined #ocaml
<neiluj> yes that's indeed a risk
<discocaml> <masterbuilder> oh wait, there actually are a bunch of these conversion functions already in the stdlib, didn't see them at first
Anarchos has quit [Quit: Vision[]: i've been blurred!]
count3rmeasure has joined #ocaml
olle has quit [Ping timeout: 248 seconds]
wingsorc__ has quit [Remote host closed the connection]
wingsorc__ has joined #ocaml
trev has joined #ocaml
<discocaml> <val patate: unit Lazy.t> neiluj: So having a type-safe binding, only makes sense if you break compatibility with the original lib...
<discocaml> <val patate: unit Lazy.t> On another note, would that be possible to reply to the CompanionCubeBot and have it translated to a reply to the poster on IRC too?
<neiluj> @val patate: unit Lazy.t the idea was to have a direct translate of the C interface but in ocaml and then build abstractions with the bindings
<neiluj> what do you mean by breaking compatibility with the original lib?
<discocaml> <val patate: unit Lazy.t> exactly what you avoid with what you just proposed 🙂
<discocaml> <val patate: unit Lazy.t> This is what I would go for
Stumpfenstiel has joined #ocaml
<companion_cube> There is no notion of answer on the IRC side
<neiluj> good! thanks for the advice :)
<discocaml> <darrenldl> time to add rfc to irc
<neiluj> well the IRC client can highlight or even notify when a message contains one's username
kakadu has quit [Remote host closed the connection]
count3rmeasure has quit [Ping timeout: 246 seconds]
olle has joined #ocaml
<discocaml> <val patate: unit Lazy.t> I see...
<discocaml> <darrenldl> just need to make a chatgpt plugin to figure out which line is most likely a reply to what
<discocaml> <val patate: unit Lazy.t> Please, no
count3rmeasure has joined #ocaml
<olle> When can we expect to have a local version of chatgpt in our pockets?
<olle> 10 years?
<olle> Error: This variant expression is expected to have type exn The constructor DocblockSyntaxError does not belong to type exn
<olle> Meh
<olle> 6 exception DocblockSyntaxError of string
<olle> Clearly it does tho
<olle> Ah, namespace issue
<olle> Hm, if I put an exception inside %{ }% block in Menhir, won't it be exported?
<neiluj> given a gadt, is it possible to have generic types parametrized by a "closed" subset of the gadt
<neiluj> ?
<neiluj> that would be nice
<neiluj> this would be a kind of ad-hoc polymorphism?
<olle> open variants?
<neiluj> oh yes good idea! thanks :) less powerful than a gadt but you get subtyping
<olle> +1
trev has quit [Remote host closed the connection]
azimut_ has quit [Ping timeout: 255 seconds]
Serpent7776 has quit [Ping timeout: 265 seconds]
olle has quit [Ping timeout: 268 seconds]
Anarchos has joined #ocaml
Anarchos has quit [Ping timeout: 250 seconds]
Tuplanolla has quit [Quit: Leaving.]
mro has joined #ocaml
count3rmeasure has quit [Quit: Leaving]
bartholin has quit [Quit: Leaving]
<discocaml> <darrenldl> val patate: we'll witness a uni student project along those lines quick enough, worry not
mro has quit [Quit: Leaving...]