ChanServ changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.02.1 announcement at http://ocaml.org/releases/4.02.html | Public channel logs at http://irclog.whitequark.org/ocaml
rgrinberg has joined #ocaml
<Algebr> How do the printf functions work? Is there like a canonical blog post about it?
avsm has quit [Quit: Leaving.]
<smondet> (the `Printf` module is older than the word “blog” :) )
s1n4 has quit [Ping timeout: 264 seconds]
_pakchoi_ops has joined #ocaml
thomasga has quit [Quit: Leaving.]
<Algebr> smondet: yea, I read that, was curious about something like lower level than that, but i guess its a silly itch.
Simn has quit [Quit: Leaving]
rgrinberg has quit [Ping timeout: 256 seconds]
mort___1 has quit [Quit: Leaving.]
madroach has quit [Ping timeout: 264 seconds]
<Algebr> do either lwt or async offer like a choice in scheduling policy? or does that not make sense?
madroach has joined #ocaml
WraithM has quit [Quit: leaving]
tnguyen has quit [Quit: tnguyen]
idegen has joined #ocaml
rgrinberg has joined #ocaml
Denommus has joined #ocaml
MrScout has quit [Quit: Leaving...]
MrScout_ has joined #ocaml
tnguyen has joined #ocaml
Denommus has quit [Quit: Bye]
reem has quit [Remote host closed the connection]
ghostpl_ has joined #ocaml
WraithM has joined #ocaml
ghostpl_ has quit [Ping timeout: 256 seconds]
ygrek has joined #ocaml
shinnya has joined #ocaml
The_Mad_Pirate has joined #ocaml
reem has joined #ocaml
reem has quit [Remote host closed the connection]
<struktured> any ocamlers going to mlconf tomorrow?
<struktured> sorry, I should say, any nyc ocamlers going to mlconf?
<meteo> In terms of file and socket IO, lwt just waits on a select() call. It's up to the OS how it deals with those resources
kdef has quit [Quit: Leaving]
badkins has quit []
kdef has joined #ocaml
tnguyen has quit [Quit: tnguyen]
reem has joined #ocaml
reem has quit [Remote host closed the connection]
reem has joined #ocaml
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
reem has quit [Remote host closed the connection]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
darkf has joined #ocaml
<Algebr> Does anyone have an example of using Yojson where the input data doesn't start with json but rather you make json out of it. Something like Yojson.empty, then Yojson.add or whatnot.
reem has joined #ocaml
reem has quit [Remote host closed the connection]
cdidd has joined #ocaml
manizzle has quit [Ping timeout: 264 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
tnguyen has joined #ocaml
tnguyen has quit [Client Quit]
ghostpl_ has joined #ocaml
reem has joined #ocaml
swgillespie has joined #ocaml
swgillespie has quit [Client Quit]
ghostpl_ has quit [Ping timeout: 248 seconds]
manizzle has joined #ocaml
<struktured> grrrr..over 30 minutes to a resolve a cycle in my build system with one line change in two files. sigh
<Algebr> so painful.
<struktured> I've been refactoring a project into individual module libraries. this has happened several times in the process already. it's sneaky open Statements that are usually my root cause.
manizzle has quit [Ping timeout: 245 seconds]
reem has quit [Remote host closed the connection]
reem has joined #ocaml
struktured has quit [Read error: Connection reset by peer]
struktured has joined #ocaml
MrScout_ has quit [Ping timeout: 256 seconds]
ghking has joined #ocaml
idegen has quit [Ping timeout: 252 seconds]
rgrinberg has quit [Quit: WeeChat 1.1.1]
manizzle has joined #ocaml
swgillespie has joined #ocaml
manizzle has quit [Max SendQ exceeded]
badon has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest87903
manizzle has joined #ocaml
ygrek has quit [Ping timeout: 272 seconds]
ghking has quit [Quit: Leaving]
manizzle has quit [Ping timeout: 256 seconds]
seangrove has joined #ocaml
tnguyen has joined #ocaml
claudiuc has quit [Remote host closed the connection]
kdef has quit [Quit: Leaving]
manizzle has joined #ocaml
manizzle has quit [Max SendQ exceeded]
ggole has joined #ocaml
shinnya has quit [Ping timeout: 252 seconds]
ghostpl_ has joined #ocaml
q66[lap] has joined #ocaml
cdidd_ has joined #ocaml
cdidd has quit [Ping timeout: 250 seconds]
kushal has joined #ocaml
ghostpl_ has quit [Ping timeout: 245 seconds]
tianon has quit [Ping timeout: 246 seconds]
manizzle has joined #ocaml
manizzle has quit [Max SendQ exceeded]
manizzle has joined #ocaml
keen__________27 has joined #ocaml
keen__________26 has quit [Ping timeout: 264 seconds]
manizzle has quit [Ping timeout: 244 seconds]
maufred has quit [Ping timeout: 245 seconds]
manizzle has joined #ocaml
ygrek has joined #ocaml
Guest87903 has quit [Remote host closed the connection]
shinnya has joined #ocaml
maufred has joined #ocaml
rishabhjain has joined #ocaml
matason has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
swgillespie has joined #ocaml
ghostpl_ has joined #ocaml
rishabhjain has quit []
reem has quit [Remote host closed the connection]
ghostpl_ has quit [Ping timeout: 265 seconds]
reem_ has joined #ocaml
reem_ has quit [Remote host closed the connection]
reem has joined #ocaml
AlexRussia has joined #ocaml
Bhavya has joined #ocaml
<flux> it's a good read, and short :)
<flux> I don't know if the new GADT-based system works the same way, though
keen__________27 has quit [Read error: Connection timed out]
<reynir> heh danvy
keen__________27 has joined #ocaml
reem has quit [Remote host closed the connection]
MercurialAlchemi has joined #ocaml
slash^ has joined #ocaml
reem has joined #ocaml
tane has joined #ocaml
<dmbaturin> Where does the Not_found exception come from?
<dmbaturin> It's magically available, but I don't see it in pervasives.
<ggole> It's "predefined"
<dmbaturin> More pervasive than pervasives itself? :)
<ggole> See the manual. One moment, somebody wants to talk to me.
Simn has joined #ocaml
<ggole> That's what I mean by predefined: like int or string, not defined in OCaml code but built into the compiler
<ggole> I think the rationale is that the C code can generate these exceptions
<flux> probably means that compile-generated code can throw Not_found then?
cesar_ has joined #ocaml
<flux> ggole, C can generate whichever exceptions were they in defined in OCaml or not, though?
cesar_ is now known as Guest27769
<flux> but perhaps it was more convenient to implement it that way. it's not very significant :)
<ggole> It might be problematic for the C code to depend on the OCaml code, which in turn depends on the C code
<ggole> eg, for bootstrapping
<ggole> But I'm guessing here
<ggole> Or maybe it's that the predefined exceptions don't have a dynamically allocated id, which could be more efficient/convenient
matason has quit [Ping timeout: 252 seconds]
reem has quit [Remote host closed the connection]
Guest27769 has quit [Ping timeout: 244 seconds]
reem has joined #ocaml
oscar_toro has quit [Ping timeout: 264 seconds]
kushal has quit [Ping timeout: 256 seconds]
slash^ has quit [Read error: Connection reset by peer]
ghostpl_ has joined #ocaml
oscar_toro has joined #ocaml
xificurC has joined #ocaml
ghostpl_ has quit [Ping timeout: 245 seconds]
pgomes has joined #ocaml
kushal has joined #ocaml
reem has left #ocaml ["Leaving..."]
Submarine has quit [Remote host closed the connection]
pgomes has quit [Ping timeout: 265 seconds]
clog has quit [Ping timeout: 255 seconds]
manizzle has quit [Ping timeout: 248 seconds]
darkf_ has joined #ocaml
darkf_ has quit [Changing host]
darkf_ has joined #ocaml
darkf has quit [Ping timeout: 265 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
freling has joined #ocaml
manizzle has joined #ocaml
ane has joined #ocaml
jonludlam has joined #ocaml
swgillespie has joined #ocaml
matason has joined #ocaml
govg has quit [Quit: leaving]
johnelse is now known as johnel_away
<reynir> hm, it seems ocp-indent broke in vim for me
matason has quit [Ping timeout: 244 seconds]
matason has joined #ocaml
<reynir> Ah, it's loading the indent file from the vim distribution first
kakadu has joined #ocaml
ghostpl_ has joined #ocaml
johnel_away is now known as johnelse
matason has quit [Ping timeout: 246 seconds]
AlexRussia has quit [Ping timeout: 246 seconds]
Sorella has quit [Quit: Connection closed for inactivity]
ghostpl_ has quit [Ping timeout: 248 seconds]
<reynir> My non-solution was to just delete the one from the vim distribution
larhat has joined #ocaml
_pakchoi_ops has quit [Remote host closed the connection]
psy_ has quit [Ping timeout: 248 seconds]
matason has joined #ocaml
Haudegen has quit [Ping timeout: 252 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest84929
Guest84929 has quit [Ping timeout: 265 seconds]
psy_ has joined #ocaml
Haudegen has joined #ocaml
AlexRussia has joined #ocaml
ygrek has quit [Ping timeout: 246 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
_pakchoi_ops has joined #ocaml
freling has quit [Quit: Leaving.]
thomasga has joined #ocaml
_pakchoi_ops has quit [Quit: No Ping reply in 240 seconds.]
_pakchoi_ops has joined #ocaml
ygrek has joined #ocaml
mort___ has joined #ocaml
mort___ has left #ocaml [#ocaml]
ghostpl_ has joined #ocaml
Haudegen has quit [Ping timeout: 252 seconds]
ghostpl_ has quit [Ping timeout: 264 seconds]
yomimono has joined #ocaml
Haudegen has joined #ocaml
AlexRussia has quit [Ping timeout: 265 seconds]
clog has joined #ocaml
darkf_ is now known as darkf
mort___ has joined #ocaml
oscar_toro has quit [Ping timeout: 272 seconds]
tane has quit [Quit: Verlassend]
nopf_ is now known as nopf
oscar_toro has joined #ocaml
govg has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest55579
_pakchoi_ops has quit [Remote host closed the connection]
sdothum has joined #ocaml
thomasga has quit [Quit: Leaving.]
Guest55579 has quit [Ping timeout: 265 seconds]
_andre has joined #ocaml
oscar_toro has quit [Ping timeout: 246 seconds]
freling has joined #ocaml
freling has quit [Client Quit]
paradoja has joined #ocaml
thomasga has joined #ocaml
freling has joined #ocaml
Haudegen has quit [Ping timeout: 248 seconds]
mort___ has quit [Quit: Leaving.]
ghostpl_ has joined #ocaml
ygrek has quit [Ping timeout: 256 seconds]
thomasga has quit [Quit: Leaving.]
Haudegen has joined #ocaml
ghostpl_ has quit [Ping timeout: 255 seconds]
matason has quit [Ping timeout: 248 seconds]
matason has joined #ocaml
mort___ has joined #ocaml
oscar_toro has joined #ocaml
thomasga has joined #ocaml
freling has quit [Quit: Leaving.]
struktured has quit [Ping timeout: 265 seconds]
seangrove has quit [Ping timeout: 246 seconds]
Algebr has quit [Ping timeout: 255 seconds]
matason has quit [Ping timeout: 264 seconds]
thomasga has quit [Quit: Leaving.]
cesar_ has joined #ocaml
cesar_ is now known as Guest73957
Guest73957 has quit [Ping timeout: 256 seconds]
idegen has joined #ocaml
freling has joined #ocaml
psy_ has quit [Ping timeout: 245 seconds]
Submarine has joined #ocaml
Submarine has joined #ocaml
AltGr has left #ocaml [#ocaml]
ane has left #ocaml [#ocaml]
govg has quit [Ping timeout: 264 seconds]
badkins has joined #ocaml
axiles has quit [Ping timeout: 252 seconds]
Algebr has joined #ocaml
xificurC has quit [Remote host closed the connection]
matason has joined #ocaml
ghostpl_ has joined #ocaml
JuggleTux has quit [Read error: Connection reset by peer]
JuggleTux has joined #ocaml
mort___ has quit [Quit: Leaving.]
ghostpl_ has quit [Ping timeout: 244 seconds]
thomasga has joined #ocaml
govg has joined #ocaml
mort___ has joined #ocaml
mort___1 has joined #ocaml
mort___ has quit [Read error: Connection reset by peer]
mort___1 has quit [Ping timeout: 256 seconds]
Algebr has quit [Ping timeout: 252 seconds]
Submarine has quit [Remote host closed the connection]
Submarine has joined #ocaml
darkf has quit [Quit: Leaving]
freling has quit [Quit: Leaving.]
shinnya has quit [Ping timeout: 256 seconds]
freling has joined #ocaml
Algebr has joined #ocaml
thomasga has quit [Quit: Leaving.]
jonludlam has quit [Ping timeout: 264 seconds]
Haudegen has quit [Remote host closed the connection]
Haudegen has joined #ocaml
Haudegen has quit [Ping timeout: 246 seconds]
<Algebr> flux: thanks for that paper
matason has quit [Ping timeout: 264 seconds]
ghostpl_ has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest58828
Haudegen has joined #ocaml
mort___ has joined #ocaml
Guest58828 has quit [Ping timeout: 265 seconds]
paradoja has quit [Remote host closed the connection]
<ia0> is there a way to change the locale in an OCaml program?
ghostpl_ has quit [Ping timeout: 245 seconds]
<mrvn> unix module? extunix?
mort___ has quit [Client Quit]
jonludlam has joined #ocaml
<Algebr> I get a warning that String.unsafe_set was deprecated, what is its replacement?
<Algebr> is it Bytes.unsafe_set or so?
<mrvn> you have to eoi every PIC interrupt
<mrvn> ups
matason has joined #ocaml
oscar_toro has quit [Ping timeout: 248 seconds]
<ia0> mrvn: there is nothing in unix nor extunix
<ia0> do you have a precise function in mind?
<ia0> I'm referring to setlocale (POSIX function)
<companion_cube> if extunix doesn't have it, maybe you can contribute it
Sorella has joined #ocaml
mort___ has joined #ocaml
Bhavya has quit [Quit: Quit the channel]
matason has quit [Ping timeout: 250 seconds]
TheLemonMan has joined #ocaml
mort___ has quit [Quit: Leaving.]
thomasga has joined #ocaml
thomasga has quit [Client Quit]
mort___ has joined #ocaml
thomasga has joined #ocaml
struktured has joined #ocaml
ghostpl_ has joined #ocaml
matason has joined #ocaml
lordkryss has joined #ocaml
cdidd_ is now known as cdidd
AlexRussia has joined #ocaml
TheLemonMan has quit [Quit: leaving]
jonludlam has quit [Ping timeout: 250 seconds]
slash^ has joined #ocaml
waneck has joined #ocaml
AlexRussia has quit [Ping timeout: 255 seconds]
MattZen has joined #ocaml
<Leonidas> Algebr: unsafe_set?
<Algebr> Leonidas: ya, found it, thanks
<MattZen> Heya folks. I'm looking to create a function that can take a list of integers [2;4;5;10;4] and check to see if any two are prime. If any two numbers together are prime, I would like to return a list with those two numbers added together
<MattZen> like [2 4 5 10 3] -> [2 9 10 4]
<MattZen> w :: x :: y :: z is my pattern
<MattZen> but I'm unsure how I can do this
<MattZen> I have a function to check if a number is prime
<kakadu> Does order matter?
<MattZen> For me I'm trying to get it in order, to see how it processes it once I trace it
<MattZen> But I can't get my head around how to pattern match it
<MattZen> and that final 3 should be a 4 I just noticed
tianon has joined #ocaml
<Leonidas> MattZen: you only need to match 2 elements, don't you?
<MattZen> Yes actually you're right,
<MattZen> simply hd :: tl perhaps
<Leonidas> MattZen: also, how is 4 prime?
<MattZen> it isnt
<MattZen> but 4 5 are together
<Leonidas> cand1::cand2::xs
<MattZen> and one of them is, so it adds them
<Leonidas> you mean coprime?
<MattZen> I suppose so yeah
<mrvn> how is 2 the sum of two numbers, one of which is prime?
<MattZen> I mean
<Leonidas> mrvn: it isn't. non-coprime numbers are left as-is
<MattZen> it will check two numbers together, determine if a or b is a prime then sum, else check b c
<mrvn> 2 or 4, 2 is prime, output 6
<Leonidas> ah, now i get it
mort___ has quit [Quit: Leaving.]
BitPuffin has joined #ocaml
<Leonidas> disregard coprime, I misunderstood earlier.
<mrvn> so it should be [6 9 15 13]
struktured has quit [Ping timeout: 246 seconds]
<Leonidas> should summed up numbers be consumed? because then 9 wouldn't be part of the result
<Leonidas> since 4 is consumed in 6
<MattZen> good point
<mrvn> that depends on what it's supposed to be in the first place
<mrvn> so far the problem has been woefully under specified
<MattZen> yeah you're right.
<MattZen> It was more simply trying to figure out how to pattern match it
<MattZen> ok, save for numbers 1 and 2, I'd like to achieve the same result
<mrvn> let rec loop last = function [] -> [] | x::xs -> test_pair last x; loop x xs
<mrvn> or let rec loop = function [] | [_] -> [] | x::(y::_ as tl) -> ...; loop tl
<MattZen> that looks so much more simpler than what I have
<mrvn> or let rec loop = function | x::(y::_ as tl) -> ...; loop tl | _ -> []
<MattZen> thank you
<MattZen> this clears it up for me a lot
<Drup> Algebr: yes, Bytes
<Drup> (and there is little point in using unsafe_set, just use set)
<Drup> (the cost of the bound checking is negligible)
The_Mad_Pirate has quit [Quit: Konversation terminated!]
mort___ has joined #ocaml
badkins has quit [Read error: Connection reset by peer]
govg has quit [Quit: leaving]
AlexRussia has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
Submarine has quit [Remote host closed the connection]
mcc has joined #ocaml
BitPuffin has quit [Ping timeout: 246 seconds]
psy_ has joined #ocaml
psy_ has quit [Max SendQ exceeded]
BitPuffin has joined #ocaml
psy_ has joined #ocaml
sepp2k has joined #ocaml
sepp2k has quit [Client Quit]
govg has joined #ocaml
cesar_ has joined #ocaml
struktured has joined #ocaml
cesar_ is now known as Guest69702
BitPuffin has quit [Ping timeout: 246 seconds]
tianon has quit [Read error: Connection reset by peer]
badkins has joined #ocaml
tianon has joined #ocaml
Guest69702 has quit [Ping timeout: 256 seconds]
govg has quit [Ping timeout: 265 seconds]
jwatzman|work has joined #ocaml
yomimono has quit [Ping timeout: 255 seconds]
mort___ has quit [Quit: Leaving.]
<Algebr> Drup: You mentioned that d3 is too dynamic to use with js_of_ocaml, what does that mean exactly?
<Drup> it's ... hard to type
<companion_cube> it would need d3pendant types
struktured has quit [Ping timeout: 246 seconds]
<Drup> :D
waneck has quit [Remote host closed the connection]
mort___ has joined #ocaml
tianon has quit [Read error: Connection reset by peer]
tianon has joined #ocaml
BitPuffin has joined #ocaml
larhat has quit [Quit: Leaving.]
psy_ has quit [Ping timeout: 264 seconds]
MrScout has joined #ocaml
<S11001001> companion_cube: ha ha ha.
oscar_toro has joined #ocaml
<reynir> bad joke: you press "d" and then "3"
MrScout has quit [Remote host closed the connection]
swgillespie has joined #ocaml
leowzukw has joined #ocaml
leowzukw has quit [Client Quit]
MrScout has joined #ocaml
MrScout has quit [Ping timeout: 250 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
psy_ has joined #ocaml
freling has quit [Quit: Leaving.]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
mort___ has quit [Quit: Leaving.]
kdef has joined #ocaml
thomasga has quit [Ping timeout: 265 seconds]
xificurC has joined #ocaml
Denommus has joined #ocaml
vrdhn has joined #ocaml
<Algebr> after doing just ocaml for a bit and now having to do JS, its really eye opening to notice how much other code is driven by side effectrs
<Algebr> effects
<Denommus> Algebr: and how much dynamic typing gets in the way of correct code
matason has quit [Ping timeout: 265 seconds]
bjorkintosh has quit [Quit: Leaving]
pyon is now known as Guest82938
Guest82938 has quit [Quit: My morality has evaporated under the harsh UV light.]
ggole has quit []
pyon has joined #ocaml
mcc has quit [Quit: This computer has gone to sleep]
bjorkintosh has joined #ocaml
Anarchos has joined #ocaml
Algebr has quit [Ping timeout: 272 seconds]
avsm has joined #ocaml
thomasga has joined #ocaml
badon has quit [Quit: Leaving]
Haudegen has quit [Ping timeout: 256 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest12418
MrScout has joined #ocaml
q66[lap] has quit [Quit: Textual IRC Client: www.textualapp.com]
JuggleTux has quit [Quit: leaving]
kakadu has quit [Quit: Page closed]
vrdhn has quit [Ping timeout: 264 seconds]
Guest12418 has quit [Ping timeout: 265 seconds]
MrScout has quit [Read error: Connection reset by peer]
thomasga has quit [Quit: Leaving.]
MrScout has joined #ocaml
MattZen has quit [Ping timeout: 246 seconds]
vrdhn has joined #ocaml
thomasga has joined #ocaml
JuggleTux has joined #ocaml
thomasga has quit [Client Quit]
Haudegen has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
shinnya has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Quit: Leaving.]
axiles has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
Algebr has joined #ocaml
avsm has quit [Quit: Leaving.]
kakadu has joined #ocaml
badon has joined #ocaml
ericwa has joined #ocaml
govg has joined #ocaml
AlexRussia has quit [Ping timeout: 246 seconds]
AlexRussia has joined #ocaml
c355E3B has joined #ocaml
Haudegen has quit [Ping timeout: 265 seconds]
Denommus has quit [Ping timeout: 246 seconds]
pgomes has joined #ocaml
Haudegen has joined #ocaml
Anarchos has joined #ocaml
contempt has quit [Ping timeout: 264 seconds]
contempt has joined #ocaml
Denommus has joined #ocaml
c355E3B has quit [Quit: Leaving]
c74d has quit [Ping timeout: 252 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest91016
manizzle has quit [Ping timeout: 250 seconds]
thomasga has joined #ocaml
Guest91016 has quit [Ping timeout: 265 seconds]
BitPuffin has quit [Ping timeout: 256 seconds]
vrdhn has quit [Remote host closed the connection]
c74d has joined #ocaml
tane has joined #ocaml
c74d has quit [Quit: c74d]
swgillespie has joined #ocaml
TheLemonMan has joined #ocaml
badkins has quit []
struktured has joined #ocaml
thomasga has quit [Quit: Leaving.]
thomasga has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
_andre has quit [Quit: leaving]
slash^ has quit [Read error: Connection reset by peer]
mahem1 has joined #ocaml
* mahem1 still doesn't understand why we can't have polymorphic records... http://fpaste.org/204001/42749042/
<mahem1> Anyone care to explain?
manizzle has joined #ocaml
<smondet> I think want you want is called polymorphic records … it looks like you want `pos` from any thing that has a method `pos`, this structural sub-subtyping, and ocaml provides that through objects, not records
<smondet> s/want you want/what you want/
<smondet> is *not* called
* smondet needs his 5th coffee...
<bernardofpc> yeah, that's what objects provide in OCaml
AlexRussia has quit [Ping timeout: 264 seconds]
<bernardofpc> you can build a functor for that, also
<mahem1> Fair enough. I am still wondering behind *why* this doesn't work.
<bernardofpc> because obj.pos has to have a type
<bernardofpc> and obj itself (argument of your function) also
<bernardofpc> so your function can only be Ball.t -> int * int or Box.t -> int * int
AlexRussia has joined #ocaml
<mahem1> I guess.
<bernardofpc> if you want "everything that has a <pos> " -> <type of such pos>, you need some other thing
<bernardofpc> for example, you can make a Functor
<mahem1> I'll dig into functors then. (haven't used them before)
<mahem1> Thanks.
<bernardofpc> like module M(T: sig pos : a end) struct let f (x:T) = x.pos end
<bernardofpc> (not 100% sure it will work)
<bernardofpc> and then you can have M(Box).f : Box.t -> int * int
<bernardofpc> and M(Ball).f : Ball.t -> int * int
<bernardofpc> you could also have M(star).f : Star.t -> float * float * float
<bernardofpc> (if Star = ... pos : float * float * float )
<mahem1> That star example just confused me more. Starting to look a bit like C style operator overloading... But I'll look mor einto functors.
<bernardofpc> yeah, look into functors
<bernardofpc> the classic use-case is building Hashtables
<bernardofpc> module M(T: sig type t val pos : t -> 'a end) = struct let f (x : T.t) = T.pos x end ;; -> a working solution
<bernardofpc> (but not how pos is defined as a function on type t)
freling has joined #ocaml
<bernardofpc> *note
swgillespie has joined #ocaml
Nahra has joined #ocaml
Hannibal_Smith has joined #ocaml
The_Mad_Pirate has joined #ocaml
cesar_ has joined #ocaml
BitPuffin has joined #ocaml
ollehar has joined #ocaml
cesar_ is now known as Guest29993
Guest29993 has quit [Ping timeout: 265 seconds]
lpl has joined #ocaml
<lpl> Is there a way to match multiple types at once in Ocaml? For example type foo = a of int * int | b of int * int, and I want to match bar:foo with | a(x, y) or b(x, y) -> x+y
freling has quit [Quit: Leaving.]
<lyxia> a (x, y) | b(x, y) -> x+y
<ollehar> just make two match casess..... damn too slow
<tane> ollehar, same here :)
<ollehar> ;)
<ollehar> but that "or" syntax looks nice, too :)
<tane> ollehar, i read your shower thought on reddit and found the following discussion rather interesting, thanks for posting it :)
<lpl> I don't want to make two cases because in my actual implementation there are 30 cases of the same thing :(
<ollehar> tane, haha
<ollehar> it's the highest controversial post on that subreddit! I'm the best troll!
<ollehar> but yes, it's always interesting to discuss why the heck some languages get so high popularity.
<tane> yeah :)
q66[lap] has joined #ocaml
<ollehar> anyway, my question for the night: possible to make a functor out of "file" module?
<ollehar> or must I be explicit?
<ollehar> lpl: ? pastebin?
<tane> ollehar, if you don't mind me asking slightly off topic, what city/region are you located at? :)
<ollehar> tane: hannover now, from sweden originally.
<tane> ah ok
<ollehar> and you are from USA, according to irc
<tane> i live in osnabrueck, just curios if people using ocaml in germany would at some point meet the critical mass for some kind of user group or meetup
<ollehar> yeah, I'm interested in that. I'm at a conference right now, actually (php, typo3).
<ollehar> so I thought, "this would be nice for ocaml".
<tane> haha ok
<ollehar> I think they meet regular in paris.
<tane> yeah
<ollehar> phd:s all of them
<ollehar> phd's
<ollehar> *
Haudegen has quit [Ping timeout: 248 seconds]
<tane> yeah, but i guess that's the academic side of it
<ollehar> sure
<tane> anyway, i got to go for tonight. good night :)
<ollehar> bye
<MercurialAlchemi> typo3?
tane has quit [Quit: Verlassend]
<MercurialAlchemi> you're really from scandinavia :)
<MercurialAlchemi> ollehar: have that in DK too
<ollehar> it's big in denmark, but I had never heard about it since I came to germany.
<ollehar> some dude aske seems to be a typo3 rockstar
<ollehar> made the webpage for venster
<MercurialAlchemi> what's venster?
<MercurialAlchemi> and I think it's completely unknown outside of the northern countries
<ollehar> MercurialAlchemi: oh, you're not from denmark. :D it's a political party, the biggest I think.
<ollehar> (in denmark)
<MercurialAlchemi> oh, Venstre
<ollehar> hm ok
<ollehar> yes
<MercurialAlchemi> which means left, which means of course they're the conservatives
<MercurialAlchemi> not that you could tell the difference with the social democrats
s1n4 has joined #ocaml
<MercurialAlchemi> that said, you're right, I'm not from DK, but I live there
<ollehar> Aha
<ollehar> It's all making more and more sense :)
<ollehar> You're at the university in copenhagen?
<MercurialAlchemi> not set a foot in university since around 2001
<MercurialAlchemi> but I live near Århus, in Jutland
troydm has quit [Quit: What is hope? That all of your wishes and all of your dreams come true? (C) Rau Le Creuset]
<MercurialAlchemi> so you're a Swedish expat in Germany
<ollehar> Yep
<ollehar> And OCaml expat in PHP ;)
thomasga has quit [Quit: Leaving.]
<MercurialAlchemi> haha
<MercurialAlchemi> well, it's a hell of lot easier to find people who give you money to write PHP than OCaml, that's for sure
Haudegen has joined #ocaml
<ollehar> True dat
<ollehar> aarhus seems like a nice place
<ollehar> hannover is a very generic town, I'm afraid.
troydm has joined #ocaml
<ollehar> maybe we can have an ocaml get-together in hamburg...
<MercurialAlchemi> that'd be nice
<Leonidas> MercurialAlchemi: oh, I found a place, wasn't so hard.
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<Leonidas> (and I think they are still looking for more)
<Drup> Leonidas: job wise, you mean ? by curiosity, details ? :p
<ollehar> (still, my question: functor of file module - possible?)
<Leonidas> Drup: yes. Writing on a compiler for an in-house language for graphics programming.
<Drup> ollehar: you mean you want a file-module parametrized by some signature like it was a functor ?
<MercurialAlchemi> Leonidas: if it's (not finance and remote) I'm interested
<ollehar> drup yes, but I found a stackoverflow about it
thomasga has joined #ocaml
Simn has quit [Quit: Leaving]
<Drup> ollehar: with base compiler no, bug http://www.ocamlpro.com/blog/2011/08/10/ocaml-pack-functors.html
<Leonidas> MercurialAlchemi: not finance, I doubt it's remote (Munich), but I'd have to ask.
<Drup> but*
<ollehar> thanks
<Drup> but really, just define a functor inside the module
<ollehar> yeah
<ollehar> Only need to parameterize one function, can lift it into it's own module.
<Leonidas> liftM :p
<ollehar> ?
<Leonidas> where M is for… module.
<Drup> Leonidas: company ? :p
<Leonidas> I'm kidding, liftM is a haskell function.
<Drup> ollehar: do you even lift ? :D
<Leonidas> Drup: Dassault Systemes by now.
<Drup> hum, interesting
<Leonidas> they have multiple departments using ocaml I heard.
<ollehar> (I meant to ask this on stackoverflow, but... How can you make Rust, with manual memory-management, in OCaml using GC?)
<Leonidas> ollehar: what exactly do you mean?
<ollehar> The first Rust compiler was made in OCaml. How would the code look like that handled memory-management?
<Drup> Leonidas: that's also what I heard
<ollehar> maybe I should just look it up
<ollehar> ...
<Leonidas> ollehar: Rust's compiler was in OCaml. That does not mean that the output was OCaml too
<Drup> Leonidas: and some static analysis stuff in OCaml, iirc.
<Leonidas> it generated native code using LLVM, which is exactly what it still does, just the language that drives the LLVM bindings is Rust now.
<MercurialAlchemi> ollehar: at a guess, it used the LLVM bindings
<ollehar> sounds valid
oriba has joined #ocaml
<ollehar> ok, thanks.
<Leonidas> Drup: If you're interested, I can get you in touch :-)
<Drup> not really, I'm phding.
pgomes has quit [Quit: Leaving]
<Drup> Leonidas: but I'm always curious :p
<Leonidas> we do have phds in related fields on our team :-)
<Drup> in type theory ? :D
<Leonidas> if dependent types count, yes.
<Drup> ahah, really ? that's funny, what are you doing with dependent types ? :p
<Leonidas> we're not doing anything with dependent types, it was one guys phd thesis.
<Leonidas> actually, i haven't gotten around reading it, though it sounded pretty interesting.
rwmjones has quit [Read error: Connection reset by peer]
rwmjones has joined #ocaml
Denommus has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
seangrove has joined #ocaml
kakadu has quit [Remote host closed the connection]
jwatzman|work has quit [Quit: jwatzman|work]
ollehar has quit [Quit: ollehar]
<mahem1> bernardofpc: Hmmm, get a type mismatch with your code. How exactly am I suppose to use it?
TheLemonMan has quit [Quit: leaving]
brendan has quit [Ping timeout: 245 seconds]
cesar_ has joined #ocaml
cesar_ is now known as Guest1053
<xificurC> found a blog post from 2010 stating the OCaml GC doesn't allow threads to run in parallel. Is this still an issue?
<Drup> yes
clog has quit [Ping timeout: 255 seconds]
Guest1053 has quit [Ping timeout: 256 seconds]
<xificurC> Drup: any work being done on the front?
kdef has quit [Quit: Leaving]
<Drup> yes
<xificurC> Drup: thanks, will definitely check out. Do you have any other interesting ocaml vids? I love vids :)
<yminsky> Does anyone know if there's a good way of having local opam switches?
<Drup> yminsky: local to what ?
<yminsky> i.e., I want to use one opam switch in one context, and a different in another.
<Drup> sure
<Drup> eval `opam config env --switch FOO`
<Drup> will switch only in the terminal
<yminsky> Ah, interesting. That's pretty good.
<Drup> I use that quite often when multitasking between "answering IRC questions" and "hacking on trunk" :D
<yminsky> It would be cool if you could get per-directory switching in a way that emacs understood too. But that's a bigger ask, I suppose.
<xificurC> Drup: thanks, that's more than enough :)
<Drup> yminsky: there is a feature request for that on opam
<yminsky> We have that at work, effectively, though not through opam.
<Drup> but it seems tricky
<Drup> (for opam)
<yminsky> It's quite nice when it works.
<yminsky> We basically have our build system spit out merlin files everywhere. Merlin points to the right OCaml version, and so you're set for your IDE-like featurs.
<yminsky> And as you switch from tree to tree, you automatically switch to whatever version of the libraries and such that you need.
<yminsky> If you could get the merlin file to effectively point to the right opam switch, that would kind of give you what you need.
<yminsky> I'll ask Thomas about it.
<Drup> it effectively ties up merlin to opam, though
<nicoo> Drup: How good/useable is OCaml-Java ?
Hannibal_Smith has quit [Quit: Leaving]
<Drup> why do you ask me ? :D
<yminsky> Sortof. In some sense, all Merlin needs is a directory.
<yminsky> Maybe it could be done exclusively through emacs magic that sets up how merlin is invoked.
<Drup> yminsky: and regardless, the build system need to be aware too, merlin only doesn't help
<yminsky> Sure. Merlin and the build system both need to be invoked with the right environment.
<Drup> opam really works by env variable
<Drup> and switching env variables by entering a repository is not reasonable
<Drup> a directory
<yminsky> Well, we do just that within emacs for how we invoke our build tools (including Jenga), and I think it works quite well.
<Drup> so you will probably need some sort of frontend to pipe the calls to all binaries
<yminsky> I agree I wouldn't want it on the shell.
<Drup> ah, ok, just in emacs
<yminsky> I think.
<Drup> well, yeah, you can do some emacs voodoo
<yminsky> Hmm.
<Drup> but I don't like emacs voodoo :D
BitPuffin has quit [Ping timeout: 244 seconds]
<yminsky> Actually, Jenga is sensitive to the directory that it's invoked in, and that seems right.
<yminsky> Maybe your build script should explicitly specify its opam switch. It seems like it's part of the environment, after all.
<Drup> yeah, like I said, frontend to pipe the calls to binaries :p
<Drup> which is not a bad idea, indeed