adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml MOOC http://1149.fr/ocaml-mooc | OCaml 4.02.3 announced http://ocaml.org/releases/4.02.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
john51_ has quit [Ping timeout: 264 seconds]
seangrove has quit [Ping timeout: 246 seconds]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
kratos has joined #ocaml
<kratos> Anyone can help me to find a functoin that sum first member of two coupleif their second member are equal ? for exemple sum [(a,1);(b,2);(c,3);(d,1);] will return [(a+d,1);(b,2);(c,3)]
orbifx has quit [Ping timeout: 244 seconds]
john51 has joined #ocaml
<kratos> I started to match the two first couple, match p with [] -> acc ... | (a,d)::(c,d)::ll when a = d -> ... I have a problem her how to compar compar (a+c,d) with ll ?
madroach has joined #ocaml
<kratos> correct **when d = d - > ...
<tobast> kratos: I suppose the easiest way would be to use a map, and then convert it back to a list if you need a list.
<mrvn> or hashtbl or sort the list by the second member first
<tobast> Yeah, sorting would work great too
picolino has quit [Ping timeout: 244 seconds]
<mrvn> Hashtbl would be O(n), sorting and map O(n * log n)
madroach has joined #ocaml
<tobast> Yeah, but a hashtable is less OCaml-ish :) (Though it is indeed more efficient)
madroach has quit [Read error: Connection reset by peer]
<mrvn> or: let rec loop = function [] -> [] | (a, b)::zs -> let (xs, ys) = ( List.filter (fun (c, d) -> b = d) zs in (List.fold_left (fun acc (e, f) -> acc + e) a xs, b) :: (loop ys)
<mrvn> O(n^2)
<mrvn> and not tail recursive but you can fix that
madroach has joined #ocaml
mistermetaphor has quit [Remote host closed the connection]
mistermetaphor has joined #ocaml
mistermetaphor has quit [Remote host closed the connection]
silver has quit [Quit: rakede]
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
octachron has quit [Quit: Leaving]
madroach has quit [Read error: Connection reset by peer]
ygrek has quit [Ping timeout: 244 seconds]
yunxing has quit [Read error: Connection reset by peer]
yunxing has joined #ocaml
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
funkatronixxx has joined #ocaml
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
funkatronixxx has quit [Ping timeout: 276 seconds]
badon has joined #ocaml
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
lokien_ has quit [Quit: Connection closed for inactivity]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
libbro has quit [Quit: leaving]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
yunxing has quit [Remote host closed the connection]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
Haudegen has quit [Ping timeout: 252 seconds]
madroach has quit [Read error: Connection reset by peer]
snhmib has quit [Quit: WeeChat 1.3]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
Haudegen has joined #ocaml
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
<Drup> "Where rectypes matter for performance reasons" ♥
madroach has joined #ocaml
mistermetaphor has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
noddy has joined #ocaml
madroach has joined #ocaml
<def`> If you are using custom_ops, I don't see why you need modular implicits... you already have adhoc comparator
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
yunxing has joined #ocaml
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
mistermetaphor has quit [Remote host closed the connection]
kratos has quit [Ping timeout: 250 seconds]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
funkatronixxx has joined #ocaml
noddy has quit [Ping timeout: 250 seconds]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
funkatronixxx has quit [Ping timeout: 248 seconds]
pierpa has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
darkf has quit [Read error: Connection reset by peer]
darkf has joined #ocaml
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
Madars has quit [Ping timeout: 260 seconds]
madroach has quit [Read error: Connection reset by peer]
JacobEdelman_ has joined #ocaml
madroach has joined #ocaml
Sorella has quit [Quit: Connection closed for inactivity]
Madars has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
demonimin has quit [Ping timeout: 276 seconds]
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
d0nn1e has quit [Ping timeout: 244 seconds]
d0nn1e has joined #ocaml
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
ousado has quit [Ping timeout: 260 seconds]
madroach has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
madroach has quit [Read error: Connection reset by peer]
funkatronixxx has joined #ocaml
madroach has joined #ocaml
funkatronixxx has quit [Ping timeout: 264 seconds]
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has joined #ocaml
kushal has quit [Ping timeout: 260 seconds]
madroach has quit [Read error: Connection reset by peer]
aantron has quit [Remote host closed the connection]
mistermetaphor has joined #ocaml
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
slash^ has joined #ocaml
kushal has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
Vintila has joined #ocaml
JacobEdelman_ has quit [Quit: Connection closed for inactivity]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
struk|desk|away is now known as struk|desk
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
MercurialAlchemi has joined #ocaml
madroach has joined #ocaml
badon has quit [Disconnected by services]
badon_ has joined #ocaml
badon_ is now known as badon
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
funkatronixxx has joined #ocaml
A1977494 has joined #ocaml
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
struk|desk is now known as struk|desk|away
funkatronixxx has quit [Ping timeout: 276 seconds]
badon has quit [Disconnected by services]
badon_ has joined #ocaml
badon_ is now known as badon
matason has joined #ocaml
madroach has joined #ocaml
toolslive has quit [Remote host closed the connection]
madroach has quit [Read error: Connection reset by peer]
matason has quit [Ping timeout: 250 seconds]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
orbifx has joined #ocaml
cdidd has quit [Remote host closed the connection]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
cdidd has joined #ocaml
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
matason has joined #ocaml
madroach has joined #ocaml
madroach has joined #ocaml
mistermetaphor has quit [Remote host closed the connection]
madroach has quit [Read error: Connection reset by peer]
funkatronixxx has joined #ocaml
Vintila has quit [Ping timeout: 244 seconds]
FreeBirdLjj has joined #ocaml
madroach has joined #ocaml
funkatronixxx has quit [Ping timeout: 252 seconds]
madroach has quit [Read error: Connection reset by peer]
FreeBird_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 260 seconds]
struk|desk|away is now known as struk|desk
madroach has joined #ocaml
FreeBird_ has quit [Remote host closed the connection]
madroach has quit [Read error: Connection reset by peer]
tane has joined #ocaml
matason has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
funkatronixxx has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
yunxing has quit [Remote host closed the connection]
matason has joined #ocaml
madroach has joined #ocaml
leyyin has joined #ocaml
matason has quit [Ping timeout: 276 seconds]
larhat has joined #ocaml
Kakadu has joined #ocaml
Haudegen has quit [Ping timeout: 260 seconds]
picolino has joined #ocaml
funkatronixxx has quit [Quit: leaving]
silver has joined #ocaml
Simn has joined #ocaml
solrize has quit [Ping timeout: 268 seconds]
DanielRichman has quit [Quit: leaving]
DanielRichman has joined #ocaml
haesbaert has joined #ocaml
tane has quit [Quit: Verlassend]
butts_butts has joined #ocaml
Haudegen has joined #ocaml
infinity0 has quit [Ping timeout: 268 seconds]
infinity0 has joined #ocaml
solrize has joined #ocaml
struktured has joined #ocaml
Vintila has joined #ocaml
struktured has quit [Ping timeout: 244 seconds]
matason has joined #ocaml
meteo has joined #ocaml
<meteo> Hi All,
<meteo> what's the latest stable release I should be installing with opam?
<meteo> 4.02.3
<meteo> or something else?
<meteo> opam installation doc at https://opam.ocaml.org/doc/Usage.html says 4.02.1
<meteo> But my debian instance had 4.02.3
<meteo> via apt
snhmib has joined #ocaml
<meteo> ok, to answer my own question, looks like http://caml.inria.fr/pub/distrib/ suggests 4.02.3
<Khady> Yep, 4.02.3
listing has joined #ocaml
struk|desk is now known as struk|desk|away
copy` has joined #ocaml
<meteo> thanks Khady
darkf has quit [Ping timeout: 268 seconds]
TheLemonMan has joined #ocaml
<Maelan> (4.03 coming soon, though ;-)
<flux> not all the packets build with 4.03 though, so perhaps not the best idea to start with that ;)
<flux> why do people define this super-strict dependencies?-( [ERROR] ocamlorg is not available because your system doesn't comply with ocaml-version = "4.01.0".
<flux> though it's easy to switch, it just take time..
malc_ has joined #ocaml
sz0 has quit [Quit: Connection closed for inactivity]
Vintila has quit [Ping timeout: 248 seconds]
<listing> how to add a couple in list of couple ?
<flux> well, lists are immutable, so the best you can do is to create a list built out of the new element and the old list
<flux> by couple you mean 2-tuple, ie, (4, 2)?
<listing> like (a,b)
<flux> (new, element)::list gives you a list where the (new, element) is at the beginning
<flux> so you want to go from [(x, a), (y, b), (z, a)] to [(x + z, a), (y, b)]
<flux> seems a lot like homework, btw :P
<listing> yes
<flux> what's the problem? there is no method for doing that out-of-the-box.
<flux> I mean, what's the problem you're facing first when solving it that is :)
<listing> I have an acc, match if (x,a) appear in, if not add (x,a) into acc => [ (x,a) ]
<listing> for each coupl check if (_,k) appear in the acc
<flux> do you know how to use Map or Hashtbl?
<listing> so my first problem is how to add a coupl into a list of couple
<listing> no
<listing> It's possibl to do a simple function that can do what I want
<listing> ?
<flux> it's possible but I think it would be a bit complicated, not simple
<listing> Ok so I was not so noob
<flux> basically the way I view the problem is that you want to find the sum of the x/y/z grouped by the "variable" on a/b on the right side
<listing> yes
<flux> so I would go through the list and keep track of the sum for each right-side variable; if there is no such variable, add it, otherwise use the previous value as the base for summing it
<listing> tha'ts what I want to do
<flux> and then just once again iterate the list and replace the left-side value with the sum _and_ remove the variable; and if there's no match for the variable in our data structure, remove it altogether while iterating
larhat has quit [Quit: Leaving.]
<listing> p : [(x, a), (y, b), (z, a)] and acc : [ ] , append (x,a) acc -> [(x,a)] , for the rest of p , check if (_,a) in general if (_,k) appears in the acc
<listing> if not append (y,b) into acc or group by a , tha'ts what you want to do no ?
<flux> seems like that's the beginning of the solution
<listing> but first how to add a coupl into list of coupl
<flux> let list_with_new_elements (a, b) old_list = (a, b)::old_list
<flux> if you want to do it with mutation, you can use 'ref' to do it. however, if you haven't been taught about ref, then perhaps you shouldn't use it.
<mrvn> note that that is O(n^2)
<flux> yeah I think they are not yet worrying about algorithmic complexity if they don't know abuot Map or Hashtbl..
<mrvn> Ok, lets keep it simple then. :)
<listing> flux how ocanl know that old:list is a list
<listing> ocaml*
<flux> listing, because it's used in a list-context
<flux> listing, or in other words: by cause on type inference
<mrvn> First thing I would do is to reverse the tuples: ('a * 'b) list -> ('b * 'a) list. That way you can use the "Association lists" part of the Lists module.
<mrvn> listing: "::" is an operator: 'a -> 'a list -> 'a list.
<listing> ok ok
orbifx has quit [Ping timeout: 268 seconds]
matason has quit [Ping timeout: 276 seconds]
<listing> thought that I must writ []
<mrvn> listing: just like "+" makes ocaml infere that the arguments must be in the "::" makes it infere that the second argument must be a list.
<listing> nice
<listing> thanks
<mrvn> s/must be in/must be int/
<mrvn> And since the first argument is a tuple it inferes that the seconds must be a list of tuples and so on.
<listing> What do you mean by Association lists ? do you have an example ?
<flux> association lists are pairs of lists just like yours, except they are used for finding the second pair given the first pair
<flux> no doubt in your assignment the pairs have been switched around to make it more annoying to solve ;)
<mrvn> let x = [(1, "foo"); (2, "bar"); (3, "baz")] List.assoc 2 x;;
<mrvn> val x : (int * string) list = [(1, "foo"); (2, "bar"); (3, "baz")]
<mrvn> - : string = "bar"
<mrvn> listing: did you learn about exceptions yet?
matason has joined #ocaml
<mrvn> flux: too bad there isn't a List.assoc_all : 'a -> ('a * 'b) list -> 'b list
<flux> well it's not too bad, I doubt I have ever had a use for it :)
<listing> mrvn yes
Simn has quit [Quit: Leaving]
orbifx has joined #ocaml
octachron has joined #ocaml
<mrvn> let sum = List.fold_left (fun res (a, b) -> (function ([(c, _)], xs) -> (a + c, b) :: xs | (_, xs) -> (a, b) :: xs) (List.partition (fun (_, d) -> b = d) res)) []
<mrvn> sum [(1, 1); (2, 2); (3, 1); (4, 2)];;
<mrvn> - : (int * int) list = [(6, 2); (4, 1)]
<mrvn> val sum : (int * '_a) list -> (int * '_a) list = <fun>
<mrvn> listing: That's what you want, right?
dhil has joined #ocaml
matason has quit [Ping timeout: 240 seconds]
<mrvn> let sum = List.fold_left (fun res (a, b) -> match List.partition (fun (_, d) -> b = d) res with ([(c, _)], xs) -> (a + c, b) :: xs | (_, xs) -> (a, b) :: xs) [];;
<mrvn> probably the shortest you can do with lists.
ggole has joined #ocaml
octachron_ has joined #ocaml
<listing> thanks mrvn I'll give you what iv done
octachron has quit [Ping timeout: 260 seconds]
octachron_ has quit [Read error: Connection reset by peer]
butts_butts has quit [Ping timeout: 244 seconds]
dsheets has joined #ocaml
octachron_ has joined #ocaml
A1977494 has quit [Ping timeout: 260 seconds]
<Maelan> looks like this tutorial is outdated and there has been incompatible changes to ctypes since then
AlexRussia has quit [Ping timeout: 248 seconds]
<Maelan> and i do not find how to do the qsort thing
<Maelan> specifically, how you deal with c function pointers, and how you get a c function pointer from an ocaml function
<Drup> Maelan: it's explained in the ctypes documentation
<Maelan> the tuto uses a function “funptr”, presumably of type “('a -> 'b) fn -> ('a -> 'b) typ”
<Maelan> the closest function i found in the doc is “static_funptr : 'a fn -> 'a static_funptr typ”
<Maelan> (which is not even documented here: http://ocamllabs.github.io/ocaml-ctypes/Ctypes.html)
<Drup> Yes, and you can then use Ctypes.coerce to turn (a'->'b) static_funptr into a ('a -> 'b)
<Drup> Maelan: it's in the include
<Maelan> oh, right
A1977494 has joined #ocaml
pierpa has joined #ocaml
<Maelan> okay, i did not think it was so straightforward
<Drup> me neither, I had to ask yallop to understand about the coerce
<flux> yeah, when I find a function called "coerce" it sounds like "I can call it but it doesn't mean it will work" :-).
<Drup> Same
<Maelan> it is not documented in the description of coerce
<Drup> Maelan: there is ticket about it
<Maelan> okay
<Maelan> still, how do i build a value of type “(a -> b) typ”, to feed it to coerce?
<Drup> Foreign.funptr
<Maelan> ah, oh
AlexRussia has joined #ocaml
picolino has quit [Ping timeout: 268 seconds]
TheLemon1an has joined #ocaml
TheLemon1an has quit [Client Quit]
picolino has joined #ocaml
<flux> "OCaml release 4.03.0 will arrive in about 2 weeks. We have created a second beta version for your testing pleasure."
<flux> yesterday's news, but I guess it's not an april fools ;)
<flux> there is no 4.03.0+beta2+flambda in opam yet, though there was one for beta1
<flux> hmm, I guses 4.03.0+trunk+flambda is sufficient
sfri has quit [Remote host closed the connection]
sfri has joined #ocaml
aantron has joined #ocaml
tane has joined #ocaml
dsheets has quit [Remote host closed the connection]
matason has joined #ocaml
dhil has quit [Ping timeout: 244 seconds]
FreeBirdLjj has joined #ocaml
leyyin has quit [Remote host closed the connection]
sh0t has joined #ocaml
dsheets has joined #ocaml
yunxing has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
shinnya has joined #ocaml
octachron__ has joined #ocaml
tane has quit [Quit: Verlassend]
noddy has joined #ocaml
octachron_ has quit [Ping timeout: 244 seconds]
Simn has joined #ocaml
Sorella has joined #ocaml
orbifx has quit [Ping timeout: 250 seconds]
struk|desk|away is now known as struk|desk
yunxing has quit [Remote host closed the connection]
sh0t has quit [Ping timeout: 248 seconds]
sh0t has joined #ocaml
butts_butts has joined #ocaml
matason has quit [Ping timeout: 244 seconds]
matason has joined #ocaml
vpm has quit [Quit: co'o]
vpm has joined #ocaml
sh0t has quit [Ping timeout: 248 seconds]
<butts_butts> Hi all. I'm fairly new to Ocaml, and currently am trying use the Websocket_lwt lib. There aren't many examples of its usage that I can find, but one I did find uses Conduit to create some of the required stuff for creating a basic server.
sh0t has joined #ocaml
<butts_butts> However, I can't get Conduit stuff to compile. Specifically calls to Resolver_lwt_unix
<butts_butts> Keeps telling me that Resolver_lwt_unix is an undefined global.
<butts_butts> I've opam installed conduit (which seems to also contain all this Resolver stuff). I've tried doing open Resolver, open Resolver_lwt_unix, open Conduit_lwt_unix
<butts_butts> In the source file where I'm calling the function
<butts_butts> No joy.
<butts_butts> I'm.. completely out of ideas.
<malc_> butts_butts: erm.. are you compiling it or trying in the repl?
<butts_butts> Compiling it
<butts_butts> In my make file I have
<butts_butts> ocamlbuild srcfile -libs nums -pkgs websocket,conduit,lwt,mirage
<butts_butts> I added lwt and mirage as last-resort attempts to solve it, but yeah
<butts_butts> Didn't help]
<malc_> butts_butts: not familiar with ocamlbuild, nor lwt/etc to be honest, you better wait for someone more intimate with those things to appear here...
<malc_> that said, which library should provide the Resolver_lwt_unix symbol?
<butts_butts> Aye ok. :)
<butts_butts> Well it seems to be inside the ocaml_conduit library
<octachron__> have you tried "ocamlbuild -use-ocamlfind ... " ?
<butts_butts> This is the source file. I'm trying to call the system function.
<butts_butts> octachron__: yup.
<butts_butts> Still the same 'undefined global' thing.
<butts_butts> I'm not well versed enough in Ocaml to know if I'm just like, importing the module incorrectly or something.
ril has joined #ocaml
<malc_> butts_butts: .mli is not source though, it's an interface of sorts
ril has quit [Client Quit]
<butts_butts> Ok, but isn't it basically like a header in C?
<butts_butts> This is the impl, right?
<malc_> butts_butts: a. sortof
<malc_> b. yeah
noddy has quit [Ping timeout: 244 seconds]
<butts_butts> Sort of?
<butts_butts> In what way is it different to C's header/implementation seperation?
<butts_butts> separation*
<octachron__> briefly, OCaml has a proper module system, where module are a first class language construct, with for instance functor i.e function from module to module
<malc_> butts_butts: basically, what octachron__ said (and then some)
<butts_butts> OK
<butts_butts> So if the Conduit package has some sub-module(?) called Resolver_lwt_unix
<butts_butts> If you are correctly linking to the Conduit package, is there some way that you would then normally access Conduit's sub-modules (again, not sure if sub-module is the right term)
<butts_butts> Conduit.Resolver_lwt_unix blah or something?
jknick has quit [Ping timeout: 260 seconds]
jknick has joined #ocaml
<octachron__> butts_butts, ok I have found the problem, you need to use the conduit.lwt-unix subpackage: "ocamlbuild -use-ocamlfind -package conduit.lwt-unix yourfile.native"
tane has joined #ocaml
shinnya has quit [Ping timeout: 264 seconds]
mistermetaphor has joined #ocaml
orbifx has joined #ocaml
dsheets has quit [Remote host closed the connection]
d0nn1e has quit [Ping timeout: 244 seconds]
d0nn1e has joined #ocaml
struk|desk is now known as struk|desk|away
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<flux> cool, I had missed this: - PR#6468: toplevel now supports backtraces if invoked with OCAMLRUNPARAM=b (whitequark and Jake Donham, review by Gabriel Scherer and Jacques-Henri Jourdan)
Algebr` has joined #ocaml
<companion_cube> nice
sh0t has quit [Ping timeout: 268 seconds]
dsheets has joined #ocaml
<Drup> I'm both impressed and depressed. tyxml manage to make the compiler loose track of covarianace.
<Drup> # Html5.Xml.W.nil () ;;
<Drup> - : '_a list = []
<companion_cube> ôO
<companion_cube> wait, it's normal, isn't it? due to the ()
mistermetaphor has quit [Remote host closed the connection]
<Drup> No, it's not normal
dsheets has quit [Remote host closed the connection]
<Drup> # let x : _ list = Html5.Xml.W.nil () ;;
<Drup> val x : 'a list = []
ril has joined #ocaml
<flux> ..did you find a bug in ocaml?
<Algebr`> Drup -- Compiler buster.
<Drup> That happens often, it's not a soudness bug, so it's not terrible
sh0t has joined #ocaml
butts_butts has quit [Ping timeout: 244 seconds]
noddy has joined #ocaml
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
yegods has joined #ocaml
noddy has quit [Ping timeout: 276 seconds]
dsheets has joined #ocaml
dsheets has quit [Remote host closed the connection]
hydan has quit [Quit: hydan]
<Algebr`> has anyone released a opam created binary on homebrew ?
<Drup> https://bpaste.net/show/e48b49a1f183 minimal test cases for the thing above
<Drup> I understand why it happens now, at least. Still weird :/
<Algebr`> merlin doesn't give me errors/warnings.
<Algebr`> and z says 'a list
<Drup> yes, the error is in x
<Algebr`> ah, '_a list
octachron__ has quit [Read error: Connection reset by peer]
<flux> same in 4.03.0+beta1
Haudegen has quit [Ping timeout: 276 seconds]
<flux> (as with 4.02.3)
butts_butts has joined #ocaml
leyyin has joined #ocaml
mort___ has joined #ocaml
octachron__ has joined #ocaml
picolino has quit [Ping timeout: 248 seconds]
copy` has quit [Quit: Connection closed for inactivity]
Haudegen has joined #ocaml
octachron_ has joined #ocaml
picolino has joined #ocaml
octachron_ has quit [Client Quit]
octachron__ has quit [Ping timeout: 244 seconds]
Kakadu has quit [Quit: Page closed]
kushal has quit [Ping timeout: 244 seconds]
yegods has quit [Remote host closed the connection]
yegods has joined #ocaml
fs4lv1n1 has joined #ocaml
yegods has quit [Remote host closed the connection]
yegods has joined #ocaml
<fs4lv1n1> I've installed pgocaml with opam but when i try to compile with: ocamlfind ocamlc -package pgocaml,pgocaml.syntax -syntax camlp40 db.ml
<fs4lv1n1> i get: ocamlfind: Package `pgocaml.syntax' not found
<fs4lv1n1> what I'm missing?
kushal has joined #ocaml
mistermetaphor has joined #ocaml
<Algebr`> check if it exists indeed, `ocamlfind list | grep pgocaml`
<fs4lv1n1> Algebr`: there is only pgocaml
marcimoto has joined #ocaml
<marcimoto> hi
<Algebr`> depopts: camlp4 for pgocaml, it seems you didn't have camlp4 installed when you install pgocaml
Haudegen has quit [Ping timeout: 244 seconds]
<Algebr`> marcimoto: hi
<marcimoto> ocamlc -thread unix.cma threads.cma thread.ml
<marcimoto> Error: Unbound module Thread
<fs4lv1n1> Algebr`: that was the reason, thx
marcimoto has quit [Client Quit]
<fs4lv1n1> now I get: No level labelled "top" in entry "expr" \ Failure: "Grammar.extend"
matason has quit [Ping timeout: 250 seconds]
<Algebr`> dafuk, that's some kind of camlp4 issue i think.
<fs4lv1n1> is pgocaml the best way to connect to postgres or should I use something else?
<Algebr`> of course this is opinion, but I prefer `opam info postgresql`
<fs4lv1n1> I don't have specific requirements, opinions are well accepted
<Drup> pgocaml is easier to use, works well with lwt and provides query validation
<fs4lv1n1> yeah, I liked the features but I can't even get the example to work
listing has quit [Quit: Page closed]
mistermetaphor has quit [Remote host closed the connection]
picolino has quit [Ping timeout: 260 seconds]
noddy has joined #ocaml
picolino has joined #ocaml
ggole has quit []
sh0t has quit [Ping timeout: 250 seconds]
BitPuffin has joined #ocaml
BitPuffin has quit [Disconnected by services]
<Algebr`> Drup: why does postgresql not work well with lwt?
<Drup> it's not blocking ?
Haudegen has joined #ocaml
dsheets has joined #ocaml
t4nk569 has joined #ocaml
mort___ has quit [Quit: Leaving.]
dsheets has quit [Ping timeout: 250 seconds]
slash^ has quit [Read error: Connection reset by peer]
picolino has quit [Ping timeout: 244 seconds]
Anarchos has joined #ocaml
orbifx has quit [Ping timeout: 276 seconds]
larhat has joined #ocaml
d0nn1e has quit [Ping timeout: 260 seconds]
d0nn1e has joined #ocaml
<flux> I suppose it works well if you use the external thread functionality of lwt
<Algebr`> ie Lwt_preemptive?
<Drup> Yes, but it's not really optimal (and much slower)
<Algebr`> can you elaborate
<Drup> hey I wonder if you could run pgocaml in javascript
Kakadu has joined #ocaml
<Drup> it could work, it's pure ocaml
<Drup> x)
<Algebr`> ha, not a bad idea
<Algebr`> I haven't touched jsoo in a little bit.
<Algebr`> would be nice if ocaml compiler accepted the iOS arm backend support and JS.
<Drup> Algebr`: For some time, preemptive was not available everywhere. I think it's better now. It's still spawning threads, though
<flux> so much red here that there should be special awards for folks that write cross-version-compatible packages :P http://opam.ocamlpro.com/builder/html/report-last.html
<Drup> (and It's clearly not available in js)
<Algebr`> why is spawning real threads an issue though, i mean of course it wouldn't be free but how expensive...
<Algebr`> flux: I'm guilty as well, need to fix some c++ crap.
<Drup> Algebr`: much more expansive than spawning lwt threads ;)
<flux> pgocaml doesn't yet support ssl, does it?
tennix has quit [Ping timeout: 246 seconds]
<Drup> flux: mostly core/async, and it's on purpose :)
<flux> drup, what purpose might that be?
<Drup> they don't keep compat with old OCaml version
<Drup> let's say "by design" rather than "on purpose"
<flux> so once the release comes out, we get to actually test all the stuff that depends on async, and thus find the bugs :P
<flux> is async just rewritten completely on the spot or why can't it also release a "beta" branch version..
tennix has joined #ocaml
<Drup> flux: Note that this is "not instalable", not "not buildable"
<Drup> it's only the sat query
<fs4lv1n1> ls
<fs4lv1n1> ops
<flux> drup, nevertheles, seems highly inconvenient
<flux> opam was supposed to be the system that picks&builds the packages for us.. :)
copy` has joined #ocaml
<flux> I guess the reality isn't that grim, I imagine many of the packages depend on host libraries that aren't properly indicated in the dependencies..
<flux> https://github.com/mlin/should.ml "x $hould # equal 123"
* Drup shivers
<flux> "list x $houldn't # be # empty" - apparently ocaml can do rubyesque stuff just fine ;)
<companion_cube> bleh
<companion_cube> really, what is this useful for...
<flux> calling f "" $hould # raise # exn # prefixed "Invalid_argument"; (* see, plain english *)
<Algebr`> so OCaml on occulus.
<Algebr`> just need bindings to Unreal C++...
<Algebr`> Who is up for it?
<flux> seems to me vive's product is going to get linux support sooner
<Algebr`> what's vive, some competitor?
<mrvn> I wonder if I could have a ppx plugin that outputs C++ stub code as a side effect of compiling the ml file.
<flux> algebr`, yep
<flux> mrvn, sure?
<flux> there is only the small matter of writing said ppx plugin :)
<flux> btw, there's also now a trick..technique to acquire types of the ocaml code in ppx
<mrvn> I want to write: class virtual foo = object(self) method bla : unit = [%external "bla_stub"] end
<mrvn> flux: any example?
<flux> mrvn, ppx_curried_constr is a "simple" example
<flux> and then there's ppx_implicits for a complicated one
<mrvn> would be cool to infere the type of bla or use type annotations to generate the stubs.
<flux> basically the trick is using ocaml type checker from within the ppx
<mrvn> flux: only in 4.03, right?
mistermetaphor has joined #ocaml
<flux> nope, I've compiled it for 4.02.3 as well
<Drup> You can do it on both
<Drup> it's .. not simple, though
<Drup> Like, try everything else before doing that
<flux> :-)
<flux> or just try this first, because it's cool!
<mrvn> doing just that %external above is a nightmare already.
picolino has joined #ocaml
<mrvn> anyone know what this new [@unboxed] thing is?
mistermetaphor has quit [Ping timeout: 244 seconds]
<flux> I _think_ it at least allows passing integers to c like they are plain c integers.
<Algebr`> ints were already unboxed.
<mrvn> flux: wasn't there an [@untagged] for that? I think unboxing is for doubles.
<flux> oh, I probably confused it with that
<mrvn> or nativeint, int32, int64
<malc_> mrvn: Changes list this under GPR#167
octachron has joined #ocaml
yegods has quit [Remote host closed the connection]
<malc_> mrvn: i.e. https://github.com/ocaml/ocaml/pull/167 (i supose)
yegods has joined #ocaml
<octachron> the dev version of the manual also have a quite good documentation for these new [@@noalloc], [@unboxed], [@untagged] attributes
<Algebr`> where's the dev version
<Algebr`> people are going ppx crazy, feel like I'm missing out on this craze
<mrvn> why does noalloc have 2 @@?
<octachron> Algebr`, on the main github repository if you read latex
<octachron> mrvn, because it is applied to a whole external function declaration (i.e at the item level) rather than to a specific argument
<Algebr`> thanks!
<octachron> mrvn, i.e: "external sqrt : (float[@unboxed]) -> (float[@unboxed]) = "sqrt" [@@noalloc]"
<mrvn> Now that naked pointers will be forbidden someone should add [@naked]
<flux> mrvn, you missed your chance by a day
* Anarchos will have his future google requests to ocaml doc blocked by work proxy.... naked ? blocked !
<mrvn> No results found for ocaml @naked.
picolino has quit [Ping timeout: 264 seconds]
<flux> did I see rule 34 invoked?!
<mrvn> flux: how about [@sex] for sign extend?
<Algebr`> octachron: wait, so this works only for the beta compiler right, not for current
<octachron> for those interested, the manual documentation source for [@unboxed] and friends is here: https://github.com/ocaml/ocaml/blob/trunk/manual/manual/cmds/intf-c.etex#L1914
<octachron> Algebr`, yes, these attributes are for versions ≥4.03
<Algebr`> it seriously takes so much time so actually learn a language.
<Algebr`> to*
<Algebr`> octachron: thanks for link
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
foocraft has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
malc_ has quit [Quit: ERC (IRC client for Emacs 25.0.50.2)]
mistermetaphor has joined #ocaml
butts_butts has quit [Ping timeout: 268 seconds]
MercurialAlchemi has quit [Ping timeout: 250 seconds]
mistermetaphor has quit [Remote host closed the connection]
kolko has quit [Read error: Connection reset by peer]
mistermetaphor has joined #ocaml
silver has quit [Quit: rakede]
darkf has joined #ocaml
<Algebr`> Drup: postgresql author doesn't want to provide lwt layer, promptly closed any discussion of it, looks like I will change my tune to pgocaml
swistak35 has quit [Ping timeout: 260 seconds]
<Algebr`> one thing is that it looks like it does queries at compile time?
Drup has quit [Ping timeout: 260 seconds]
Drup has joined #ocaml
swistak35 has joined #ocaml
<Algebr`> and no ppx, which would make merlin usage better, might be good excuse for me to get hands dirty with ppx
octachron has quit [Quit: Leaving]
leyyin has quit [Quit: So Long, and Thanks for All the Fish]
t4nk569 has quit [Ping timeout: 250 seconds]
<def`> Algebr`: from what I remembee pgocaml was easy to parametrize by any monad
snhmib has quit [Quit: WeeChat 1.3]
ril has joined #ocaml
d0nn1e has quit [Ping timeout: 260 seconds]
d0nn1e has joined #ocaml
sh0t has joined #ocaml
gpietro_ has joined #ocaml
sh0t has quit [Ping timeout: 268 seconds]
Simn has quit [Quit: Leaving]
Kakadu has quit [Remote host closed the connection]
noddy has quit [Ping timeout: 244 seconds]
AJavaIdiot has joined #ocaml
infinity0 has quit [Ping timeout: 244 seconds]
<AJavaIdiot> Hi everyone! I ran into a problem with a function and was wondering if anyone could help me with it (or just point me towards what to search to find an answer)
<tane> reveal the problem :)
<AJavaIdiot> This function blows my stack. I tried sticking a print_string ; before the cons, and it seems as if it first tries to evaluate (loadList ci) before (loadCache ci)
<AJavaIdiot> So far so good, but my question is: Is there a specified evaluation order for expressions (that do not involve ; obviously), or is it completely implementation-defined?
<copy`> It seems that you have an infinite loop because you call loadList with its original input
<AJavaIdiot> Meaning that on some implementations this functions could behave properly (if the head got evaluated first, raising an exception) and badly on others
<AJavaIdiot> Ah, sorry, I should've specified: ci is an input channel (stream? I'm not sure of the word to use), and loadCache consumes elements from it
<AJavaIdiot> Basically, I think I understand why it's blowing up, but I wanted to know if it's due to *ocaml* or due to *my implementation of the ocaml language*
<AJavaIdiot> Also, sorry for all the spam haha :P
infinity0 has joined #ocaml
<copy`> I'm actually not sure about evaluation order in this case, if you want a well-defined evaluation order you can use let bindings
<Drup> usually, it's right to left
<Drup> which would trigger an infinite loop here.
<Drup> you shouldn't rely on it anyway
<AJavaIdiot> I'll mess around a bit with lets and see what it gets me. It doesn't matter much anyway, since I already have another version of this function that works
<AJavaIdiot> Also, in the interest of full disclosure: This is part of a project for university
<Drup> AJavaIdiot: This version is very bad for multiple reasons
<Drup> the reason above is one
<AJavaIdiot> Drup: By "usually" you mean that it's implementation-defined, right?
<Drup> the second reason is that it creates a new handler a each stage,
<Drup> evaluation order is unspecified
<AJavaIdiot> I'm not familiarised with that term
<Drup> Which one ? :)
<AJavaIdiot> Alright, that was the crux of my problem :)
<AJavaIdiot> "handler"
<Drup> exception handler
<Drup> the try with ...
<AJavaIdiot> Ah
madroach has quit [Ping timeout: 252 seconds]
<AJavaIdiot> There's no way to avoid creating a new handle at each recursive call if I need the exception to be caught inside the function though, right?
tani has joined #ocaml
<AJavaIdiot> I mean, in an hypothetical world where the left-side of the cons were getting evaluated first, I'd need to catch the End_of_file from loadCache to have a base case
<AJavaIdiot> And there'd be no way around that, would there?
madroach has joined #ocaml
<Drup> there are, but I'll let you think about it :)
<AJavaIdiot> Could you give me a keyword or something to point me in the right direction though? I really have no clue :p
tane has quit [Ping timeout: 244 seconds]
twobitsprite has quit [Quit: Lost terminal]
tani has quit [Quit: Verlassend]
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
raxello has joined #ocaml
<raxello> hi all. I am a beginner in OCaml world. Do I understand correctly that oasis is a recommended way to configure my project ?
<mrvn> it certainly is a good way
ril has joined #ocaml
ril has quit [Client Quit]
A1977494 has quit [Ping timeout: 276 seconds]