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
malc__ has quit [Quit: leaving]
madroach has quit [Ping timeout: 264 seconds]
flux has quit [Ping timeout: 264 seconds]
flx is now known as flux
madroach has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
ahem has quit [Read error: Connection timed out]
AltGr has joined #ocaml
RossJH has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ahem has joined #ocaml
rgrinberg has joined #ocaml
kakadu has quit []
MrScout has joined #ocaml
MrScout_ has joined #ocaml
MrScout has quit [Remote host closed the connection]
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
enquora has quit [Quit: enquora]
Yoric has quit [Remote host closed the connection]
Yoric has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
NoNNaN has joined #ocaml
Hannibal_Smith has quit [Quit: Leaving]
Yoric has quit [Ping timeout: 244 seconds]
ahem has quit [Read error: Connection timed out]
OCamlQuesion has joined #ocaml
ahem has joined #ocaml
<OCamlQuesion> Random question, messing around in OCaml: trying to look at the "debug" from the perfasives values such as __LOC__ are coming up as unbound values. Why is this?
flx has joined #ocaml
<nojb> what is “debug” ?
<OCamlQuesion> It is just listed in the docs under a "debugging" header
<Drup> where are you using them ? __LOC__ is always defined.
<nojb> what ocaml version do you have ?
<OCamlQuesion> tried top level of interpreter and compiled, 4.01.0
<nojb> they might be 4.02 features … ?
vanila has joined #ocaml
<Drup> yeah, not available in 4.01 apparently
<Drup> OCamlQuesion: Upgrade!
<OCamlQuesion> http://caml.inria.fr/pub/docs/manual-ocaml-4.01/libref/Pervasives.html yeah not listed in older docs here, it looks like
<OCamlQuesion> thanks
<Drup> (note that, even in older version of ocaml, "assert false" will always report the line in the source file :p)
OCamlQuesion has quit [Quit: leaving]
<Drup> Hum.
nojb has quit [Quit: nojb]
<badkins> I'm trying to use Core's List.fold_right w/o using labels by passing the args in the correct order, but I'm getting type errors: https://gist.github.com/anonymous/39aa376508d1cae64b9d
<badkins> maybe due to the nested calls to the fold
<badkins> in other words, if I remove ~f: and ~init: and change the order to match the type of fold_right, ocaml complains - any ideas?
<Drup> what is the error ?
lordkryss has quit [Quit: Connection closed for inactivity]
ahem has quit [Read error: Connection timed out]
ahem has joined #ocaml
<badkins> Drup: it complains of a type error - depends on which labels I've removed, but in one case, it complained of result's type
travisbrady has joined #ocaml
<badkins> it was my understanding that use the labels such as ~f was optional, but it appears to not be so in this case
<Drup> it is optional, you probably only messed up which argument goes where.
<badkins> I think the compiler is confused since by having two fold_right calls with labeled args
<badkins> Drup: I assure you I did not
<badkins> list -> function -> init
<Drup> and show me your code and the answer ? :)
<badkins> <sigh>
<badkins> 1) remove labels, 2) reorder args from a->b->c to c->a->b
<Drup> I don't have core installed in any of my switchs...
<badkins> given that Core decided to use a non-standard ordering the labels are actually helpful, so no big deal I guess
jwatzman|work has quit [Quit: jwatzman|work]
<badkins> RWO mentions issues with labeled arguments in high order functions, so it's probably related to that
<Drup> There are issues, but it shouldn't touch you there, since you have explicitely abstracted over the variables.
<Drup> There is one condition for label elision, It's that the application is complete, and it is here, afaict.
<badkins> it is
<badkins> I expect I can duplicate it with a simpler, non-Core example...
<Drup> That's the first thing I did:
<Drup> let f ~bar ~baz = float_of_int bar +. baz ;;
<Drup> f 4 5. ;;
<Drup> works as expected.
thomasga has quit [Quit: Leaving.]
<badkins> Drup: that's not nesting high order functions
<badkins> I know it works in simple cases - that's why I was surprised in this instance
shinnya_ has quit [Ping timeout: 256 seconds]
<Drup> ListLabels.map (fun l -> ListLabels.map (fun x -> x * 2) l) [[2;3];[4]] ;;
<Drup> works
<Drup> (with ListLabels.map : f:('a -> 'b) -> 'a list -> 'b list )
MinimumOverdrive has joined #ocaml
MinimumOverdrive has left #ocaml [#ocaml]
<badkins> yes, I just got a nested hof to work as well - something unique about the cartesian function it seems
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
<badkins> it is a tricky function wrt type checking
<Drup> not really ^^
avsm has quit [Client Quit]
<badkins> what is the type of result ?
<Drup> the same as the result of the list.
<Drup> the same as the result of the function*
<Drup> oh, you mean, your cartesian function ?
<badkins> I don't think so.
<Drup> I though you were still talking about fold.
<Drup> I just looked at your implementation
<badkins> that think was *much* easier with Haskel list comprehensions :)
<badkins> very tough to follow as a nested fold IMO
MinimumOverdrive has joined #ocaml
<Drup> It's obviously of type 'a list list -> 'a list list
<Drup> no much question about that.
<badkins> the function is, yes
<badkins> I don't suppose utop could get confused with repeated evaluations of the function in different forms
<badkins> I suppose I could replace List.fold_right with my own fold defined with labeled args to isolate Core List vs. ocaml proper
t4nk040 has quit [Ping timeout: 246 seconds]
<Drup> ok, so, the issue is not high order functions or anything, it's the mix of non labeled and labeled
smtb has joined #ocaml
<Drup> (I think)
kalzz has quit [Ping timeout: 244 seconds]
<Drup> It's really weird =__=
<badkins> agreed :)
enitiz_ has joined #ocaml
enitiz_ has quit [Read error: Connection reset by peer]
<Drup> https://bpaste.net/show/13d970feae0a here is a non-core version
<Drup> all the arguments are in the right places
<Drup> gogo bug report
enitiz has quit [Quit: Leaving]
<badkins> thx for checking on it
AlexRussia has quit [Ping timeout: 256 seconds]
marynate has joined #ocaml
rgrinberg1 has joined #ocaml
rgrinberg has quit [Ping timeout: 265 seconds]
q66 has quit [Quit: Leaving]
demonimin_ has quit [Ping timeout: 256 seconds]
kapil__ has joined #ocaml
<badkins> Drup: hmm... I wonder if this was just a misunderstanding on my part re: label arguments. I *thought* the labels were optional in the invocation, but I'm not seeing that in RWO now.
<badkins> I know you can reorder the args when using labels, but it doesn't seem that you can just drop the label entirely.
<Drup> you should be able too
<Drup> any other behavior is a bug.
<badkins> yeah, nm - I just tried a simpler example. Does seem like a bug here then - I'll try and create a simpler reproducible case and file a report.
<Drup> the code I gave you is simple enough
<badkins> I think something w/o library functions would be best i.e. standalone
MinimumOverdrive has quit [Ping timeout: 245 seconds]
uris77 has joined #ocaml
<Drup> that's why I did a non Core version
<Drup> (using ListLabels, which is stdlib)
MinimumOverdrive has joined #ocaml
manizzle has quit [Ping timeout: 265 seconds]
travisbrady has quit [Quit: travisbrady]
codefo has quit [Ping timeout: 245 seconds]
BitPuffin has quit [Ping timeout: 244 seconds]
enitiz has joined #ocaml
<vanila> is there a mathematical proof that the ocaml type system is good?
darkf has joined #ocaml
_5kg has quit [Ping timeout: 264 seconds]
_5kg has joined #ocaml
araujo has quit [Ping timeout: 264 seconds]
uris77 has quit [Ping timeout: 264 seconds]
araujo has joined #ocaml
smtb has left #ocaml [#ocaml]
struk has quit [Ping timeout: 244 seconds]
ygrek has joined #ocaml
BitPuffin has joined #ocaml
MrScout has joined #ocaml
samrat has joined #ocaml
MrScout_ has quit [Ping timeout: 255 seconds]
shaykha has joined #ocaml
BitPuffin has quit [Ping timeout: 264 seconds]
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
<badkins> I haven't dug into ocaml's macros yet - any idea how hard it would be to define a macro to turn a long series of let x = ... in let y = ... in let z = ... into something like let x = ..., y = ..., z = ... ?
<badkins> It's not a huge problem, just a little annoying.
<whitequark> short answer: you can't
<badkins> That's surprising. I would think a decent macro system would make that extremely trivial.
samrat has quit [Ping timeout: 240 seconds]
<whitequark> there's camlp4, which allows you to do that, although there is a grammar conflict with ",", so it's not trivial
<whitequark> but using camlp4 is discouraged
<badkins> it wouldn't have to use , another token would be ok
<badkins> I've seen the term "ppx" - is that caml4p's replacement?
<whitequark> yes
<whitequark> ppx does not allow to change surface syntax though
<whitequark> you could do something like... let%seq x = .. and y = .. and z = ..
<whitequark> with %seq meaning "transform this let..and into a string of let..in..let..in.."
samrat has joined #ocaml
samrat has quit [Client Quit]
enitiz has quit [Remote host closed the connection]
<badkins> I guess I'll just deal with the extra verbosity then - replacing a bunch of let/in with and isn't a big win.
<whitequark> indeed
<badkins> types or macros - take your pick :)
enitiz has joined #ocaml
Yoric has joined #ocaml
samrat has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
badkins has quit []
samrat has quit [Quit: Computer has gone to sleep.]
kalzz has joined #ocaml
jao has quit [Ping timeout: 264 seconds]
BitPuffin has joined #ocaml
MrScout has quit [Remote host closed the connection]
BitPuffin has quit [Ping timeout: 245 seconds]
mcc has joined #ocaml
matason has joined #ocaml
ggole has joined #ocaml
struk has joined #ocaml
samrat has joined #ocaml
enitiz has quit [Quit: Leaving]
keen__________25 has joined #ocaml
keen__________24 has quit [Ping timeout: 264 seconds]
bytbox has quit [Read error: Connection reset by peer]
bytbox has joined #ocaml
alkoma has joined #ocaml
MinimumOverdrive has quit [Ping timeout: 244 seconds]
ygrek has quit [Ping timeout: 265 seconds]
MercurialAlchemi has joined #ocaml
kalzz has quit [Ping timeout: 265 seconds]
hugomg has quit [Ping timeout: 264 seconds]
shaykha has quit [Ping timeout: 252 seconds]
kalzz has joined #ocaml
rgrinberg1 has quit [Quit: Leaving.]
keen__________26 has joined #ocaml
keen__________25 has quit [Ping timeout: 240 seconds]
matason has quit [Ping timeout: 244 seconds]
bytbox has quit [Remote host closed the connection]
zwer_o has joined #ocaml
nullcat_ has joined #ocaml
zwer has quit [Ping timeout: 250 seconds]
mcc has quit [Quit: This computer has gone to sleep]
alkoma has quit [Remote host closed the connection]
<nullcat_> is using lots of for-loop, refs and mutable xxx considered bad style in OCaml programming?
<adrien> it's considered "imperative" style :P
<nullcat_> yeah imperative...
<adrien> if you do that for performance, be warned that it's often not faster than purity
<adrien> and I meant that it's not bad style per se
<nullcat_> em i see.
<nullcat_> but i feel like few real-life code uses for-loop and other imperative stuff. Most of the codes are purely functional
<vanila> i didn know ocaml had a for loop
<flx> if you are using arrays and, say, processing bitmaps, for loops might be a nice choice
<ggole> The for loop is pretty limited
<ggole> Easy to get wrong, too
<flx> how are they easy to get wrong?
<ggole> for i = 0 to Array.length a do thing a.(i) (* BOOM *) done
<vanila> lol
<vanila> that sucks
<ggole> I get really sick of that - 1
funtik_ has quit [Remote host closed the connection]
<ggole> Lisp's loop facility has a nice thing where you can say for i below ... which pretty much does what you want
funtik_ has joined #ocaml
funtik_ has quit [Remote host closed the connection]
funtik_ has joined #ocaml
_5kg has quit [Ping timeout: 245 seconds]
MinimumOverdrive has joined #ocaml
elfring has joined #ocaml
vanila has quit [Quit: Leaving]
_5kg has joined #ocaml
Yoric has joined #ocaml
struk has quit [Ping timeout: 265 seconds]
myyst has quit [Remote host closed the connection]
myyst has joined #ocaml
marynate has quit [Read error: Connection reset by peer]
marynate has joined #ocaml
Haudegen has quit [Ping timeout: 244 seconds]
Haudegen has joined #ocaml
<adrien> you can also Array.iter :)
<ggole> Frequently you can't (iterating over two arrays, only wanting part of the array, etc)
<ggole> Of course where applicable Array.iter is a good idea.
<ggole> Hmm, interesting to see Alain Frish suggesting explicit specialised array types instead of the current runtime dispatch thing
<ggole> The SML basis library did that IIRC
jonludlam has quit [Quit: Coyote finally caught me]
chinglish has joined #ocaml
<Tekk_> I'm having some trouble with ctypes
<Tekk_> specifically with a coercion
<Tekk_> in C, the type is represented as a union of structs. right now I have it implemented as some value types and a central ctypes struct acting as the union, planning to do a coerce on it
<Tekk_> but the problem is that I can't actually coerce. If I coerce the value types then (rightly, kinda) it throws Uncoercible. If I define 2 new types foo_ptr and bar_ptr of type foo ptr and bar ptr, the compiler then complains about coerce being 'a typ -> 'b typ, not 'a typ -> 'a ptr typ. I gess I'm just declaring foo_ptr and bar_ptr wrong but I'm not sure how.
matason has joined #ocaml
<Tekk_> oh wait sorry, I do have the one declared as a union
<Tekk_> so I should actually just be able to getf
<Tekk_> sorry for the pointless question :)
nullcat_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Simn has joined #ocaml
matason has quit [Client Quit]
avsm has joined #ocaml
matason has joined #ocaml
<Tekk_> Anyone know how to open modules when using M-x ocamldebug?
<Tekk_> it's decidedly not helpful when I'm trying to debug this bending and all I can get out of the debugger is "I have no idea what Ctypes is"
abel has joined #ocaml
<abel> hi all is there a way in caml to ask to quit the current programme immediatly, something like System.exit in java ?
<def`> abel: exit
<abel> just exit ? this is usable in a try ?
<def`> yes, exit : int -> 'a
<Tekk_> hmm
<Tekk_> why 'a rather than ()?
<ia0> for the same reason as failwith
<ia0> because you may want to use it anywhere
<def`> Tekk_: that's more general (more true), and highlight the fact that exit has a non trivial effect on control flow
<abel> hum don't seems to work on my side, try act as he is expected a String/bytes
mort___ has joined #ocaml
<def`> abel: I can't make sense, show your code
<abel> can i copy it directly ?
<def`> or pastebin
<def`> (if >2 lines :p)
<abel> may be related to my use of Core.Std ?
<def`> you gave no argument
<def`> exit 0
<def`> to express successful exit (Unix convention)
<abel> ok
<abel> so exit and a integer ... thanks...
<def`> exit <some other int> to express failure
<abel> and by the way does the programs seems caml enought to you ?
<abel> i means it's my second ocaml day so ... if there anything i can do better ...
<def`> I would have used a let () = match ... with ...
<def`> instead of sequencing expressions with ;;
<flx> when pattern matching and aligning rows one below another, one usually puts | in front of the first match as well so they line up nicely
<flx> also isn't the code invalid?-o
<flx> there is two withs but only one match (or try)
<flx> or is it not intended to be valid code as such..
demonimin has joined #ocaml
<abel> ack error of paste
<abel> the first line is
<abel> try let home_or_nothing = Sys.getenv("HOME") in
<abel> :(
<Tekk_> actually loading modules in general in ocamldebug woul be good to know..
hekmek has joined #ocaml
thomasga has joined #ocaml
ingsoc has joined #ocaml
jonludlam has joined #ocaml
ahem has quit [Ping timeout: 264 seconds]
<abel> a last thing , if i want my try to do an exit and to print a nice user friendly message i tend to do this : "No_home -> "no define HOME " ; exit(3)" but i got the following warning : "this expression should have type unit" is this "normal" ?
RossJH has joined #ocaml
<Leonidas> I wouldn't use ;;
<def`> prerr_endline "no def..."
<Leonidas> also, I'd catch exceptions with match, :-)
<def`> the string alone is just a value and won't get printed anywhere
<abel> so the meaning of the error is , your statement do nothing ?
_andre has joined #ocaml
<Leonidas> abel: basically.
<Leonidas> it means "your computation returns a value, are you sure you want to throw it away?"
<Leonidas> sometimes you want to throw something away, there's ignore for this, which does 'a -> unit
fafounetbis has joined #ocaml
fafounetbis has quit [Ping timeout: 264 seconds]
fafounetbis has joined #ocaml
MinimumOverdrive has quit [Quit: leaving]
ahem has joined #ocaml
fafounetbis has quit [Ping timeout: 264 seconds]
davine has joined #ocaml
tane has joined #ocaml
ingsoc has quit [Quit: Leaving.]
ingsoc has joined #ocaml
BitPuffin has joined #ocaml
funtik_ has left #ocaml [#ocaml]
mrvn has quit [Ping timeout: 272 seconds]
ahem has quit [Remote host closed the connection]
ahem has joined #ocaml
Haudegen has quit [Ping timeout: 245 seconds]
mrvn has joined #ocaml
Haudegen has joined #ocaml
BitPuffin has quit [Ping timeout: 264 seconds]
funtik_ has joined #ocaml
BitPuffin has joined #ocaml
kakadu has joined #ocaml
thomasga has quit [Quit: Leaving.]
dsheets has quit [Ping timeout: 256 seconds]
samrat has quit [Quit: Computer has gone to sleep.]
avsm has quit [Quit: Leaving.]
thomasga has joined #ocaml
Yoric has quit [Remote host closed the connection]
zwer_o_q has joined #ocaml
zwer_o has quit [Ping timeout: 250 seconds]
thomasga has quit [Quit: Leaving.]
davine has quit [Read error: Connection reset by peer]
antegallya has joined #ocaml
fraggle_laptop has quit [Ping timeout: 265 seconds]
Yoric has joined #ocaml
darkf has quit [Ping timeout: 244 seconds]
Yoric has quit [Remote host closed the connection]
rock_neurotiko has quit [Ping timeout: 264 seconds]
rock_neurotiko has joined #ocaml
<abel> when i try to do : # if Sys.file_exists "home" then String.concat "" ["home";"/.lul"];;
<abel> i get : Error: This expression has type [ `No | `Unknown | `Yes ]
<abel> but an expression was expected of type bool
flux is now known as flxx
flx is now known as flux
psy_ has quit [Ping timeout: 252 seconds]
<abel> does anyone know how i can manage this [ `No | `Unknown | `Yes ] thing , i have try a match but with no sucess
<flux> try posting the whole code, I don't think that fragment makes much sense to many
<Leonidas> why is this a syntax error?
<Leonidas> let i32r fn = function | Int32.zero -> [] | num -> [];;
<whitequark> you can't use a value in a pattern
<whitequark> for example, it is not necessarily constant
<abel> <flux> this is the whole code
<flux> abel, ok, so you're using Jane street core?
<abel> yes i do a "open Core.Std;; " before
<flux> because standard Sys.file_exists returns a boolean
<cmtptr> aren't you missing an else?
<abel> cause i'm on "real world java" who advise to use this "lib" everytime
<flux> ok, so write your code: match Sys.file_exists "home" with `No -> (* case1 *) | `Unknown -> (* case2 *) | `Yes -> (* case3 *)
<abel> no java ocaml
<Leonidas> whitequark: but I can match on, e.g. ints.
<flux> also as cmtptr pointed out, you must have an else branch
<whitequark> Leonidas: sure. ints are constant
<whitequark> you can match on any constant
<Drup> that's not exactly true ...
<flux> because all paths in a multiple-choice exprsesion need to have the same type
<Leonidas> Int32.zero is also constant
<Drup> Int64.zero is arguably a constant
<whitequark> Drup: disagree
<flux> I think whitequark wanted to say you can match on any literal
<Leonidas> or well, it damn should be ;)
<whitequark> flux: no, constant.
<flux> and constructor
<Leonidas> alright :-(
<Drup> Leonidas: you can pattern match on *constructors*
<abel> <flux> thanks , was missing the quote i'm gona try with this , what does this quote means ?
<whitequark> let me explain
<flux> whitequark, well, most often people say let const = 42 <- const is in fact constant
<Drup> ints happen to be special constructors who do not start with a capital letter :D
<whitequark> let module Int32 = (module X : INT32) in
<whitequark> Int32.zero
<Leonidas> Drup: are number literals constructors for int?
<whitequark> voila, it's not a constant
<Leonidas> hmm, alright.
<whitequark> in a simpler case, module Int32 = struct let zero = int_of_string (read_file "/foo") end
<flux> abel, you mean `?
<Drup> whitequark: bullshit "type foo = None", voila, None is not a constant anymore.
<Drup> that's just not the right explanation.
<whitequark> Drup: nope, still a constant!
AlexRussia has joined #ocaml
<whitequark> because in both cases, the type is known and immutable at compile-time
<flux> abel, ` indicates a polymorphic variant. it's like a sum type (type a = A | B) but you don't need to define a type for it
<whitequark> even with first class modules, the exact numeric value of None is known
<whitequark> and I believe this is the right explanation, because I think predictability of pattern matching is predicated on all values being constant
<whitequark> exhaustiveness checks, and to a lesser degree code generation
<Drup> know at compile time ≠ constant
<flux> but isn't saying "constructors and literals" going to confuse people less?
<whitequark> Drup: hrm. when it is ≠
<whitequark> ?
<Leonidas> in any case, I think I understand the problem.
<ggole> Exception constructors are a bit of an, uh, exception there
<Leonidas> though that's annoying none the less :-/
<whitequark> ggole: oh. Hrm. open types.
<abel> <flux>thanks
<ggole> whitequark: that's half the problem, the other half is hiding
<ggole> If you let test () = let module M = struct exception E end in ...
<ggole> The exception should be unique each time through
<whitequark> ggole: otoh you don't get exhaustiveness checking in this case. hmmmm.
oscar_toro has joined #ocaml
<flux> abel, good luck :)
antegallya has quit [Read error: Connection reset by peer]
<ggole> Hmm, exceptions use caml_set_oo_id for the unique cookie
<whitequark> so I've been thinking a bit more on this
<whitequark> I'm not sure if introducing this would be a good idea, right now
<ggole> A C call seems a bit heavyweight for bumping an int (although I'm sure it doesn't matter)
<whitequark> because what would it use for comparisons, = ?
<ggole> whitequark: yeah, it's a bit problematic
<whitequark> when = is much nicer, until we have typeclasses
<ggole> One possibility is to disallow it if the type is abstract or private
<whitequark> thaaaat would make it much less useful
<whitequark> it won't work with int64s.
<ggole> Yep.
<whitequark> meh.
<whitequark> could as well not have it
<whitequark> actually, what type does *not* contain abstract or private parts?
<ggole> I can imagine rigging up some kind of 'use Foo.equal if that exists' junk
<ggole> But meh
<whitequark> and how is, say, a ref to abstract different from abstract itself?
<whitequark> no, that's awful
<ggole> Non-linear patterns have the same problem
<whitequark> it's ok in a syntax extension
<ggole> Which is a shame, cos those are nice
<whitequark> nonlinear?
<ggole> Same variable twice = matches when equal
<whitequark> oh
<def`> the problem then is the definition of equality
BitPuffin has quit [Ping timeout: 245 seconds]
<whitequark> the Eq typeclass :p
<ggole> That's not all that far from Foo.equal, tbh
<whitequark> same thing, but not done in a horrible hacky way
<ggole> Sure.
darkf has joined #ocaml
maufred has quit [Remote host closed the connection]
darkf has quit [Changing host]
darkf has joined #ocaml
maufred has joined #ocaml
AltGr has left #ocaml [#ocaml]
Thooms has joined #ocaml
orbitz has quit [Ping timeout: 240 seconds]
jlouis has quit [Ping timeout: 245 seconds]
orbitz has joined #ocaml
micrypt has quit [Ping timeout: 245 seconds]
jlouis has joined #ocaml
micrypt has joined #ocaml
thomasga has joined #ocaml
struk has joined #ocaml
avsm has joined #ocaml
dsheets has joined #ocaml
ygrek has joined #ocaml
struk has quit [Ping timeout: 244 seconds]
kapil__ has quit [Quit: Connection closed for inactivity]
travisbrady has joined #ocaml
Yoric has joined #ocaml
struk has joined #ocaml
tnguyen has quit [Quit: tnguyen]
ygrek has quit [Ping timeout: 256 seconds]
dsheets_ has joined #ocaml
dsheets has quit [Ping timeout: 244 seconds]
baz_ has joined #ocaml
uris77 has joined #ocaml
stomp has joined #ocaml
oscar_toro has quit [Ping timeout: 245 seconds]
tnguyen has joined #ocaml
enitiz has joined #ocaml
t4nk495 has joined #ocaml
dsheets__ has joined #ocaml
<t4nk495> is it possible to define a module signature that includes another signature inside?
<whitequark> module X : sig module Y : sig end end
dsheets_ has quit [Ping timeout: 240 seconds]
<whitequark> or; module X : sig include T end, for module type T
<whitequark> or; module X : sig include module type of Y end
<t4nk495> whitequark: thanks
kakadu has quit []
shaykha has joined #ocaml
larhat1 has joined #ocaml
larhat has quit [Read error: Connection reset by peer]
fafounetbis has joined #ocaml
badkins has joined #ocaml
travisbrady has quit [Quit: travisbrady]
baz_ has quit [Quit: baz_]
slash^ has joined #ocaml
kakadu has joined #ocaml
<ahem> how would i specify which version of opam to use to install a module?
<struk|work> ahem: do you mean when packaging your own modules? http://opam.ocaml.org/doc/Packaging.html see the "opam-version" field
regnat has joined #ocaml
travisbrady has joined #ocaml
<troydm> I think he means which version of module to install when using opam
ahem has quit [Read error: No route to host]
ahem has joined #ocaml
fafounetbis has quit [Ping timeout: 256 seconds]
enitiz has quit [Quit: Leaving]
<struk|work> ahem: opam install pkg.1.0 or opam install pkg>=1.0 then ?
Thooms has quit [Quit: WeeChat 1.0.1]
shinnya_ has joined #ocaml
samrat has joined #ocaml
darkf has quit [Quit: Leaving]
JuggleTux has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
struk|work has quit [Quit: Page closed]
MrScout has joined #ocaml
MrScout has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
<icicled> I've noticed that List, Map, Set, and most other modules contain their own versions of a lot of the same functions that are used for traversal of some kind - e.g. iter, map, fold, partition, filter
<icicled> Could these functions perhaps be generalized to operate on any data structure/type given that the structures export a particular interface?
<whitequark> I actually think the interface would be equivalent to iter, map, fold, ...
<ggole> The Haskell people do that
<flux> there have been some attempts. check out ocaml reins.
<ggole> I get the impression that its easy to get things subtly wrong
<flux> someone(TM) should write an Oracle module
<flux> it would provide all possible access patterns imaginable
<flux> then you would run your program, inefficiently, and it would figure out what's the best datastructure for your workload ;-)
<ggole> module Dwim = struct include * end
jao has joined #ocaml
<flux> oh I see you're working on it already
<ggole> let dwim f = dwim f (* works fine, just takes a while *)
<ggole> There, I solved programming. You can all go now.
<whitequark> thanks. helpful
<icicled> I watched a talk on Transducers by Rich Hickey and was wondering if what he described would be possible in ocaml
BitPuffin has joined #ocaml
Antoine59 has quit [Ping timeout: 240 seconds]
<ggole> It should be.
Antoine59 has joined #ocaml
<ggole> Some of the clojure convenience stuff (arity overloading) would have to be done a bit differently.
tane has quit [Quit: Verlassend]
<icicled> I think I will mull this over in my brain for the next few weeks :)
baz_ has joined #ocaml
<Leonidas> is Transducers to Clojure what Monads are to Haskell? :)
baz_ has quit [Quit: baz_]
zwer_o_q has quit [Remote host closed the connection]
<icicled> Leonidas, not quite - see the section "Decoupling From Sequences" @ http://thecomputersarewinning.com/post/Transducers-Are-Fundamental/
gdsfh1 has joined #ocaml
Yoric has quit [Remote host closed the connection]
oscar_toro has joined #ocaml
gdsfh has quit [Ping timeout: 265 seconds]
MrScout has joined #ocaml
Yoric has joined #ocaml
enitiz has joined #ocaml
Yoric has quit [Ping timeout: 264 seconds]
Yoric has joined #ocaml
<ahem> struk|work: sorry, i'd left for a bit. I'd like to use opam with a version number less than 1.2 to install core... is there a flag i can use to specify this?
badkins has quit [Read error: Connection reset by peer]
jwatzman|work has joined #ocaml
bytbox has joined #ocaml
avsm has quit [Quit: Leaving.]
Rebelion has joined #ocaml
<Drup> why do you want to use opam < 1.2 ?
<ahem> I had problems installing utop with my current opam 1.2. But, after some searching i found a command that specified to use opam less than 1.2 . I can't find that command anymore...
<Drup> O_o
<Drup> that seems ... weird
<def`> yes, weird
<Drup> opam 1.2 is much better at mostly everything
<ahem> Anyway, my main issue is that i can't install core...
<def`> "mostly"… It is better at everything :D
<Drup> ahem: could you show the error message ?
rgrinberg has quit [Quit: Leaving.]
<ahem> I using ocam version 4.0.1 and opam 1.2
<ahem> Drup: okay sure, just hang on...
<Drup> ahem: run opam with -v and pastebin everything
chinglish has quit [Quit: Nettalk6 - www.ntalk.de]
jonludlam has quit [Ping timeout: 264 seconds]
mort___ has quit [Quit: Leaving.]
olauzon has joined #ocaml
marynate has quit [Quit: Leaving]
rgrinberg has joined #ocaml
q66 has joined #ocaml
<ahem> Drup: here it is: http://pastebin.com/UCBcZ6nm. Thanks for taking a look at it...
<Drup> you are on 32 bit ?
<ahem> Drup: yup...
<Drup> Does core even work on 32 bit ?
Yoric has quit [Remote host closed the connection]
<ingsoc> I could not get latest ocaml working on 32bit linux
<ingsoc> weirtd errors
<ingsoc> caused me shit when starting out
<Drup> ingsoc: for bare ocaml, it should work
<ingsoc> can't remember details but it was when installing using these instructions
<ingsoc> so using OPAM
<ingsoc> opam switch <latest_version>
<ahem> Drup: not sure... but, can't find anything that says it can't...
baz_ has joined #ocaml
BitPuffin has quit [Ping timeout: 265 seconds]
<Drup> ahem: I heard about it, but I don't remember where, so can't help
<ahem> Drup: thanks for taking a look anyway
zwer has joined #ocaml
<ahem> dsheets__: thanks for the link... I'll try in a 64 bit vm.
nojb has joined #ocaml
travisbrady has quit [Quit: travisbrady]
Haudegen has quit [Ping timeout: 244 seconds]
BitPuffin has joined #ocaml
Haudegen has joined #ocaml
davine has joined #ocaml
davine has quit [Client Quit]
shaykha has quit [Ping timeout: 265 seconds]
ingsoc has quit [Quit: Leaving.]
baz_ has quit [Quit: baz_]
manizzle has joined #ocaml
badkins has joined #ocaml
travisbrady has joined #ocaml
<flux> soo, does anyone use/has anyone used metaocaml for something useful?
matason has quit [Ping timeout: 265 seconds]
<Drup> I'm personally not really interested by what meta ocaml do but more by how it does it :p
<nojb> I staged a full r5rs scheme interepreter (https://github.com/nojb/staged-ocs), lots of fun to do and pretty cool IMHO, not sure if it counts as useful, though …
enitiz has quit [Remote host closed the connection]
vfoley has joined #ocaml
<vfoley> What is the "correct" way in Menhir to detect syntax errors? For instance, I want to detect when a semicolon is missing at the end of a statement.
<nojb> prod: statement SEMI | statement error
<nojb> in general there is no unique way to handle all errors; it depends on the grammar
<nojb> lr parsers are not very good with errors
<flux> was there some point in that staged computing other than optimizations?
<vfoley> nojb: yeah... I have another version using recursive descent where it's simply a matter of using expect(SEMICOLON)
<ggole> You could do statement SEMI_OR_NOTHING and then check for semi in the rule
<ggole> Bit clumsy
<dsheets__> because of menhir's backtracking, I'd recommend putting a general error case "around" the specific error case; otherwise, you risk getting the wrong error message
<dsheets__> flux, macros?
<nojb> flux: staged computing = run-time code generation ; much more than about optimization IMHO
<flux> nojb, so what is the case that yields easier to implement results with metaocaml compared to regular ocaml?
slash^ has quit [Quit: Leaving.]
<flux> ..other than better runtime performance
<flux> for example you can compile expressions into programs with metaocaml
<flux> but the same way you can just evaluate them with an interpreter
<vfoley> dsheets__: can you give an example, not sure I understand.
<nojb> flux: metaocaml lets you do away with the interpreter completely … in a type-safe way
<flux> nojb, well, a practical use for that would be loading .ml code from file runtime and do it safely.. does metaocaml do that?
<flux> nojb, or what do you mean
<flux> I mean, I get it you get to safely compile your custom language to real ocaml code
<flux> but in the end when you run that program, the results are exactly the same as using an interpreter on that custom language
<flux> other than it might do it faster
<Drup> well, you can also do that for ocaml itself, not only a custom language
<flux> but I cannot load it runtime from a file or interactively from a user? or is that something metaocaml provides?
<flux> I mean, it's a string, and I understand metaocaml checks type compile time
<flux> I don't see I get a lot of expressivity benefits from writing ocaml inside ocaml so I can run ocaml programs at runtime
<Drup> except it's a terrible idea from a security point of view, yeah, you can do that
<flux> so that's something new you can do, except you shouldn't ;-)
<Drup> flux: the thing is that in metaocaml, if programs X generates programs Y, Y will still be able to use everything in memory of X
<Drup> that's something I doubt you can do cleanly with anything else.
<flux> but the lifetime of the program Y is always less than program X
<flux> I can just write the program I want inside program X
<flux> program X is able to use everything in program X?
<Drup> Well, it's for optimization purposes, obviously.
<flux> ok, so metaocaml is useful for optimization, thank you ;-)
<flux> not completely unlike C++ templates, except it's runtime?
<Drup> and typed, and clean ? x)
<Drup> and much less constrained
<Drup> functors are like C++ templates :p
<flux> would I be able to 'specialize' (say, a Map implementatino that were inside the scope) code with metocaml to perform faster?
<flux> would inliner find those opportunities somehow better?
<Drup> for example.
<Leonidas> nojb: oh, that's an interesting Scheme implementation :-)
rgrinberg has quit [Quit: Leaving.]
<nojb> one good application for me is that it in principle it lets you mechanically transform an interpreter into a compiler
<flux> if only you were able to store those compiled programs :)
<nojb> that’s an implementation detail :)
<flux> it would be quite amazing in fact.
<flux> even easier than using llvm
<flux> in principle it'd be possible with gcore and programs that run core dumps
<nojb> no really, that will be possible at some point in the future - BER 102 already solves the problem of serializing most of the cross-stage values
<flux> oh, it does? wasn't metaocaml before BER able to do that?
<nojb> no
<flux> ..but it was dropped because it affected ocaml too greatly
<flux> hmm, there was something..
<nojb> ah sorry maybe it did
<flux> mobility it was caled?
<nojb> didn’t really use pre-BER metaocaml
travisbrady has quit [Ping timeout: 240 seconds]
_andre has quit [Quit: leaving]
<nojb> but BER 101 could not do this
rgrinberg has joined #ocaml
travisbrady has joined #ocaml
<def`> nojb: what do you use BER for?
<nojb> def`: nothing presentable so far - but I have played with it quite a bit (eg https://github.com/nojb/staged-ocs)
<flux> nojb, is it fast for the cases it works?
<flux> or has that been a goal at all :)
<nojb> flux: not really, but it is faster - the interpretative overhead is gone when you run the generated code
<flux> these results are interesting: http://www.cs.rice.edu/~taha/MetaOCaml/examples/band-markov-simple.ml (at the bottom)
<ggole> It works by compiling a run-time generated representation of code to bytecode?
rgrinberg has quit [Quit: Leaving.]
<flux> that's what it seems to me :). I don't know if it can do native?
<flux> hmm, oh wait
<flux> it mentioned both
<ggole> Currently the user-level metalib supports printing, and byte-compiling and linking of code values.
<flux> so apparently it can do both
<ggole> Maybe this page is slightly out of date.
<flux> those results could easily be quite old
<flux> Last-Modified: Sun, 14 Mar 2004 23:44:24 GMT
<ggole> I'm reminded quite strongly of Lisp's compile
jgjl has joined #ocaml
jgjl has quit [Client Quit]
jgjl has joined #ocaml
JuggleTux has quit [Remote host closed the connection]
nojb has quit [Quit: nojb]
Yoric has joined #ocaml
enitiz has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
samrat has joined #ocaml
jgjl has quit [Quit: Textual IRC Client: www.textualapp.com]
<cmtptr> https://ocaml.org/learn/faq.html At the part that begins with "How to share a label between two different record types?", I don't understand what problem is being illustrated here.
<mrvn> oehm, that example is wrong
thomasga has quit [Quit: Leaving.]
<cmtptr> oh, is it supposed to generate an error? because it did when I tried it
<mrvn> cmtptr: It used to be that you got an error because the label "x" was last defined as part of point_2d while z is still part of point_3d so the last statement would give an error.
<cmtptr> right, thanks
<mrvn> cmtptr: 3.12?
<cmtptr> yeah, 3.12.1. On my machine at home I'm using something more modern
<mrvn> I have 4.01, which has some logic to pick the right record. I'm still surprised I don't even get a warning that it does so.
<mrvn> cmtptr: now you can even annotate the types to get what you want:
<mrvn> # let get_x r = r.x;;
<mrvn> val get_x : point_2d -> float = <fun>
<mrvn> # let get_x (r : point_3d) = r.x;;
<mrvn> val get_x : point_3d -> float = <fun>
<cmtptr> cool
<mrvn> Still. I would try to avoid using the same labels in the same module. Gets confusing. Better to make submodules.
<mrvn> or unique names
<mrvn> I wonder when they will add the same logic for constructor names.
<mrvn> type t1 = Foo type t2 = Foo | Bar
<mrvn> cmtptr: 4.01/4.02 added some realy nice stuff. Might be worth updating your system so you have the same version everywhere
<cmtptr> it's not my machine
<cmtptr> I'm doing most of my learning at home, anyway. I'm just tinkering around while waiting for compiles at work
<mrvn> well, then just keep an eye out for things that require a newer version.
<adrien> 4.01 is what's going to be deployed for a few years
<mrvn> You probably won't need any of the shiny new feature in quite a while. They are rather advanced cases usualy.
<adrien> 4.02 probably won't get much deployment and 4.03 will be the one used instead (most likely)
<adrien> 4.02 has the nicer exception stuff
<mrvn> open types
<mrvn> adrien: whats new with exceptions?
<ggole> match foo with Ctor -> ... | exception Zonk -> ...
* ggole ♥s exception matching
<mrvn> ahh, syntactic suggar
<Drup> actually, it's not simply syntactic suggar
<ggole> It's actually a little more because it works with tail recursion
rgrinberg has joined #ocaml
<Drup> adrien: *cough* ppx *cough*
travisbrady has quit [Quit: travisbrady]
<adrien> Drup: make yypkg's codebase better through ppx and we'll talk
<adrien> until then...
travisbrady has joined #ocaml
<mrvn> It's the same as: match (try (Result foo) with Zonk -> Exception Zonk) with Result Ctor -> ... | Exception Zonk -> ...
<mrvn> right?
<adrien> not completely
<mrvn> minus the extra allocations
_5kg has quit [Ping timeout: 264 seconds]
<Leonidas> ggole: I totally agree <3
_5kg has joined #ocaml
ggole has quit []
Cyanure has joined #ocaml
nojb has joined #ocaml
hekmek has quit [Quit: Verlassend]
_5kg has quit [Ping timeout: 245 seconds]
olauzon has quit [Quit: olauzon]
govg has quit [Ping timeout: 256 seconds]
Rebelion has quit [Ping timeout: 240 seconds]
samrat has quit [Quit: Computer has gone to sleep.]
moei has joined #ocaml
Rebelion has joined #ocaml
fafounetbis has joined #ocaml
badon has joined #ocaml
Cyanure has quit [Remote host closed the connection]
MrScout_ has joined #ocaml
elfring has quit [Quit: Konversation terminated!]
MrScout_ has quit [Read error: Connection reset by peer]
MrScout_ has joined #ocaml
MrScout has quit [Ping timeout: 265 seconds]
nojb has quit [Ping timeout: 245 seconds]
_5kg has joined #ocaml
ahem2 has joined #ocaml
enitiz has quit [Quit: Leaving]
ahem has quit [Read error: Connection reset by peer]
fafounetbis has quit [Ping timeout: 245 seconds]
badkins has quit []
MrScout_ has quit [Remote host closed the connection]
badon has quit [Quit: Leaving]
MrScout has joined #ocaml
MrScout has quit [Read error: Connection reset by peer]
nze` has joined #ocaml
MrScout has joined #ocaml
dav has joined #ocaml
MrScout has quit [Remote host closed the connection]
MrScout has joined #ocaml
struk is now known as struktured
govg has joined #ocaml
travisbrady has quit [Quit: travisbrady]
thomasga has joined #ocaml
enitiz has joined #ocaml
struktured has quit [Ping timeout: 265 seconds]
MercurialAlchemi has quit [Ping timeout: 252 seconds]
uris77 has quit [Ping timeout: 245 seconds]
travisbrady has joined #ocaml
enitiz has quit [Ping timeout: 264 seconds]
enitiz has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
<Tekk_> anyone familiar with ctypes know if I can just import an enum like a normal value? manually recreating an enum with 300 keys is a huge pain
malc_ has joined #ocaml
rgrinberg has joined #ocaml
kakadu has quit [Remote host closed the connection]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
travisbrady has quit [Quit: travisbrady]