adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | Current MOOC: https://huit.re/ocamlmooc | OCaml 4.04.0 release notes: http://ocaml.org/releases/4.04.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
<cpdean> i think i see how you mean, but i'm not sure how to factor it out
<octachron> possibility 1: a local function "let f x = in match … with A -> f x | B -> f y" , possibility 2: local let "let subtrie = match … with A -> insert x x' v | B -> insert y y') in …
atsampson has quit [Ping timeout: 245 seconds]
<cpdean> hmm interesting
atsampson has joined #ocaml
Onemorenickname_ has joined #ocaml
<Onemorenickname_> hi people
<Onemorenickname_> i'm trying to find if a port is already in use
<Onemorenickname_> as when i socket / bind on a port already in use, i get no error
nomicflux has quit [Quit: nomicflux]
<average> ocaml.. the language you use to find if a port is open
<average> you use haskell when you want to check if you're out of disk space
<average> and python is used to check string equality
<average> as for java.. you use that to get money
<average> anyway
cpdean has quit [Quit: Leaving.]
maattdd has quit [Ping timeout: 260 seconds]
cpdean has joined #ocaml
silver has quit [Read error: Connection reset by peer]
Onemorenickname has joined #ocaml
Onemorenickname_ has quit [Ping timeout: 250 seconds]
pierpa has quit [Ping timeout: 265 seconds]
cpdean has quit [Quit: Leaving.]
ygrek has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
ygrek has joined #ocaml
octachron has quit [Quit: Leaving]
ski has joined #ocaml
Onemorenickname has quit [Read error: Connection reset by peer]
petroav has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 240 seconds]
nomicflux has joined #ocaml
cpdean has joined #ocaml
cpdean has quit [Client Quit]
nomicflux has quit [Quit: nomicflux]
mfp has quit [Ping timeout: 268 seconds]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
cpdean has joined #ocaml
petroav has quit [Ping timeout: 256 seconds]
cpdean has quit [Quit: Leaving.]
kappa has joined #ocaml
cpdean has joined #ocaml
sgronblo has quit [Ping timeout: 256 seconds]
kappa has quit [Quit: Page closed]
rgrinberg has quit [Ping timeout: 252 seconds]
wu_ng has joined #ocaml
ygrek has quit [Ping timeout: 248 seconds]
nomicflux has joined #ocaml
zirman has quit [Remote host closed the connection]
cpdean has quit [Quit: Leaving.]
cpdean has joined #ocaml
nomicflux has quit [Quit: nomicflux]
TarVanimelde has quit [Ping timeout: 256 seconds]
TarVanimelde has joined #ocaml
d0nn1e has quit [Ping timeout: 244 seconds]
d0nn1e has joined #ocaml
TarVanimelde has quit [Quit: TarVanimelde]
cpdean has quit [Quit: Leaving.]
TarVanimelde has joined #ocaml
cpdean has joined #ocaml
infinity0 has quit [Ping timeout: 250 seconds]
infinity0 has joined #ocaml
Aruseus has joined #ocaml
Aruseus has quit [Client Quit]
Aruseus has joined #ocaml
Aruseus has quit [Client Quit]
Aruseus has joined #ocaml
Aruseus has quit [Client Quit]
Aruseus has joined #ocaml
Aruseus has quit [Client Quit]
Aruseus has joined #ocaml
Aruseus has quit [Client Quit]
Aruseus has joined #ocaml
Aruseus has quit [Client Quit]
Aruseus has joined #ocaml
zirman has joined #ocaml
cpdean has quit [Quit: Leaving.]
zirman has quit [Ping timeout: 265 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
malc_ has joined #ocaml
Aruseus has quit [Ping timeout: 256 seconds]
_whitelogger has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
ygrek has joined #ocaml
TarVanimelde has quit [Quit: Leaving]
noddy has quit [Ping timeout: 258 seconds]
noddy has joined #ocaml
FreeBirdLjj has joined #ocaml
infinity0 has quit [Ping timeout: 240 seconds]
FreeBirdLjj has quit [Ping timeout: 258 seconds]
infinity0 has joined #ocaml
slash^ has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
petroav has joined #ocaml
chris2 has quit [Ping timeout: 245 seconds]
jonasen has joined #ocaml
FreeBirdLjj has joined #ocaml
TarVanimelde has joined #ocaml
kappa has joined #ocaml
<kappa> anyone using sedlex ?
FreeBirdLjj has quit [Ping timeout: 258 seconds]
chris2 has joined #ocaml
MercurialAlchemi has joined #ocaml
ocabot has quit [Remote host closed the connection]
petroav has quit [Ping timeout: 256 seconds]
TarVanimelde has quit [Quit: TarVanimelde]
rgrinberg has quit [Ping timeout: 268 seconds]
TarVanimelde has joined #ocaml
TarVanim_ has joined #ocaml
TarVanimelde has quit [Ping timeout: 245 seconds]
<Drup> kappa: don't ask to ask, just ask :)
<kappa> Drup: does the pattern matching match the longest re?
<kappa> i was hoping it would match the first re
<Drup> hum, it's the first, iirc
<kappa> Drup didn't work for me when i had 2 patterns with same initials
<kappa> is this intended or a bug?
<Drup> I'm not sure, don't really remember
\h has joined #ocaml
zirman has joined #ocaml
TarVanim_ has quit [Quit: TarVanim_]
AlexDenisov has joined #ocaml
zirman has quit [Ping timeout: 248 seconds]
malc_` has joined #ocaml
malc_ has quit [Ping timeout: 268 seconds]
malc_` has quit [Remote host closed the connection]
ocaml630 has joined #ocaml
<ocaml630> Just trying to update the value in a tuple using fold.
<ocaml630> update is the wrong term.
tane_ has joined #ocaml
<lyxia> what have you tried
<ocaml630> let insert s x = List.fold_left ( fun (x,y) next -> if x = s then (x,y + 1) else (x,y)) s
<ocaml630> Still trying.
AlexDeni_ has joined #ocaml
<ocaml630> Do I need to match here ?
<tane_> ocaml630, what's the parameter x supposed to do?
\h has left #ocaml ["WeeChat 1.6"]
AlexDenisov has quit [Read error: Connection reset by peer]
<ocaml630> Parameters are s, a list and x, a key. Updating the value. That's all.
<tane_> what's the relationship of insert's x and fun (x,y)'s x?
kappa has quit [Ping timeout: 260 seconds]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 258 seconds]
<ocaml630> Just iterate over s which has tuples and compare the keys with x. If it matches add 1 to the value.
AlexDenisov has joined #ocaml
AlexDeni_ has quit [Read error: Connection reset by peer]
AlexDenisov has quit [Client Quit]
ocaml630 has quit [Ping timeout: 260 seconds]
<lyxia> so... counting pairs whose first element is equal to x?
<lyxia> You only need an int as the accumulator.
<lyxia> oh he's gone
TarVanimelde has joined #ocaml
zirman has joined #ocaml
zirman has joined #ocaml
zirman has quit [Changing host]
zirman has quit [Ping timeout: 258 seconds]
mfp has joined #ocaml
elfring has joined #ocaml
jnavila has joined #ocaml
larhat has joined #ocaml
rand__ has joined #ocaml
TarVanimelde has quit [Quit: TarVanimelde]
TarVanimelde has joined #ocaml
ygrek has quit [Ping timeout: 244 seconds]
jnavila has quit [Ping timeout: 256 seconds]
infinity0 has quit [Ping timeout: 244 seconds]
jonasen has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
infinity0 has joined #ocaml
fre has joined #ocaml
jnavila has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
zirman has joined #ocaml
zirman has joined #ocaml
zirman has quit [Changing host]
silver has joined #ocaml
infinity0 has quit [Ping timeout: 250 seconds]
zirman has quit [Ping timeout: 258 seconds]
AlexDenisov has joined #ocaml
cpdean has joined #ocaml
larhat has quit [Quit: Leaving.]
infinity0 has joined #ocaml
zpe has joined #ocaml
wu_ng has quit [Ping timeout: 250 seconds]
wu_ng has joined #ocaml
jonasen has joined #ocaml
maattdd has joined #ocaml
maattdd has quit [Ping timeout: 256 seconds]
copy` has joined #ocaml
maattdd has joined #ocaml
larhat has joined #ocaml
fre has quit [Ping timeout: 260 seconds]
maattdd has quit [Ping timeout: 246 seconds]
wu_ng has quit [Ping timeout: 250 seconds]
wu_ng has joined #ocaml
TarVanimelde has quit [Read error: Connection reset by peer]
TarVanimelde has joined #ocaml
tane_ has quit [Quit: Leaving]
zirman has joined #ocaml
zirman has joined #ocaml
zirman has quit [Changing host]
fre has joined #ocaml
jonasen_ has joined #ocaml
jonasen has quit [Ping timeout: 250 seconds]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zirman has quit [Remote host closed the connection]
zirman has joined #ocaml
slash^ has joined #ocaml
TarVanim_ has joined #ocaml
TarVanimelde has quit [Ping timeout: 260 seconds]
shinnya has joined #ocaml
pierpa has joined #ocaml
orbifx has joined #ocaml
petroav has joined #ocaml
ocaml246 has joined #ocaml
pierpa has quit [Remote host closed the connection]
<ocaml246> Trying to update the value when key matches in a list of tuples.
<ocaml246> | (x,y)::tl -> List.fold_left ( fun (x1,y1) next -> if x1 = s then ([(x1,y1 + 1)] @ s)) (x,y) s;
<ocaml246> Does that make sense ?
<sternenseemann> ocaml246: I'd use List.map
<sternenseemann> or wait
pierpa has joined #ocaml
<sternenseemann> you have some more context? that seems pretty confusing
<ocaml246> (x,y)::tl I am using this thinking that I can start with the head.
<ocaml246> s is a list.
<ocaml246> Maybe this doesn't increment the value in place.
orbifx has quit [Ping timeout: 258 seconds]
chris2 has quit [Ping timeout: 258 seconds]
AlexDenisov has joined #ocaml
chris2 has joined #ocaml
nomicflux has joined #ocaml
octachron has joined #ocaml
<octachron> ocaml246, I think that you want List.map:
<ocaml246> Will try map
<octachron> if you have a function f and a list l = x_1 :: x_2 … :: x_n , List.map f l ≡ f x_1 :: f x_2 ::… :: f x_n
stux|RC-only has quit [Ping timeout: 256 seconds]
<octachron> whereas List.fold_left f start (x1 :: x2 … :: x_n ) is " f(…( f (f start x1) x2) … x_n)
<octachron> "
<ocaml246> Can List.map be use to add a tuple if it is not present ?
<ocaml246> List.map ( fun (x1,y1) -> if x1 = s then (x1,y1 + 1) else (x1,y1)) s
cpdean has quit [Quit: Leaving.]
stux|RC-only has joined #ocaml
<ocaml246> let insert s x = List.map ( fun (x1,y1) -> if x1 = x then (x1,y1 + 1) else (x1,y1)) s;
nomicflux has quit [Quit: nomicflux]
<Leonidas> how can x1 ever be equal s if x1 is in s?
<Leonidas> ocaml246: and no, map only iterates over items that are present, sou you have to check whether it is present and if not, add it
<ocaml246> If key is present increment value, else add new (k,v)
FreeBirdLjj has joined #ocaml
<Leonidas> no, that's not possible with only map
<Leonidas> you can map over it, incrementing, and then check if it is in the list and if not, cons to it
<octachron> ocaml246, as a first step, separate the different steps: first check if the key is present, if not add a new (key,value) pair, otherwise use a map
<octachron> it may be not efficient as possible, but first, it better to have something that works than nothing; second you are using association list, so efficiency is already not here.
fre has quit [Ping timeout: 240 seconds]
FreeBirdLjj has quit [Ping timeout: 258 seconds]
<ocaml246> Will try.
zirman has quit [Remote host closed the connection]
<aantron> whoa, does anyone here use Lwt_chan? i didn't even know this module existed until 2 minutes ago. it's not linked from the manual
AlexDeni_ has joined #ocaml
<aantron> ah well fair, it's deprecated :)
AlexDenisov has quit [Ping timeout: 246 seconds]
TarVanim_ is now known as TarVanimelde
zirman has joined #ocaml
ocabot has joined #ocaml
maattdd has joined #ocaml
<ocaml246> List.find (fun (x1,y) -> if x = x1 then y ) s Does this not return the tuple's value when key is matched.
cpdean has joined #ocaml
<Leonidas> companion_cube: "Warning 58: no cmx file was found in path for module QCheck_runner, and its interface was not compiled with -opaque"
<companion_cube> -w -58
<companion_cube> ;-)
<Leonidas> I don't even know what that is supposed to mean.
<Leonidas> I mean the warning, -w -58 I understand
<companion_cube> on flambda, having the .cmx is useful for cross module optim
<Drup> (it means companion_cube is a bad library author and doesn't install all his files :D)
<Leonidas> how to speficy warning stuff in _tags?
<companion_cube> Drup: usually I try to avoid bloat, yes
<Drup> Leonidas: warn(...)
<companion_cube> I mean, it used to be useless to install .cmx, come on
<Drup> companion_cube: huh, no, it was always useful for inlining
<Leonidas> Drup: thanks, worked like a charm. my google-fu did not bring up anything.
cpdean has quit [Quit: Leaving.]
<Drup> companion_cube: anyway, you should install it now
<companion_cube> yeah, well, will do
<companion_cube> it's still a bit annoying how bloated .opam gets
<Leonidas> topkg lint complains about "qtest" in OPAM and "qcheck" in _tags. Meh :-|
maattdd has quit [Ping timeout: 244 seconds]
<companion_cube> I will not cater to topkg's whims
<Leonidas> truth be told, every time I use topkg I am less impressed with it.
<companion_cube> I often rant, but in practice I'm quite happy with oasis
<Leonidas> same
<Leonidas> if only it would also spit out .merlin and opam files :)
<companion_cube> yeah
<companion_cube> although it's probably not that hard to add
<Drup> it's very easy to add
<Drup> I know how to do it, but not the time
<Drup> (for .merlin, you can already do opam files with oasis2opam)
<companion_cube> maybe oasis2opam should be part of oasis?
<Leonidas> yes, META output is also just a plugin, so it should be reasonably easy to add
<companion_cube> yeah
<companion_cube> thank you Leonidas for proposing to do it!!
<Drup> companion_cube: maybe. I don't use oasis2opam even if it exists, I prefer having good control over that file
<companion_cube> yeah, yeha
<companion_cube> although most info is already in _oasis
orbifx has joined #ocaml
<orbifx> I'm making an opam package
<orbifx> it's a library
<orbifx> it says it installs but when I try to include it from another project, it says it doesn't exist
<orbifx> what should I be looking for?
isd has quit [Ping timeout: 240 seconds]
<companion_cube> do you install the library using `ocamlfind install`?
<Leonidas> companion_cube: sorry. I even had a fork of oasis to add it, but I haven't gotten around to actually doing it, feel kinda bad about it.
* Leonidas :(
<companion_cube> :D
<companion_cube> don't feel bad
ocaml711 has joined #ocaml
ocaml711 has quit [Client Quit]
<orbifx> companion_cube: are you asking me?
<companion_cube> ywa
<companion_cube> yes
<companion_cube> you probably install stuff in the wrong place
<companion_cube> or you might not install everything needed (META, .cma, the .cmi, etc.)
<orbifx> I'm missing the META
<orbifx> or rather, I know i've not told it to install it
FreeBirdLjj has joined #ocaml
<orbifx> I build with ocamlbuild and install with <package>.install
<orbifx> So where can I read aboute META companion_cube ?
<companion_cube> in other libraries' META files (honestly)
shinnya has quit [Ping timeout: 244 seconds]
<orbifx> ok
<orbifx> thanks
<orbifx> is it best to package cmxa or cma?
<companion_cube> both
<companion_cube> if you build both
<orbifx> I don't but can do
<companion_cube> cma are still useful if you want very fast builds or debugging
<orbifx> ok
<orbifx> and is the mli mandatory?
<Drup> or js_of_ocaml. :p
<companion_cube> not mandatory, but useful
<companion_cube> also, the .cmi (for merlin)
<companion_cube> err, for everything
<companion_cube> mli is useful for merlin
FreeBirdLjj has quit [Ping timeout: 258 seconds]
<orbifx> ok looking to get something started for now
<orbifx> and add as I go along and if the package gains more traction
rgrinberg has joined #ocaml
<octachron> companion_cube, would'nt merlin use cmti rather than mli ?
<companion_cube> I'm not sure
rgrinberg has quit [Remote host closed the connection]
<orbifx> companion_cube: so META is mandatory? I found other ones in my .opam
<orbifx> I pressume I can't generate it with opam or something?
<companion_cube> it's mandatory if you use ocamlfind (which you should)
<Leonidas> orbifx: oasis can generate META files
<companion_cube> you can generate it with oasis
rgrinberg has joined #ocaml
<companion_cube> if you happen to use oasis
FreeBirdLjj has joined #ocaml
<orbifx> oasis seems a chore to get to know and use :P
<orbifx> I tried it in the past
<companion_cube> I don't really agree, you can go quite far and write only one file for most boring tasks (build, install...)
vramana has joined #ocaml
<orbifx> maybe I need to revisit it
<orbifx> is there a nice guide?
<companion_cube> _oasis files on github
<companion_cube> (yeah, I like to learn by example :D)
<companion_cube> (the lwt _oasis is quite nice)
<companion_cube> (then, `oasis manual` as a reference)
<orbifx> I need to revisit
<Drup> companion_cube: I'm hurt, you don't mention my tutorial :(
<companion_cube> oh
<companion_cube> didn't remember it
<companion_cube> !oasis
<ocabot> OK.
<orbifx> ok
<orbifx> does a META have to contain package {} ?
<orbifx> ok seems not
<orbifx> what is a cmxs file?
<companion_cube> native, dynlink
<companion_cube> like a .so
<orbifx> I take it it's mandatory?
<elfring> Would you like to discuss a topic like “Checking a constraint for an OCaml class” a bit more? http://lists.ocaml.org/pipermail/platform/2016-August/000704.html
stux|RC has joined #ocaml
stux|RC has quit [Remote host closed the connection]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
orbifx has quit [Ping timeout: 252 seconds]
ocaml246 has quit [Ping timeout: 260 seconds]
zpe has quit [Ping timeout: 250 seconds]
stux|RC has joined #ocaml
yegods has joined #ocaml
rgrinberg has quit [Ping timeout: 256 seconds]
zirman has quit [Remote host closed the connection]
chris2 has quit [Ping timeout: 246 seconds]
chris2 has joined #ocaml
zirman has joined #ocaml
zirman has joined #ocaml
zirman has quit [Changing host]
nomicflux has joined #ocaml
isd has joined #ocaml
zirman has quit [Ping timeout: 258 seconds]
jnavila has quit [Ping timeout: 256 seconds]
AlexDenisov has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
AlexDeni_ has quit [Ping timeout: 250 seconds]
zirman has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
stux|RC-only has quit [Quit: Aloha!]
zirman has quit [Remote host closed the connection]
zirman has joined #ocaml
FreeBirdLjj has joined #ocaml
fre has joined #ocaml
zirman has quit [Remote host closed the connection]
zirman has joined #ocaml
AlexDeni_ has joined #ocaml
AlexDenisov has quit [Ping timeout: 260 seconds]
yegods has quit [Remote host closed the connection]
yegods has joined #ocaml
govg has joined #ocaml
orbifx has joined #ocaml
freehck has quit [Ping timeout: 250 seconds]
kakadu has joined #ocaml
<Jarth> a Makefile contains an invalid checksum for extlib
<Jarth> i think it's for ocamlbuild, i've tried multiple versions all with the same issue, how come this is left unfixed ?
slash^ has quit [Read error: Connection reset by peer]
d0nn1e has quit [Ping timeout: 250 seconds]
d0nn1e has joined #ocaml
planet_en has joined #ocaml
planet_en has quit [Client Quit]
planet_en has joined #ocaml
jnavila has joined #ocaml
artymort[m] has joined #ocaml
artymort[m] has left #ocaml [#ocaml]
<xyproto> opam is now an official Arch Linux package
<companion_cube> oh, cool!!
<companion_cube> are you the maintainer?
<xyproto> companion_cube: yep :)
<companion_cube> thank you then
<xyproto> companion_cube: np, I was missing it too
<xyproto> companion_cube: next up: utop
<xyproto> maybe. It requires a few dependencies.
<xyproto> companion_cube: are you using ocaml on Arch regularly?
<companion_cube> hmm I tend to use opam to use ocaml, rather
<companion_cube> but yeah, my machines are on arch
<xyproto> I see. neat.
<companion_cube> well, best distribution there is nowadays
<companion_cube> except maybe nixos, once it gets more stable?
<maurer> nixos is not too bad on stability. Main barrier ot using ocaml on it is that a lot of ocaml libs are packaged in different ways making a lot of assumptions
<maurer> so when you want to use a new lib, it can sometimes be nontrivial to package it up
<xyproto> nixos sounds like the distro that is closest to functional programming. I like the ideas but haven't tried it yet.
<companion_cube> there are some users here, but I haven't tried seriously yet
<companion_cube> xyproto: it looks the closest to git, imho
<xyproto> well, git works well, but it's not always trying to keep things as simple as they could be, imo. Is that like NixOS too?
<companion_cube> no idea
<companion_cube> I find git quite simple i ndepth, even though the UI is a bit messy
<xyproto> I just recently discovered utop and the core libraries after I started reading Real World OCaml. utop looks very smooth. I've used standard ML in the past, and read a more basic OCaml book, but utop, async and all the other modules is another world entirely.
<companion_cube> heh, yeah, OCaml's ecosystem is more active than SML's
<xyproto> and both utop and opam have quite attractive console colors, which warms the heart of someone that is already a fan of Arch :)
groovy2shoes has joined #ocaml
maattdd has joined #ocaml
planet_en has quit [Quit: planet_en]
planet_en has joined #ocaml
<Drup> xyproto: you'll find quite a good amount of Arch users around here
<Leonidas> yep, here
<companion_cube> no, here
<Drup> Arch's probably the best distribution for OCaml, it's very smooth
<Leonidas> Drup: though i found the ocaml compiler to be packaged rather … uhh
<Drup> nice to see that someone is trying to migrate more packages into the main repositories, AUR is convenient but not optimal :p
<Leonidas> it was stuck on 4.02 nearly till 4.04 was released
<Drup> xyproto: did you packaged aspcud too ?
<Drup> I would really like to have the different solver listed here packaged, at least in AUR, in order to make comparisons http://opam.ocaml.org/doc/Specifying_Solver_Preferences.html#Yestherearedifferentversionsoftheuserpreferencelanguage
<companion_cube> I would really like to have at least one solver that is easy to install
<Leonidas> there is aspcud in AUR, it just takes a long time to build
<Leonidas> but yeah, having that as a binary package would be really neat
zpe has joined #ocaml
<Leonidas> companion_cube: Do you happen to know the "why" behind the Formatter story in OCaml? I am wondering why it is like this and not similar to other languages which use t -> string functions
<companion_cube> t -> string is inefficient
<companion_cube> and Format has the additional bonus that you can pretty-print complicated structures
<companion_cube> (t -> string is inefficient because you easily end up with quadratic behavior, allocate a lot of intermediate structures, etc.)
orbifx has quit [Ping timeout: 260 seconds]
<Leonidas> companion_cube: how so? don't you at some point need to convert things to string?
<Leonidas> allocating intermediate structures could be reduced using a stringbuffer so you don't get quadratic behaviour when concatenating strings
<companion_cube> 1/ not necessarily, since `fprintf` can print to a channel
<companion_cube> 2/ printing to a buffer, then extracting a string, is more efficient
<companion_cube> so yeah, `stringbuffer -> t -> unit` would be ok too
<companion_cube> but note that it is not `t -> string`
<companion_cube> and, in practice, Format.formatter can write into a buffer
<Leonidas> I see, thanks :)
<companion_cube> we could imagine `t -> rope`, though
<Drup> t -> rope is still less efficient
jonasen_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<companion_cube> but a bit less than `t -> string`
<Drup> sure, but ...
<Drup> and format does a bit more than that anyway
<companion_cube> yes
<companion_cube> well you could argue that Pprint.t is a form of enhanced rope
<companion_cube> (it composes nicely, too)
<lobo> Leonidas: not sure if you already found a solution to your topkg linting issue. this is more of a workaround i had to put in place for ipaddr https://github.com/mirage/ocaml-ipaddr/blob/master/pkg/pkg.ml#L8
<Leonidas> lobo: no, I just decided to say "screw it" ;)
<Leonidas> lobo: wouldn't want to exclude the complete opam file from linting because it is actually quite useful
<Leonidas> ohh, i misunderstood your fix
<lobo> Leonidas: i had to exlude ounit from topkg's linting, because it is spelled oUnit in ocamlfind and ounit in opam
<Leonidas> lobo: yep, my issue is in the same vein. Thanks, applied your solution!
<Leonidas> there should be a way to specify a mapping from opam to _tags, but I guess that's not a usecase dbunzli has %)
<companion_cube> maybe topkg should merge with solvuu
<companion_cube> all in one place
<lobo> Leonidas: great. i had a lot of help with ipaddr. took a few iterations to get the packaging right
<Leonidas> lobo: same. My favorite part of the docs is this:
<Leonidas> "If you start a new library carcass can generate the structural boilerplate with your personal information and preferences."
<Leonidas> and carcass links to http://erratique.ch/software/carcass/
<Drup> lobo: honestly, is it really better than what you had with oasis ?
<Drup> (though there is a lot of peer pressure about topkg along the mirage people :p)
<companion_cube> is it the same with alcotest?
<companion_cube> attraction to shiny new things?
<Drup> companion_cube: alcotest's API is really simpler
<companion_cube> m'kay
<lobo> Drup: as a beginner i liked oasis, because everyting is in one place. i've just ported ipaddr to learn more about topkg
<Armael> alcotest's api is also really limited
<Drup> Armael: sure, that's the flip coint
<companion_cube> alcotest could have been a layer above ounit
<Drup> coin*
<Leonidas> companion_cube: like qcheck?
<companion_cube> or an alternative runner with shiny colors, or whatever
<companion_cube> Leonidas: actually it should, yeah :/
<companion_cube> I've been thinking about this, but I have 0 motivation for that nowadays
<Leonidas> isn't there a way to generate stuff around the test to make it into a oUnit test case?
<Leonidas> I thought I saw something in the docs
<companion_cube> in qcheck, yes, you can convert
<Leonidas> but then quickly skipped over it because oUnit :p
<companion_cube> but I think it should always translate into ounit, actually
<companion_cube> bah, what's wrong with ounit? :/
<companion_cube> it does nice things, such as junit output
<Armael> why don't people just add shiny printers to ounit
<companion_cube> but of course, this is ocaml, no way we can agree on a standard.
<companion_cube> ^
<Leonidas> inactive upstream?
<aantron> fork
jnavila has quit [Quit: Konversation terminated!]
<Leonidas> that's what batteries people did and now we have extlib and batteries
<Drup> it's on the forge, under darcs
<Armael> hu
<Drup> I mean, you can try to be more contributor hostile
<companion_cube> olol, ok :D
<Drup> but it's hard
<companion_cube> but indeed, at some point if maintainers are all dead, you can *migrate* (not fork) the project
<Leonidas> at least gasche still updates batteries whenever that breaks, which is very nice
<companion_cube> so many projects should migrate
<companion_cube> zarith, too
<Drup> and I find the API and documentation a bit off puting, personally
<Leonidas> yeah, everything on the forge basically
<companion_cube> the documentation sucks a bit
<companion_cube> it's full of hidden functionalities
<Drup> alcotest is dead simple and the API is trivial
<companion_cube> but it's no excuse for not using it :/
<companion_cube> the basics of OUnit is trivial too
<companion_cube> assert_equal and >:::
<Drup> sure, but documentation is important ...
<Leonidas> >>>>::::::
<companion_cube> oh come on
<aantron> :D
<Leonidas> and there are multiple of those
<companion_cube> there are 3 of those
<companion_cube> it's not that hard
* Leonidas :D
<Drup> (note that alcotest is implemented on top of ounit)
guy235 has joined #ocaml
<Leonidas> but truth be told, my main gripe with things is most of the times the docs, or the lack thereof
<companion_cube> Drup: hu ?!
<Leonidas> (with dbunzli and, hmm, Lwt being positive examples)
<companion_cube> depends: ocamlfind & ocamlbuild & topkg & fmt & astring & result & cmdliner
rgrinberg has joined #ocaml
<companion_cube> doesn't seem that it is
<Drup> oh
<companion_cube> and it should
<Drup> it used to be, maybe ?
<Leonidas> what about kaputt?
<Drup> pretty sure I read that at some point
<companion_cube> it smells so much like Bunzli
<Drup> anyway, some of these old packages are extremly contributor-hostile
<aantron> lwt positive example of docs?? :p
<Drup> (I mean, just look at how much we have to fight to get a fucking opam file in oasis, ffs)
<companion_cube> aantron: in OCaml standards, yeah, clearly
<Leonidas> aantron: compared to Async, where the only docs is RWO.
<companion_cube> Drup: it's just that no one wants to do the work?
<aantron> ok, fair enough
<companion_cube> oasis is surprisingly contributor-open, in my experience
<aantron> still i think they should be massively improved
<companion_cube> (even though the code isn't)
<Drup> companion_cube: having a nice setup is part of the contributor openness
<companion_cube> I just meant that the code is not that nice
<Drup> I had to write the .merlin myself, I had to add an opam file (and it's not in because gildor doesn't want it)
<companion_cube> ah, that
<Drup> and lot's of stuff like that
<Drup> the bug tracker is still on the forge
<Drup> and it goes on and on
<companion_cube> well, OCaml's bug tracker is still mantis
<Drup> lot's of packages like that
<Drup> mantis >>>> forge
<Leonidas> well, all of those are older than github/opam/merlin
<companion_cube> err
<Drup> yeah, really
<companion_cube> well maybe, ok
<companion_cube> but anyway, oasis is still worth using
<Drup> sure
<Leonidas> yeah, it just got this moribound reputation somehow
<Drup> but a lot of the situation comes down to maintaners that are not very good at it
<companion_cube> really? it's actively maintained and has tons of features
<companion_cube> Drup: not having an opam file is not necessarily a priority...
<Drup> companion_cube: it's part of a bigger thing ...
<Leonidas> companion_cube: not having an opam file is like a npm project without a project.json
<Drup> it's just an accumulation of small things
<companion_cube> Leonidas: meh
<companion_cube> Drup: you only cited 2
<companion_cube> I contributed a lot of code this year, and it went smoothly
<companion_cube> not to forget omake's integration
<Leonidas> companion_cube: I agree with Drup that initial impression is important
<companion_cube> well yes but please stop being perfectionists
<Leonidas> That's something the Reason folks seem to be hard at work at
<Drup> because he wanted your stuff already and he was midly active during the period
<companion_cube> we have no crediblealternative to oasis right now
<Leonidas> cabal? >p
<Drup> (17:15:58) companion_cube: I often rant, but in practice I'm quite happy with oasis
<companion_cube> and its 1.1GB ghc compiler? no thanks :p
<Drup> ;)
<companion_cube> well I am
<Drup> companion_cube: same for me ;)
<companion_cube> same as I would like to have the time and motivation to improve qtest, but I can still use it right now
<Leonidas> yeah, same here actually.
<Drup> doesn't prevent me from being rather unhappy about the situation
<Leonidas> though oasis could steal some of the good ideas of topkg
<companion_cube> heh, if it's about being unhappy, oasis is still mostly ok by me
<companion_cube> not like ocamlfind, build systems and the stdlib
<companion_cube> which are FAR bigger problems
<companion_cube> included for beginners
<companion_cube> Leonidas: like what?
<Drup> octachron: wow, to started an ambitious project
<Drup> you*
<Leonidas> companion_cube: avoiding to generate so much code (e.g. myocamlbuild)
<companion_cube> well that's part of the build system problem
<Leonidas> companion_cube: what's the problem with findlib?
<companion_cube> _tags is not sufficient
<companion_cube> findlib is a layer that should disappear and be merged into opam or into the compiler
<companion_cube> we have enough layers already
<Leonidas> at least META is something that people have adopted
<Leonidas> companion_cube: oh, yeah, I agree absolutely.
<companion_cube> I heard that mirage people don't use it? :/
<Drup> companion_cube: sure they do
<companion_cube> ah, it's a relief
<Drup> octachron: I'm tempted to try to patch your thing for my version of eliom-lang and use that ...
zpe has quit [Remote host closed the connection]
<Leonidas> I have to say, writing a QuickCheck test, then running it and seeing it pass on the first try is something that I very much enjoy about OCaml :)
fre has quit [Ping timeout: 252 seconds]
<octachron> Drup, mostly because I started to question if a good build ocamlbuild system could be really based on the brittle ocamldep
<Leonidas> the only issue I had was that the test generated massively huge integers and took forever to run %)
<octachron> I sometimes dream of a build system that play nicely with namespaces
<Drup> octachron: you are right, and it only becomes worse if you add things like eliom (or macros) that do weird things with namespaces
<Drup> (like having two module hierarchy in // ...)
<companion_cube> Leonidas: you must have a range combinator somewhere, surely?
<companion_cube> 1 -- 100, or something like that?
<aantron> im currently writing a new ocamldep
<aantron> but im currently working a LOT on lwt so not really
<Drup> (you really do like to pick horrible projects, do you ? :D)
<companion_cube> masochism
<aantron> me? lol
<Leonidas> companion_cube: I switched to small_int, that was good enough
<aantron> i needed it for namespaces
<aantron> have to look at codept now
<companion_cube> I should really try to move towards rust...
<Leonidas> nooo
<octachron> Drup, which kind of patch would you need for eliom-lang?
<aantron> overall approach of codept sounds identical to what i started. nice
<Leonidas> I tried to like rust 0.10, but wasn't able to, way too frustrating
<companion_cube> it was a while ago then
<companion_cube> yeah, I'm a bit frightened too
<companion_cube> but it should be worth it when performance mattres
<companion_cube> (or, just, libraries)
<Leonidas> yeah, i think it'd be nice to pair it up with ocaml
<Leonidas> for crypto or things
<Drup> they are gross over approximations, iirc
<Drup> but basically, two separated namespaces for modules (client and server) and you just have to follow the syntax to now where you are
<companion_cube> remind me, the only reason for approximations in ocamldep is successive `open` statements?
<aantron> octachron: very nice, you seem to have largely done what i needed but only started
<Drup> if a module is neither client nor server, it can has both client and server fields
maattdd has quit [Ping timeout: 265 seconds]
<aantron> companion_cube: not sure if its the only reason, but it is a very bad thing when the main reason you are doing open is for module alias maps
<aantron> -main reason
<aantron> +main reason in the namespaces project :p
<companion_cube> yeah, yeah
<aantron> dammit, i need to clone myself
<companion_cube> maybe we need `using Foo` which would accept only absolute paths, not relative ones :)
<Drup> aantron: welcome
<aantron> or get interns
<Drup> interns wouldn't help
<aantron> i guess this leaves me with nothing to do after lwt :) assuming i ever get to the point where i dont have to work on it continuously..
<Drup> :D
<companion_cube> you are so crazy
<companion_cube> in a good way
<aantron> lol thanks, i guess
rand__ has quit [Quit: leaving]
<companion_cube> the whole OCaml ecosystem is making me sad, sometimes
<aantron> i really miss working on new code though. making fresh APIs.. clean docs from the start
<aantron> how so?
<companion_cube> well, people are bright but there is lots of duplication and no agreement on anything
<aantron> im sad mostly because ocaml fails at advertising
<aantron> that is a crime
<companion_cube> there is the OCaml mooc
<companion_cube> it does bring people in, but the barrier is so high
<aantron> and a lot of ocaml stuff is barely presentable
<rgrinberg> companion_cube: we'll see if reason is good kool aid in that department
<companion_cube> yay, even more fragmentation
<octachron> Drup, so you have a [client, shared] namespace for toplevel module and you switch between them following [%client/server] extension node?
<Drup> client, server namespaces, and some modules are "parametric in side" (can be specialized to either)
<Drup> the rest is correct
<aantron> anybody wants to hack on lwt? :p
<aantron> btw, rgrinberg, how's the writev PR looking overall?
<rgrinberg> aantron: looks good. I'd chop off count for now, but otherwise it's ready.
<companion_cube> aantron: I looked a bit at Lwt_process once, and was frightened :p
<aantron> rgrinberg: cool, ill wait for monday evening to give more chance for people who may have been on break to comment. do you think something like "byte_count" is needed, for those retry loops?
<octachron> aantron, I have the feeling that unfortunately there is quite a lot of academia syndrom in OCaml ecosystem: making things work well enough to prove that they could work really well with more work, then stops
<aantron> companion_cube: sadly a lot of the lwt code is frightening. but id like to make some effort to chop Lwt up into easy-to-do projects, maybe linking to diffs of similar projects from the past
<rgrinberg> aantron: wouldn't it be more useful to have a predicate that checks if the io_vector has been written completely yet? rather than having access to the raw count
elfring has quit [Quit: Konversation terminated!]
<aantron> octachron: yes.
<rgrinberg> aantron: you can rewrite the job stuff in OCaml if you really have time :P
<companion_cube> octachron: also,it's easy to re-do things, so that's how people do
<aantron> rgrinberg: good idea on the predicate, mind appending that to our little discussion on that PR, for record? i will add the code afterwards
<aantron> i dont have time. i need more labor resources :p
<rgrinberg> Drup: you might want to look at aantron's lwt PR as well. Some new coding conventions are eing introduced that look fine to me, so it might make sense for other maintainers to get acquainted with them
<aantron> i was thinking of trying out ctypes for this
<aantron> rgrinberg: which conventions are you referring to btw?
<rgrinberg> the _xxx stuff.
<Drup> I read it
<rgrinberg> Yeah, ctypes would be even nicer. But even just rewriting out as much C as possible will be an awesome first step.
<Drup> I find it ugly as fuck, but I have no better proposition :D
<companion_cube> just to check: if I want backtraces in lwt, I have to use lwt.ppx, is that it?
<aantron> for the versioning you mean?
<Drup> companion_cube: yes
<aantron> companion_cube: yes
<aantron> :p
<aantron> well you could use camlp4................
<Drup> (technically, you don't *have* to, you could call bind_backtrace by hand, but you don't want to, really)
<companion_cube> …
<aantron> i had strong urges when i first started working on lwt, to just rewrite the whole source (.ml files) in a different style
<aantron> but this is not blame-friendly, and not the most important thing to do first
<rgrinberg> aantron: What will be the minimum OCaml version for lwt 3.0?
<aantron> 4.02, and 4.02 will be the minimum version probably for a long time for lwt
<aantron> though if you want to give me reasons to drop 4.02 support, i am very receptive :)
<rgrinberg> awww... I'd like to see that inline record optimization done to Lwt
<vramana> Is there an example that calls rust code from OCaml?
<aantron> which one is that? i remember reading about it, but only vaguely
<guy235> I need a little help with something
<aantron> guy235: simply ask directly :)
<rgrinberg> I think def` or diml mentioned it first... Hmm I'd have to look it up
<aantron> rgrinberg: im considering using cppo on lwt for other purposes as well, so if lwt goes that route, and syntax has to be changed to take advantage of some optimization, it may be possible
silver_ has joined #ocaml
<guy235> I havent' the slightest clue on how I can use recursion to write a function that takes 2 float list arguments and returns a list containing the lesser value of each list
silver has quit [Read error: Connection reset by peer]
<guy235> for example i take [1; 5;] and [2; 4;]
<guy235> and return [1; 4;]
<companion_cube> rgrinberg: I'm not sure the inline record would make a noticable change to lwt :)
<Drup> it remove allocations for all the constant Lwt.return () and things like that
<companion_cube> guy235: look at `list.ml` in OCaml source code, the function `map2`
<Drup> that might be significant
<companion_cube> Drup: you mean Lwt.return_unit?
<Drup> companion_cube: no, that's the point
<companion_cube> I'm not sure how you can totally remove the allocations for Lwt.return ()
<rgrinberg> Drup: do you remember where def` or diml proposed this originally?
<companion_cube> you still need to allocate something, don't you?
<companion_cube> (a variant)
<Drup> it was in a bug report, but I don't remember where
<companion_cube> whereas Lwt.return_unit is static
<Drup> companion_cube: not if Lwt.return is directly a constructor underneath and you inline that, which should be always the case
<companion_cube> in the next flambda, maybe
<aantron> maybe modular implicits allow selecting a special implementation for Lwt.return at type unit, that behaves as Lwt.return_unit?
<companion_cube> it's not how things are right now
<companion_cube> afaik no stable version of OCaml inlines sum types
<Drup> aantron: this has nothing to do with modular implicits
<aantron> i know this doesn't
<aantron> this is another approach
cpdean has joined #ocaml
<aantron> maybe if i run out of work on lwt, and modular implicits is not going fast enough, i will take a close look at it :p
<companion_cube> what's going to be merged first: multicore, modular implicits, or duke nukem forever?
<companion_cube> (or this PR on iterators? :p)
<aantron> :D
<Leonidas> :D
<octachron> companion_cube, can I add array data types to the list? :p
<companion_cube> oh, well
<Leonidas> need to clone lpw25 like a dozen times, then we should be on schedule
<companion_cube> for 3 years from now, yeah
guy235 has quit [Ping timeout: 260 seconds]
zirman has quit [Remote host closed the connection]
zirman has joined #ocaml
dxtr has quit [Ping timeout: 265 seconds]
maattdd has joined #ocaml
cpdean has quit [Quit: Leaving.]
<Enjolras> vramana: to call rust code from ocaml, you can use ctypes the same way you do it for C. Then you write a C api in rust with rust
<Enjolras> and i recommand to use rust-cheddar to generate a c header automatically from the rust code
silver_ has quit [Quit: rakede]
cpdean has joined #ocaml
planet_en has quit [Quit: planet_en]
<vramana> Enjolras: Thanks! But I have niether used ctypes much nor good at writing C. So I am looking for example specifically.
<Enjolras> unfortunately i don't have published code. I will try to make a simple demo when i have time
infinity0 has quit [Ping timeout: 245 seconds]
<Enjolras> but actually, it's exactly the same as using ctypes for C
<Enjolras> as long as you mark all the stubs #[repr(C)] use #[no_mangle] on the functions names and put all the api functions in extern "C" { } bloc
<Enjolras> you should look at a ctypes demo for C
zirman has quit [Remote host closed the connection]
<Enjolras> tthe hard part is a build system, i usually hack a makefile
infinity0 has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
zirman has joined #ocaml
maattdd has quit [Ping timeout: 248 seconds]
AlexDeni_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cpdean has quit [Quit: Leaving.]
jao has joined #ocaml
octachron has quit [Quit: Leaving]
kakadu has quit [Remote host closed the connection]
zirman has quit [Quit: Leaving...]