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
<cml> octachron so giving X as a set of integers , [1;2......n] , let a = [1;2;3] , then let b = complement a , maybe we need X her to say that a comes from X ?
<octachron> cml, this is implicit in the type of a and b
<mrvn> you can define a few infinite sets like type _ set = N : int set | Z : int set | R : float set | Complement : ('a set * 'a list) -> 'a set
<cml> mrvn Actually I have to implement the definition of Cofinit set for integers but I don't know If I can use list, because I'm working on Red&Black trees and for me a tree is alwys finit ...
<mrvn> but Cofinit sets are finit.
<mrvn> nobody forces you to use list. you can use array or Set.t or Hashtbl.t or Red&Black trees.
<cml> mrvn We can not have an infinit tree
<mrvn> cml: but the complement of a cofinit set
<mrvn> you are only stroing the finit part.
<mrvn> +e
<mrvn> cml: for a cofinit set a number is in the set if it is not in your tree.
strykerkkd has quit [Quit: Leaving]
ryanartecona has joined #ocaml
octachron has quit [Quit: Leaving]
<cml> mrvn tu parle fr ?
<_y> he would be on #ocaml-fr if he could speak French and wanted to
<mrvn> indeed. I'm also going to bed
<cml> thanks for help
vicfred has quit [Quit: Leaving]
cml has quit [Quit: Page closed]
Algebr has joined #ocaml
Algebr has quit [Ping timeout: 240 seconds]
jao has quit [Ping timeout: 260 seconds]
orbifx has joined #ocaml
richi235 has quit [Ping timeout: 260 seconds]
richi235 has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
mfp has quit [Ping timeout: 240 seconds]
copy` has joined #ocaml
silver has quit [Read error: Connection reset by peer]
richi235 has quit [Read error: Connection reset by peer]
richi235 has joined #ocaml
hongbo_ has joined #ocaml
<hongbo_> Hi, anyone know how the API docs of Daniel's libraries are generated? It looks nice
govg has quit [Ping timeout: 260 seconds]
govg has joined #ocaml
_whitelogger has joined #ocaml
Algebr has joined #ocaml
orbifx has quit [Ping timeout: 252 seconds]
richi235 has quit [Ping timeout: 260 seconds]
infinity0 has quit [Ping timeout: 255 seconds]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
fluter has quit [Ping timeout: 264 seconds]
fluter has joined #ocaml
<Drup> ocamldoc (+ his own css)
mengu has quit [Remote host closed the connection]
shinnya has joined #ocaml
govg has quit [Ping timeout: 240 seconds]
pilne has quit [Quit: Quitting!]
MercurialAlchemi has joined #ocaml
manizzle has quit [Ping timeout: 260 seconds]
tmtwd has joined #ocaml
tmtwd has quit [Remote host closed the connection]
leah2 has quit [Ping timeout: 245 seconds]
hongbo_ has quit [Quit: Connection closed for inactivity]
leah2 has joined #ocaml
davs has joined #ocaml
ryanartecona has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
AlexDenisov has joined #ocaml
keep_learning has quit [Ping timeout: 260 seconds]
cbot has joined #ocaml
govg has joined #ocaml
MercurialAlchemi has quit [Remote host closed the connection]
AlexDeni_ has joined #ocaml
AlexDenisov has quit [Read error: Connection reset by peer]
orbifx has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
AlexDenisov has joined #ocaml
AlexDeni_ has quit [Read error: Connection reset by peer]
orbifx has quit [Quit: WeeChat 1.7]
orbifx1 has joined #ocaml
<davs> Hi! I am using MerlinErrorCheck in vim, but in order to make it work, I had to put 'PKG core' into my .merlin file. Now it works, but now the type annotations from merlin are like 'Core.Std.String.t' instead of string, which gets a bit annoying/long. Is there a way around it?
troydm has quit [Ping timeout: 240 seconds]
cbot has quit [Quit: Leaving]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nightmared has quit [Ping timeout: 252 seconds]
troydm has joined #ocaml
nightmared has joined #ocaml
leah2 has quit [Ping timeout: 240 seconds]
fraggle_ has joined #ocaml
mfp has joined #ocaml
leah2 has joined #ocaml
Algebr has quit [Remote host closed the connection]
AlexDenisov has joined #ocaml
richi235 has joined #ocaml
k1000 has quit [Quit: .]
k1000 has joined #ocaml
leah2 has quit [Ping timeout: 258 seconds]
<orbifx1> ey
<orbifx1> hey
fraggle_ has quit [Ping timeout: 245 seconds]
<infinity0> does anyone know how to use variantslib / fieldslib
<infinity0> there is literally no documentation :/
davs has quit [Quit: leaving]
leah2 has joined #ocaml
<orbifx1> first i hear of them
<orbifx1> what are they infinity0 ?
<infinity0> turning variant constructors and record field getters into first-class functions (like they already are in haskell, sigh)
<infinity0> oh, there is ppx_variants_conv and ppx_fields_conv now
<orbifx1> nice
<orbifx1> that's really handy
<orbifx1> was it not done before because of some backward compatiblity issues?
octachron has joined #ocaml
<octachron> orbifx1, having record getters and setters as "first-class" functions comes with compromises, cf. haskell's record problem
richi235 has quit [Ping timeout: 260 seconds]
richi235 has joined #ocaml
leah2 has quit [Ping timeout: 258 seconds]
<infinity0> it's mostly variant constructors that i miss
<infinity0> "f x y z |> Some" would be nice
<infinity0> or "List.map Some []"
leah2 has joined #ocaml
shinnya has quit [Ping timeout: 260 seconds]
mengu has joined #ocaml
orbifx1 is now known as orbifx
<orbifx> octachron: cfwhat is Haskell's record problem?
govg has quit [Ping timeout: 258 seconds]
<orbifx> did oasis add automatic generation of opam files?
govg has joined #ocaml
<octachron> orbifx, since field accessors are just functions, it is not possible in Haskell to use the same name for two different fields, ie: data A = A { x :: () } data B = B { x :: () } is invalid
<orbifx> ow i see
demonimin has joined #ocaml
demonimin_ has quit [Ping timeout: 240 seconds]
<mrvn> octachron: why is that? Doesn't it notice that is declating a type there and binding a new field instead of using an old one?
<mrvn> s/declating/declaring/
<_y> couldn’t it be solved with type classes?
<orbifx> Need some help, I've added my dependencies in my opam file, pinning it, but opam won't install these dependencies... https://gitlab.com/orbifx/logarion/blob/master/opam
<orbifx> what am I doing wrongly?
<mrvn> type r = {x:int; y:int} If record fields are first class what would the type of x/y then be? r -> int -> r?
<octachron> mrvn, the problem is that ghc required to have distinct selector functions, otherwise the field could not be accessed
<octachron> however, it seems that oveloaded record fields (hhttps://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields) have been integrated in ghc 8.2
demonimin has quit [Ping timeout: 260 seconds]
leah2 has quit [Ping timeout: 255 seconds]
psacrifice has joined #ocaml
<mrvn> octachron: don't see why that would be any different from "let f x = 1 let f x = 2"
<mrvn> implementation wise
<octachron> mrvn, as far as I understand, it is more a question of language design and not an implentation question
<Drup> orbifx: you are confusing opam package names with ocamlfind library names
<Drup> lwt.unix is not an opam package
<Drup> (same for various others)
<orbifx> I've fixed that (not pushed yet)
leah2 has joined #ocaml
<orbifx> is that what broke it?
<orbifx> Drup: ?
<mrvn> orbifx: what do you think?
<orbifx> I should have quoted the error, it's just that it didn't seem to do with that, thus my disbelief
<orbifx> pushing now to try it
<orbifx> fixed, thanks :)
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
igitoor has quit [Ping timeout: 255 seconds]
<mrvn> thinking, no good ever comes from that. :)
igitoor has joined #ocaml
jbrown has quit [Remote host closed the connection]
jbrown has joined #ocaml
igitoor has quit [Changing host]
igitoor has joined #ocaml
ncthom91 has joined #ocaml
<reynir> How do people handle differences in APIs between ocaml versions?
<mrvn> reynir: API or ABI?
<reynir> API :-)
<mrvn> never had a problem yet where the API got incompatible to previous versions I was using.
<mrvn> although ephemerals will bite me.
<haesbaert> reynir: you mean you're breaking the API of a library ?
<reynir> In this case it's Env.lookup_type from compiler-libs
<haesbaert> my handling is just requiring the new one and obsoleting the older ones
<mrvn> how did that change?
<reynir> In 4.04.0 the type is [?loc:Location.t -> Longident.t -> t -> Path.t] while in previous versions it's [?loc:Location.t -> Longident.t -> t -> Path.t * Types.type_declaration]
<mrvn> reynir: that's for building ppx exntensions?
<reynir> mrvn: it's for a this <https://github.com/reynir/ocp-index-top>, a #doc directive that uses ocp-index
<reynir> what I'm trying to solve is when you open a module you want #doc to behave reasonably
_whitelogger has joined #ocaml
<octachron> reynir, one solution might be to have a compatibility module and switch the module implementation depending on OCaml version when building
<octachron> reynir, adding backward compatibility to the type-checker part of compiler-libs would be quite a burden
shinnya has joined #ocaml
<reynir> Yea, I guess. I'm just interested in getting the Path.t.
mengu has quit [Quit: Leaving...]
<mrvn> you could use Obj.magic to see what type you got and access the path no matter what
<mrvn> *duck*
maxirater has joined #ocaml
<reynir> heh
AlexDenisov has joined #ocaml
orbifx has quit [Ping timeout: 260 seconds]
ryanartecona has joined #ocaml
maxirater has quit [Quit: Leaving]
Fistine has quit [Ping timeout: 252 seconds]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nightmared has quit [Ping timeout: 255 seconds]
Fistine has joined #ocaml
nightmared has joined #ocaml
ncthom91 has quit [Quit: Textual IRC Client: www.textualapp.com]
psacrifice has quit []
richi238 has joined #ocaml
richi235 has quit [Ping timeout: 258 seconds]
nomicflux has joined #ocaml
cml has joined #ocaml
pigeonv has joined #ocaml
yurug has joined #ocaml
TarVanimelde has joined #ocaml
TarVanimelde has quit [Client Quit]
shinnya has quit [Ping timeout: 240 seconds]
fraggle_ has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
nomicflux has quit [Quit: nomicflux]
AlexDenisov has joined #ocaml
chamar has joined #ocaml
kakadu has joined #ocaml
orbifx has joined #ocaml
tobiasBora has quit [Ping timeout: 240 seconds]
Fistine has quit [Ping timeout: 240 seconds]
tobiasBora has joined #ocaml
Fistine has joined #ocaml
fds_ is now known as fds
fds has quit [Changing host]
fds has joined #ocaml
chamar has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
octachron has quit [Quit: Leaving]
jfntn has joined #ocaml
cml has quit [Quit: Page closed]
ryanartecona has joined #ocaml
orbifx has quit [Ping timeout: 260 seconds]
Anarchos has joined #ocaml
mengu has joined #ocaml
chamar_ has joined #ocaml
jfntn has quit [Ping timeout: 252 seconds]
ryanartecona has quit [Quit: ryanartecona]
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
selite has joined #ocaml
<selite> How to check whether element is a list in ocaml?
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
jfntn has joined #ocaml
<Drup> List.mem
<selite> Not in a list, but if it is a list.
<selite> like typeof a == 'list' or something xD
<_y> you will never have to, types are static
<selite> well trying to apply function to an entire list but some elements are sublist in that case I wanna call recursively on each element in the sublist.
<Drup> selite: how can some elements be sublists and other not be lists ?
<selite> [[1;2]; 3]
<selite> the head is a list the tail is not a list
<Drup> You can't write that in OCaml :)
<Drup> lists are homogeneous
<Drup> all the elements have the same type
<selite> ah they have to have the same type ok thanks
jfntn has left #ocaml ["ERC (IRC client for Emacs 25.1.1)"]
pigeonv has quit [Quit: WeeChat 1.6]
<mrvn> selite: if you want to test for list you can just "if x == [] then ();" and the compiler makes sure you only ever get a list.
<mrvn> or ignore (x : list)
<mrvn> or ignore (x : 'a list) I mean
<mrvn> if you use it as a list then it can only be a list or the compiler complains.
yurug has quit [Ping timeout: 240 seconds]
<selite> Why does my line to apply a function to each element of a list of numbers results in unbound variable applyFunction. let aplyFunction f l = if (size l) = 0 then l else (f (List.hd l)) :: applyFunction(f (List.tl l));;
<selite> ?
<mengu> selite: let rec
<mengu> selite: and your definition is aplyFunction and you call applyFunction in the body
<selite> Yes fixed the typo and put rec in: let rec applyFunction f l = if (size l) = 0 then l else (f (List.hd l)) :: applyFunction(f (List.tl l));; now it still doesn't work shows errors.
<selite> So if I have [1;2] then recursively it should do this 1 :: 4 ::[];; which should result in my expected answer [1; 4];;
<_y> precising which error would be relevant…
<selite> Error: This expression has type 'a list but an expression was expected of type 'a The type variable 'a occurs inside 'a list
jao has joined #ocaml
<_y> your application of applyFunction is wrong
<_y> “applyFunction(f (List.tl l))”
<selite> Why, am I not just passing in the tail of the list after applying f to the head of it?
<_y> it should be “applyFunction f (List.tl l)”
<selite> oh yeah
<_y> which associates as in “(applyFunction f) (List.tl l)”, because of currying
<selite> Now it works.
<_y> in conventional mathematical notation, what you have written means, well “apply(f(y))”, where you want “apply(f,y)”
kamog has quit [Remote host closed the connection]
<infinity0> does anyone know how to use Unix.recvfrom : file_descr -> bytes -> int -> int -> msg_flag list -> int * sockaddr
<infinity0> there is no documentation for this
<infinity0> ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);
<infinity0> the C function has a slightly different API, it returns the length
<infinity0> it's unclear what the two middle -> ints should be, since presumably "size_t len" and "socklen_t *addrlen" are already implicit in the ocaml "bytes" and "sockaddr" types
oriba has joined #ocaml
<oriba> how can I step forward in ocamldebug to the point, where a certain module is initialized?
<oriba> when seetting a breakpoint at the beginning I get the errmsg, that the module is not initialized so far
<lobo> infinity0: not entierly sure, but i think the first int is the start index and the second is the byte/string length
<selite> Why does this let rec mapMat f m = if (size m) = 0 then m else applyFunction f (List.hd m) :: applyFunction f (List.tl m);; to applyFunction to a list of lists shows errors?
<infinity0> yeah i'm trying to figure it out from this https://github.com/ocaml/ocaml/blob/trunk/otherlibs/unix/sendrecv.c#L51 :/
<selite> _y: Is it same mistake again?
<mrvn> infinity0: all the read/write/send/recv unix functions get a buffer, a start offset and length
<mrvn> All of them should have new versions returning a string.
<mrvn> s/all/all the readers/
<infinity0> hm i'm a bit confused what the input length is supposed to be
<infinity0> maximum number of bytes to read? but i want to read the whole packet
<haesbaert> infinity0: the application needs to provide a buffer to the kernel, so you need to guess a "big enough" buffer.
<infinity0> i guess i'm just slightly confused under what circumstances you would do something other than (.. buffer offset (length buffer - offset) ..)
<haesbaert> well if you think about it, it's already hard to think of a case where offset <> 0
<infinity0> right me too, but i imagined perhaps someone wanted to continually "fill up" a buffer or something
<infinity0> "An optional feature of IPv6, the jumbo payload option, allows the exchange of packets with payloads of up to one byte less than 4 GiB (232 − 1 = 4,294,967,295 bytes), by making use of a 32-bit length field."
<infinity0> goddammit
<haesbaert> that's bollocks
<haesbaert> is it udp or tcp ?
<infinity0> UDP, i guess i'll just go with 65536 for now
<haesbaert> well, 2k would probably do.
<haesbaert> unless you're implementing nfs...
<infinity0> but also i might do this over unix sockets, in which case i might want it bigger
<haesbaert> at any rate, you get the truncated bit in ancillary data if it's too short
<haesbaert> 65k is fine as ong as you don't create one per packet :P
<infinity0> heh, thanks for the tip, i was planning to "for simplicity" but i guess i could keep one around
<haesbaert> I assume you want to get a cstruct out of it
<haesbaert> I mean Cstruct.t
<infinity0> nah the bytes object is fine, i'm just writing a test program
<infinity0> the "real" program wouldn't even need UDP, the packet would be wrapped in an XMPP stanza or something
<infinity0> and i'd avoid this low-level stuff entirely
<haesbaert> well you still need to handle incomplete xmpp records since it's tcp though
<haesbaert> something you don't on udp
<infinity0> i mean, hopefully a library would do that and provide me only with full xmpp stanzas to consume at each step
<infinity0> but yeah, i'll look into that one later :p
<haesbaert> hopefully :P
richi238 has quit [Ping timeout: 255 seconds]
<haesbaert> infinity0: btw, if you don't need the address of the sender, just use Unix.read
<haesbaert> less args than recvfrom
<infinity0> ah, i think i do, to be able to reply though
<infinity0> well it's not essential, but it makes things a bit easier and i also get to test another part of what i'm writing
richi235 has joined #ocaml
kakadu has quit [Remote host closed the connection]
selite has quit [Quit: Page closed]
ryanartecona has joined #ocaml
<infinity0> yay it works
<infinity0> and it can read data that i send it with `nc -uU ./socket`, woop woop
<haesbaert> btw which nc is that ?
richi235 has quit [Ping timeout: 258 seconds]
<haesbaert> nvm, I used to maintain the non gnu nc