adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.06.0 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.06/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
shinnya has joined #ocaml
al-damiri has quit [Quit: Connection closed for inactivity]
SomeDamnBody has joined #ocaml
moei has quit [Quit: Leaving...]
cbot has joined #ocaml
gtrak has quit [Ping timeout: 240 seconds]
gtrak has joined #ocaml
mfp has quit [Ping timeout: 260 seconds]
mfp has joined #ocaml
gtrak has quit [Ping timeout: 260 seconds]
silver_ has quit [Read error: Connection reset by peer]
gtrak has joined #ocaml
jaar has quit [Ping timeout: 260 seconds]
Soni has quit [Read error: Connection reset by peer]
cbot_ has joined #ocaml
Soni has joined #ocaml
cbot has quit [Ping timeout: 256 seconds]
btbytes has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
btbytes has joined #ocaml
btbytes has quit [Ping timeout: 265 seconds]
moei has joined #ocaml
mfp has quit [Ping timeout: 268 seconds]
tormen has joined #ocaml
tormen_ has quit [Ping timeout: 260 seconds]
tonyle has joined #ocaml
tonyle has quit [Client Quit]
gtrak has quit [Ping timeout: 268 seconds]
gtrak has joined #ocaml
pierpa has quit [Quit: Page closed]
argent_smith has joined #ocaml
ygrek has quit [Ping timeout: 268 seconds]
donviszneki has quit [Ping timeout: 260 seconds]
shinnya has quit [Ping timeout: 260 seconds]
donviszneki has joined #ocaml
donviszneki has quit [Ping timeout: 240 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
argent_smith has quit [Quit: Leaving.]
<discord3> <mars0i> Anyone have a quick explanation of this? # fun x -> x 42;; - : (int -> 'a) -> 'a = <fun> What the heck? There's nothing between the x and the integer. It looks like it should be a syntax error. And why that signature? Without polymorphism: # fun x -> 2 * x 3;; - : (int -> int) -> int = <fun>
<discord3> <mars0i> Moving the question to discuss.ocaml. (Someone might want to answer there when back on online. 😃 )
bartholin has quit [Ping timeout: 248 seconds]
<discord3> <mars0i> I figured it out. OCaml sees x 42 as an application of a function to 42, so a function must be passed as x, and it must accept an int as its argument.
bartholin has joined #ocaml
kvda has joined #ocaml
<discord3> <mars0i> Duh. It's obvious now.
jbrown has quit [Ping timeout: 256 seconds]
mbuf has joined #ocaml
shinnya has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
donviszneki has joined #ocaml
<xvilka> Hi! What is the most efficient yet OCaml-ish way to read ASCIIZ string from buffer (bytes) in OCaml? Basically reading characters until zero?
shinnya has quit [Ping timeout: 268 seconds]
mk9 has quit [Quit: mk9]
<donviszneki> xvilka: what do you want to do with them once you've read them?
donviszneki is now known as hdon
hdon has quit [Changing host]
hdon has joined #ocaml
<hdon> for example if you were going to take a slice of your buffer from index 0 to index n where n is where you encounter your termination character, then a recursive function is very ocamly and will do the trick:
<hdon> let rec nulTerminatedStringOfBuffer = (b, n) => b[n] == 0 ? stringFromBufRange(b, 0, n) : nullTerminatedStringOfBuffer(b, n+1);
MercurialAlchemi has joined #ocaml
kvda has joined #ocaml
<xvilka> hdon: it is parsing file format with such variable-length records: https://pastebin.com/R7V4zfXu
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<xvilka> this is what I currently wrote
<xvilka> asking if there is a better way
<flux[m]> in particular let str1 = str ^ String.make 1 ch in is inefficient
<flux[m]> if you want to collect a set of strings and make one big string of them, I suggest you use Buffer
<flux[m]> (alternatively you can collect a list of strings and then use String.concat)
<xvilka> flux[m]: but how collecting a list can be done? I mean I don't know where the end of the string is, so I have to search zero character
kvda has joined #ocaml
<flux[m]> well, you could use String.index_from buf pos '\000' and then use String.sub on that
<flux[m]> avoiding the first String.sub and this collecting stuff altogether
<xvilka> flux[m]: aha, this sounds good
<flux[m]> but it seems you want to support strings that span multiple chunks, so for that case you would use Buffer. Buffer also supports adding substrings directly.
<hdon> xvilka: if you're writing a parser, maybe these would work http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual026.html
<hdon> i'm not sure if they can handle NULs
<xvilka> hdon: those target text parsing I think, I am working with binary formats
<xvilka> I use Cstruct heavily already
<hdon> mmm... yeah i thought that might be an issue :)
cbot_ has quit [Quit: Leaving]
discord3 is now known as discord
hdon has quit [Ping timeout: 256 seconds]
<kvda> I'm doing Ruby right now, kill me
jao has quit [Ping timeout: 248 seconds]
hdon has joined #ocaml
shw has left #ocaml [#ocaml]
<xvilka> I always wondered, if it is possible to have a different highlight of different function arguments across the function body in OCaml, to improve the speed of reading
<xvilka> I use Vim, where it seems impossible to do, does anyone know if there are other editors that support this?
caltelt_ has quit [Ping timeout: 260 seconds]
sagotch has joined #ocaml
SomeDamnBody has quit [Ping timeout: 240 seconds]
dhil has joined #ocaml
larhat has joined #ocaml
sgnb has quit [Remote host closed the connection]
sgnb has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kvda has joined #ocaml
tarptaeya has joined #ocaml
ratschance has quit [Remote host closed the connection]
ratschance has joined #ocaml
TarVanimelde has joined #ocaml
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
Haudegen has joined #ocaml
mfp has joined #ocaml
FreeBirdLjj has joined #ocaml
silver has joined #ocaml
TarVanimelde has quit [Quit: TarVanimelde]
tarptaeya has quit [Remote host closed the connection]
tarptaeya has joined #ocaml
<discord> <rizo> One Vim plugin I sometimes use is cursorword. It underlines all occurrences of the word under the cursor. https://github.com/itchyny/vim-cursorword
jaar has joined #ocaml
zolk3ri has joined #ocaml
dhil has quit [Ping timeout: 256 seconds]
larhat has quit [Quit: Leaving.]
nephanth has joined #ocaml
mbuf has quit [Quit: Leaving]
jaar has quit [Ping timeout: 248 seconds]
mal``` has quit [Quit: Leaving]
mengu has joined #ocaml
mal`` has joined #ocaml
<discord> <n4323> this would be cool to combine with :MerlinOccurences
<discord> <n4323> i would also like to have a type-browsing mode where the :MerlinTypeOf is continuously displayed when the cursor or mouse is over something
gtrak has quit [Ping timeout: 248 seconds]
gtrak has joined #ocaml
nephanth has quit [Ping timeout: 260 seconds]
ziyourenxiang has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
mengu has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
dhil has joined #ocaml
malina has joined #ocaml
jao has joined #ocaml
gtrak has quit [Ping timeout: 264 seconds]
nephanth has joined #ocaml
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]
dhil has quit [Ping timeout: 260 seconds]
gtrak has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
mengu_ has joined #ocaml
flodin has quit [Quit: Konversation terminated!]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
Haudegen has quit [Remote host closed the connection]
kvda has quit [Quit: Textual IRC Client: www.textualapp.com]
<sspi__> If there are questions on OCaml and wasm, feel free to ask me :-). For those who are interested: https://github.com/SanderSpies/ocaml/tree/wasm-backend
<sspi__> (this only the part where cmm is compiled to wasm, not the wasm to cmm work of Simon)
awal is now known as afk
gtrak has quit [Ping timeout: 245 seconds]
afk is now known as awal
mengu_ has quit [Remote host closed the connection]
mengu has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
mnemem has joined #ocaml
Haudegen has joined #ocaml
neatonk has joined #ocaml
chindy has quit [Ping timeout: 255 seconds]
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
chindy has joined #ocaml
jao has quit [Ping timeout: 256 seconds]
shinnya has joined #ocaml
mnemem has quit [Ping timeout: 265 seconds]
roygbiv has joined #ocaml
mnemem has joined #ocaml
chindy has quit [Ping timeout: 245 seconds]
ehirdoy has quit [Ping timeout: 256 seconds]
jao has joined #ocaml
roygbiv has quit [Quit: ™]
cryptocat1094 has joined #ocaml
mengu has quit [Remote host closed the connection]
gtrak has joined #ocaml
jao has quit [Ping timeout: 256 seconds]
mnemem has quit [Ping timeout: 260 seconds]
igitoor has quit [Read error: Connection reset by peer]
igitoor has joined #ocaml
mnemem has joined #ocaml
jao has joined #ocaml
igitoor has quit [Changing host]
igitoor has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
gtrak has quit [Ping timeout: 264 seconds]
gtrak has joined #ocaml
<companion_cube> ZirconiumX: you know there's already an IRC lib, right? ;-)
<ZirconiumX> companion_cube: Yeah, I do. It was an experiment to dip my toes into parsing and Lwt
<companion_cube> ✔
<companion_cube> do you have a bot to show yet?
<ZirconiumX> At the moment no; I'm working on the JPEG decoder, which I'm a little stuck on
<companion_cube> ‽ jpeg on IRC? :D
<ZirconiumX> Hah, no
<Armael> companion_cube: for avatars obviously
jbrown has joined #ocaml
<ZirconiumX> One question
<ZirconiumX> Does Array.of_list allocate O(1) or O(n) times?
<reynir> companion_cube: I saw there was a new release of calculon :o
<companion_cube> it's been a while, hasn't it?
<companion_cube> I think Array.of_list allocates once
<companion_cube> but you should look at the implem
<reynir> Yes, well, I haven't done any changes to my bot until recently :)
<Armael> oh we have character ranges in pattern matching ?
<Armael> is this new? :D
shinnya has quit [Ping timeout: 260 seconds]
<reynir> Not new I'm pretty sure :)
<Armael> ah yes I guess it's integer ranges that we do not have
<reynir> Yes, character ranges are in at least 3.11.2 :P
aubian has joined #ocaml
dhil has joined #ocaml
Cypi_ has joined #ocaml
gtrak has quit [Ping timeout: 264 seconds]
MercurialAlchemi has quit [Ping timeout: 240 seconds]
MercurialAlchemi has joined #ocaml
remix2000[m] has quit [*.net *.split]
ansiwen has quit [*.net *.split]
erwounn has quit [*.net *.split]
maufred has quit [*.net *.split]
Bluddy[m] has quit [*.net *.split]
smondet[m] has quit [*.net *.split]
bglm[m] has quit [*.net *.split]
copy` has quit [*.net *.split]
Cypi has quit [*.net *.split]
mehdib_ has quit [*.net *.split]
Khady has quit [*.net *.split]
Fistine has quit [Ping timeout: 255 seconds]
maufred has joined #ocaml
xorpse has quit [Ping timeout: 260 seconds]
xorpse has joined #ocaml
sagotch has quit [Ping timeout: 264 seconds]
ansiwen has joined #ocaml
copy` has joined #ocaml
bglm[m] has joined #ocaml
remix2000[m] has joined #ocaml
mehdib_ has joined #ocaml
Khady has joined #ocaml
Bluddy[m] has joined #ocaml
erwounn has joined #ocaml
smondet[m] has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
Walter[m] has quit [Ping timeout: 240 seconds]
drsmkl[m] has quit [Ping timeout: 240 seconds]
M-martinklepsch has quit [Ping timeout: 240 seconds]
M-jimt has quit [Ping timeout: 245 seconds]
equalunique[m] has quit [Ping timeout: 245 seconds]
flux[m] has quit [Ping timeout: 245 seconds]
h11 has quit [Ping timeout: 245 seconds]
dlebrecht[m] has quit [Ping timeout: 245 seconds]
hdurer[m] has quit [Ping timeout: 240 seconds]
Haudegen[m] has quit [Ping timeout: 240 seconds]
remix2000[m] has quit [Ping timeout: 240 seconds]
ansiwen has quit [Ping timeout: 240 seconds]
regnat[m] has quit [Ping timeout: 240 seconds]
isaachodes[m] has quit [Ping timeout: 240 seconds]
Bluddy[m] has quit [Ping timeout: 240 seconds]
smondet[m] has quit [Ping timeout: 240 seconds]
bglm[m] has quit [Ping timeout: 240 seconds]
copy` has quit [Ping timeout: 240 seconds]
spectrumgomas[m] has quit [Ping timeout: 260 seconds]
Haudegen has quit [Remote host closed the connection]
RouvenAssouly[m] has quit [Ping timeout: 255 seconds]
peddie[m] has quit [Ping timeout: 255 seconds]
orbifx[m] has quit [Ping timeout: 245 seconds]
caseypme[m] has quit [Ping timeout: 256 seconds]
yetanotherion[m] has quit [Ping timeout: 256 seconds]
aspiwack[m] has quit [Ping timeout: 247 seconds]
nkhodyunya has quit [Ping timeout: 256 seconds]
neatonk[m] has quit [Ping timeout: 256 seconds]
rgr[m] has quit [Ping timeout: 256 seconds]
multiocracy[m] has quit [Ping timeout: 256 seconds]
srenatus has quit [Ping timeout: 256 seconds]
ziyourenxiang has quit [Ping timeout: 264 seconds]
mnemem has quit [Ping timeout: 248 seconds]
gtrak has joined #ocaml
wilfredh has joined #ocaml
<wilfredh> hi folks
<wilfredh> I have a dumb syntax question
<wilfredh> I think I'm being bitten by match statements next to each other
<wilfredh> is there any nice way to avoid this, or should I just use () aggressively?
<companion_cube> `begin match … end` or `(match …)` indeed
<wilfredh> aha, yup, I could use begin...end too
<wilfredh> would one of those be considered more idiomatic than the other?
FreeBirdLjj has joined #ocaml
<companion_cube> I write begin end for wrapping `match`, it looks nicer to me (mostly for alignment reasons, I think)
<wilfredh> thanks :)
<wilfredh> regarding option, is there a nice way of converting a function 'a -> 'a to a' option -> 'a option?
<wilfredh> without having to write out the match myself
<wilfredh> IIRC the term is 'lifting', but I'm no FP guru
<Drup> wilfredh: CCOpt.map
<Drup> (or the Option module of your choice, you are free to pick your poison)
<wilfredh> oh, OK, so there's nothing in the stdlib?
<companion_cube> CCOpt.(x >|= succ >|= pred)
roygbiv has joined #ocaml
ansiwen has joined #ocaml
RouvenAssouly[m] has joined #ocaml
multiocracy[m] has joined #ocaml
aspiwack[m] has joined #ocaml
spectrumgomas[m] has joined #ocaml
srenatus has joined #ocaml
remix2000[m] has joined #ocaml
M-martinklepsch has joined #ocaml
M-jimt has joined #ocaml
drsmkl[m] has joined #ocaml
equalunique[m] has joined #ocaml
peddie[m] has joined #ocaml
bglm[m] has joined #ocaml
copy` has joined #ocaml
smondet[m] has joined #ocaml
caseypme[m] has joined #ocaml
hdurer[m] has joined #ocaml
isaachodes[m] has joined #ocaml
rgr[m] has joined #ocaml
regnat[m] has joined #ocaml
Walter[m] has joined #ocaml
Haudegen[m] has joined #ocaml
h11 has joined #ocaml
neatonk[m] has joined #ocaml
dlebrecht[m] has joined #ocaml
flux[m] has joined #ocaml
orbifx[m] has joined #ocaml
Bluddy[m] has joined #ocaml
nkhodyunya has joined #ocaml
yetanotherion[m] has joined #ocaml
wilfredh has quit [Ping timeout: 245 seconds]
ozzymcduff has joined #ocaml
hdon has quit [Ping timeout: 260 seconds]
ozzymcduff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jao has quit [Ping timeout: 265 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
roygbiv has quit [Quit: ™]
dhil has quit [Ping timeout: 264 seconds]
hdon has joined #ocaml
SomeDamnBody has joined #ocaml
<steenuil> I should try to get that option module accepted in the stdlib one of these days...
<bartholin> it's easy af: let option_map f x = match x with | Some y -> Some (f y) | None -> None;;
<Drup> bartholin: I consider this function as one of those that you should never write yourself
<Drup> I have better things to do than rewrite Option.map over and over again
dhil has joined #ocaml
* bartholin rewrites all the basic list functions whenever he has to use lists, because he is too lazy to look at the documentation ._.
<Drup> Well, it's your free time.
<steenuil> if you have odig installed it's just an "odig doc stdlib" away
<steenuil> err
<steenuil> "odig doc ocaml"
<Drup> steenuil: `man List` ;)
<steenuil> right, I've never used the manpages version
<bartholin> :O I did not know man List
<discord> <mars0i> 'man List' ?? Oh wow.
jao has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
Haudegen has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
ygrek has joined #ocaml
malina has quit [Ping timeout: 256 seconds]
dhil has quit [Ping timeout: 276 seconds]
jnavila has joined #ocaml
<companion_cube> bartholin: just use containers :p
<companion_cube> how hard is it to find a function with <tab> in merlin, really
tarptaeya has quit [Ping timeout: 248 seconds]
<bartholin> what about keyword search of functions, like in emacs
<companion_cube> I don't know what you mean (I don't use emacs)
hdon has quit [Changing host]
hdon has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
jack5638 has quit [Ping timeout: 264 seconds]
_andre has quit [Quit: leaving]
jack5638 has joined #ocaml
gtrak has quit [Read error: Connection reset by peer]
gtrak has joined #ocaml
<bartholin> companion_cube: you can look up functions by their name and by words appearing in their description text.
<companion_cube> if we had something like a clean version of ocamloscope, maybe…
* companion_cube pokes Drup
jnavila has quit [Ping timeout: 256 seconds]
dhil has joined #ocaml
ehirdoy has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 248 seconds]
<def`> there is only search by type in merlin, adding names is easy, adding documentation is a bit harder
malina has joined #ocaml
roygbiv has joined #ocaml
shinnya has joined #ocaml
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #ocaml
roygbiv has quit [Quit: ™]
cryptocat1094 has quit [Quit: WeeChat 1.6]
sillyotter has joined #ocaml
sillyotter has quit [Client Quit]
SomeDamnBody has quit [Ping timeout: 260 seconds]
coventry has joined #ocaml
<coventry> Is this a good place to ask questions about Eliom?
<ZirconiumX> You can try
<ZirconiumX> Our focus tends to be more on the building blocks of a program, rather than the stacks
<coventry> What is the protocol for sharing data between client and server? OCaml serialization, or something more transparent?
coventry has quit [Ping timeout: 264 seconds]
mk9 has joined #ocaml
gtrak has quit [Read error: Connection reset by peer]
gtrak has joined #ocaml
mk9 has quit [Quit: mk9]
<ZirconiumX> In today's news:
<ZirconiumX> `let max_idat_len = 1048576 in`
<ZirconiumX> "what's 1048576?"
<ZirconiumX> "2**20"
<ZirconiumX> "Couldn't you have written 2**20?"
<ZirconiumX> "Pow is slow for powers of two"
<companion_cube> 1 lsl 20
<ZirconiumX> "It's a constant"
<ZirconiumX> I did investigate the assembly for this
<ZirconiumX> And noticed that the compiler does generate a call to pow
<ZirconiumX> Which I don't think is entirely necessary, but sure
<companion_cube> there isn't a `pow` on integers
<ZirconiumX> Yeah, but it's a constant expression
<companion_cube> still not following, which `pow` are you talking about exactly?
<ZirconiumX> ( ** )
<companion_cube> that's on floats
<ZirconiumX> Yeah, I realise
<companion_cube> and I think it calls something in libm
<ZirconiumX> It calls pow
nephanth has quit [Ping timeout: 240 seconds]
dhil has quit [Ping timeout: 264 seconds]
theglass has quit [Ping timeout: 268 seconds]
theglass has joined #ocaml
theglass has joined #ocaml
theglass has quit [Changing host]
dilettante has joined #ocaml
mengu has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
mengu_ has joined #ocaml
gtrak has quit [Ping timeout: 256 seconds]
jnavila has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
gtrak has joined #ocaml
cbot has joined #ocaml
malina has quit [Ping timeout: 276 seconds]
jnavila has quit [Remote host closed the connection]
pierpa has joined #ocaml
zolk3ri has quit [Ping timeout: 260 seconds]
zolk3ri has joined #ocaml
FreeBirdLjj has joined #ocaml
<pierpa> In case it's not already been announced here: Introduction to Functional Programming in OCaml (MOOC) https://www.fun-mooc.fr/courses/course-v1:parisdiderot+56002+session03/about
FreeBirdLjj has quit [Ping timeout: 248 seconds]
Cypi_ is now known as Cypi
gtrak has quit [Ping timeout: 256 seconds]
eikke has quit [Ping timeout: 260 seconds]
pierpal has quit [Ping timeout: 260 seconds]
ziyourenxiang has joined #ocaml
eikke has joined #ocaml
zolk3ri has quit [Quit: leaving]
cthuluh has quit [Ping timeout: 268 seconds]