gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
emmanuelux has joined #ocaml
emmanuelux has quit [Ping timeout: 244 seconds]
lopex has quit []
<thelema> hmm, should batteries have yield...
mfp has quit [Ping timeout: 248 seconds]
mfp has joined #ocaml
ccasin has joined #ocaml
arubin has quit [Quit: arubin]
<everyonemines> you don't need yield, use recursion + matching
<everyonemines> at least, that's the ocaml view, personally I feel like if it compiles to goto you should expose that, at least for library writers
oriba_ has joined #ocaml
oriba has quit [Ping timeout: 240 seconds]
qnix_ has joined #ocaml
<everyonemines> You can of course use exceptions, but I'm not sure how fast those are in ocaml
<everyonemines> I think it depends on ocamlc vs ocamlopt.
<everyonemines> And exceptions as control flow because goto is harmful seems dumb.
qnix_ has left #ocaml []
sebz has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
penryu has left #ocaml []
joewilliams is now known as joewilliams_away
dgbaley27 has joined #ocaml
<dgbaley27> I'm trying to do something like "let rec foo (a: int): int = fun (x: int) -> x;;" and getting an error that the exp has type 'a -> 'b but should be int. Why isn't it an int?
<dgbaley27> For starters, I have x:int, so where does the 'a come from?
ulfdoz has joined #ocaml
sebz has joined #ocaml
junsuijin has quit [Quit: Leaving.]
hto has joined #ocaml
dcolish has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
sebz has quit [Quit: Computer has gone to sleep.]
<everyonemines> Can you post the specific code?
<everyonemines> dgbaley27:
<everyonemines> You're saying that foo has a value of int, but you defined it as a function of type 'a -> 'b.
<dgbaley27> but the anonymous function takes x:int
<everyonemines> But its type is not int.
<everyonemines> That's the type of its output.
<dgbaley27> What about this: let rec foo (a: int): int = fun (x: int) -> 5;;
<dgbaley27> Do I need fun (x:int) : int -> 5?
<everyonemines> The type of a function is never int.
<everyonemines> Functions are functions.
<everyonemines> Try let foo = fun (x: int) -> (x: int);;
<everyonemines> or let foo:int->int = fun (x: int) -> (x: int);;
<everyonemines> Get it?
<dgbaley27> The "let rec foo (a: int): int =", inside I need to return a function that takes an int and returns an int
<everyonemines> So you need a type int->int
<everyonemines> not int
<dgbaley27> oh, ok. I'm seeing it now
<everyonemines> dgbaley27: What are you using ocaml for?
<dgbaley27> It's the implementation language for a lambda calculus evaluator
<everyonemines> Generally you would use ocamllex for that...?
<dgbaley27> The lexing and parsing is done
sebz has joined #ocaml
<dgbaley27> everyonemines: thanks, fixed it
avsm has joined #ocaml
ikaros has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
everyonemines has quit [Read error: Connection reset by peer]
dgbaley27 has quit [Quit: Leaving.]
edwin has joined #ocaml
sebz has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
<f[x]> adrien, that means either tracking dependencies to ensure builds don't fail because of out-of-date library or rebuild everything on each commit which is very wasteful
<sgnb> maybe once a week would be enough...
<sgnb> rebuilding everything in Debian takes a few hours
avsm has quit [Quit: Leaving.]
oriba_ has quit [Quit: oriba_]
Kakadu has joined #ocaml
ankit9 has quit [Quit: Leaving]
missingfaktor has joined #ocaml
missingfaktor has left #ocaml []
<f[x]> all my build slaves are virtualized and so it is rather painful, especially on cygwin which is slow by itself
<f[x]> and it involves quite a bit of setup
<f[x]> I have in mind this option as a way to enhance, but I guess not in the nearest future
<f[x]> more priority is to have more slaves, esp. win/msvc
<adrien> well, we can put more resources on that (I said I would throw a quad-core, I think we can easily reach 20 cores)
<adrien> and it wouldn't build only on debian but on debian once, then on fedora, the on netbsd, and so on
<adrien> there aren't a huge amount of commits in ocaml projects so it's probably doable
<adrien> as I said, win/ (not msvc for me) is ok (I only need a few days)
<adrien> also, the _goal_ is to notice libraries that go out of date
<f[x]> I guess I'll have a look at it on the weekend
eikke has joined #ocaml
<eikke> is there any function in OCaml like open_fd :: int -> Unix.file_descr ?
<f[x]> it is not portable
<f[x]> but on unix it is a matter of (unsafe) type cast
<f[x]> there are such functions in ocamlnet and extunix
asmanur_ has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
asmanur has quit [Ping timeout: 260 seconds]
<edwin> adrien: have you seen release of gtk+3.2 and broadway (html5) backend? Now one can write webapps using lablgtk-react...
<edwin> (haven't actually tried it yet)
ftrvxmtrx has joined #ocaml
ankit9 has joined #ocaml
djanatyn has quit [Remote host closed the connection]
djanatyn has joined #ocaml
avsm has joined #ocaml
larhat has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
Boscop_ has joined #ocaml
lopex has joined #ocaml
Boscop_ is now known as Boscop
Boscop has quit [Changing host]
Boscop has joined #ocaml
avsm has quit [Quit: Leaving.]
everyonemines has joined #ocaml
everyonemines has left #ocaml []
everyonemines has joined #ocaml
everyonemines has left #ocaml []
everyonemines has joined #ocaml
<adrien> edwin: hah! I was aware of broadway but I had never thought of putting lablgtk-react intot that :P
<adrien> (there are also several FRP frameworks in js; I'll have to compare them with the current state of lablgtk-react)
iratsu has joined #ocaml
<adrien> also, unfortunately, currently, lablgtk can't be used with gtk3
emmanuelux has joined #ocaml
iratsu is now known as alang
_andre has joined #ocaml
sebz has joined #ocaml
<edwin> adrien: gtk+3.2 doesn't work with firefox 6 (they upgrade the websocket proto), so you have time till next gtk release to make it work ;)
lopex_ has joined #ocaml
lopex has quit [Ping timeout: 252 seconds]
<adrien> hmmm
<adrien> next release of firefox?
<adrien> does that mean I have 36 hours left? (that's the time between two of their releases, right?)
lopex_ is now known as lopex
sebz has quit [Quit: Computer has gone to sleep.]
* NaCl wonders why someone would want to write webapps in Gtk
<adrien> I've seen Libre Office running in a browser
<adrien> that's actually pretty nice
* NaCl explodes
<adrien> heheh =)
<edwin> adrien: next release of gtk, so I meant plenty of time ;)
<edwin> just for fun
<edwin> not for anything serious
<adrien> Jacques Garrigues started the gtk3 port
<adrien> and I don't know if I could do it
<adrien> (and I don't have much time)
<edwin> ah ok
<adrien> I can help but there is low-level stuff that I don't know very well
<edwin> btw any idea what test app I should write with lablgtk-react?
<edwin> couldn't think of anything simple enough (so its not too much work for me), and still useful enough (so more than a textbox and a button)
<adrien> any idea for a cool algorithm?
Boscop_ has joined #ocaml
<edwin> to visualize it in gtk you mean?
<adrien> visualize and/or edit from gtk for instance
<edwin> will think about it
<edwin> that sounds good for a test app
Boscop has quit [Ping timeout: 255 seconds]
dnolen has joined #ocaml
<everyonemines> Do you guys know anything about Jane St?
<adrien> nope, they're a secretive organization with a very specific instantiation ritual
<adrien> why? what are you wondering? :P
<everyonemines> Considering applying there.
<everyonemines> I figure I can write code as good as Core has... :-)
_andre has quit [Quit: leaving]
_andre has joined #ocaml
Boscop_ is now known as Boscop
Boscop has quit [Changing host]
Boscop has joined #ocaml
scottmcl66 has quit [Quit: ChatZilla 0.9.87 [Firefox 6.0.2/20110902133214]]
<everyonemines> but then, maybe that's what they do with interns who aren't good enough for other stuff :-/
<adrien> xD
<adrien> brush up your proving skills
<everyonemines> proving skills?
<everyonemines> What do you mean?
<adrien> ability to prove code/algorithms
<everyonemines> I've never thought much of "software proofs" because there's no reason the proof would be more accurate than the code, personally I think automated tests make more sense
<everyonemines> ....but you're saying Jane Street likes that stuff?
<flux> (proofs can be checked)
<everyonemines> Anything can be checked, any checks can be inaccurate.
<flux> and the checker can be checked. of course, if you think that Coqs checker more likely has a fault than your program, then that is your prerogative :)
<adrien> depends how you do the proof: it should make you look closely at the code again
<thelema> everyonemines: automated tests often catch big errors. proofs often catch little errors
<everyonemines> adrien: So then it's a mechanism to force you to look at code again...
<thelema> everyonemines: and reason about it in detail.
<everyonemines> thelema: In practice, in complex programs, tests have been catching subtle errors?
<everyonemines> Any examples of this being done?
<thelema> everyonemines: you mean proofs?
<everyonemines> Like, companies that do proofs of nontrivial programs in practice.
<everyonemines> Are you saying Jane St does?
<flux> apparently the new java class loader is based on some kind of certified java?
<thelema> To catch a subtle error with a test, you have to either get lucky or know the error exists already
<everyonemines> Or, stories about a proofs catching subtle errors in programs.
<adrien> my biggest issue with proofs is that they are correct but don't match the code (which is incorrect), because I didn't pay enough attention to the exact code I had written
<everyonemines> Case studies.
<thelema> everyonemines: those are easy - look up SPARK/Ada
<flux> everyonemines, I understand that typically one would make proofs beforehand, so they don't quite catch bugs in that way
<flux> and for example Cog allows to extract code from the proofs
<everyonemines> Any proof would itself constitute a complete description of the program
<everyonemines> if it's more likely to be correct, and you're doing it anyway, why not just use that as the programming language?
<thelema> everyonemines: yes, but bot necessarily at the level of "this is how to do x" but at the level of "what is being done satisfies property x"
<flux> because it is tedious to prove the machine, in little bits, that your program satisfies what you are claiming
<thelema> *but
<thelema> err, *but not
<everyonemines> thelema: That's just a fancy way to say "execution speed" ...
<everyonemines> You can't show that the output satisfies conditions without describing the whole program.
alang has quit [Read error: Operation timed out]
<thelema> everyonemines: for things like "the output is three more than the input", you're right. For things like "the output is the prime factorization of the input", you're wrong
<flux> everyonemines, when did execution speed come into play?
<everyonemines> thelema: So how do you prove a program outputs a factorization without a complete description of it?
kizzx2 has joined #ocaml
<flux> I'm not quite sure what the topic is. obviously a proof completely describes what it is prooving, and the proof can be viewed as a program.
<thelema> you mean a complete description of the program in the language of proofs? This can be generated from the program mechanically.
<kizzx2> (noob question) hey guys, i just used `godi_perform -build ocamlnet` and everything went OK, when i run `/opt/godi/bin/ocaml` and tried `#require "ocamlnet"`, it says no such package..... how is it supposed to work?
<flux> kizzx2, I don't quite know godi, but to me it sounds like -build would not yet install it?
<flux> kizzx2, ocamlfind list will list you currently installed packages
<everyonemines> OK, so you have some software that can automatically prove stuff about your program. What are the "proving skills" you're using then?
<thelema> kizzx2: did you `#use "topfind";;` first?
<thelema> everyonemines: that software will never be able to prove everything. Thus people are needed to fill in the gaps.
<flux> and vice versa, people don't bother proving everything, thus computers are needed to fill in the gaps :)
<kizzx2> thelema: yes i did
<kizzx2> flux: umm well i guess that's just the way the command is called, from both `godi_list` and `godi_console` i see it listed as "installed"
<thelema> kizzx2: then you should run `ocamlfind list` and check that ocamlnet is an installed package name
<kizzx2> thelema: not surpsiingly, `ocamlfind list` does not contain it
<kizzx2> which is rather strange, because i installed batteries using GODI and it seems to be working properly
<thelema> kizzx2: ok, maybe you're missing some environment variable... or maybe the godi install didn't actually work...
<kizzx2> thelema: o, the latter part is possible mmm
<kizzx2> let's see
<kizzx2> if it worked, am i supposed to be seeing some files with glob "*ocamlnet*.cmo" somewhere?
<thelema> more likely .cma
<kizzx2> oic
<kizzx2> sorry for the n00bness :P
<flux> actually
<flux> kizzx2, #require "ocamlnet";; isn't probably right..
<flux> kizzx2, does ocamlfind list | grep netstring show something to you?
<kizzx2> yes "netstring (version: 3.4)"
<flux> the packages from ocamlnet are named netXXX
<flux> :-)
<thelema> flux: ah, good call
<kizzx2> aaaa
<kizzx2> alright
* thelema bonks the ocamlnet people for not using one package
<kizzx2> great
<kizzx2> #require "netclient" was what i needed
avsm has joined #ocaml
<flux> thelema, yeah, I don't know why not all of those modules couldn't be under ocamlnet or perhaps even just plain net. net.string etc.. but of course, it's difficult to switch now.
struktured has joined #ocaml
Boscop_ has joined #ocaml
Boscop has quit [Disconnected by services]
Boscop_ is now known as Boscop
Boscop has quit [Changing host]
Boscop has joined #ocaml
Boscop_ has joined #ocaml
everyonemines has quit [Quit: Leaving.]
dnolen has quit [Quit: dnolen]
Boscop has quit [Ping timeout: 256 seconds]
<kizzx2> is there somethign like `it` in GHCi, `_` in python or irb for ocaml toplevel? (get the last evaluated result)
lopex has quit [Ping timeout: 252 seconds]
<flux> no. not sure about utop either (an alternative toplevel), but I suppose not there either.
<kizzx2> alright thanks :P
hcarty has joined #ocaml
<hcarty> thelema: Which ocamlgsl package did you use as the source for your oasis'd version?
<hcarty> I think Markus Mottl's version fixes several bugs in the original 0.6.0 release
<hcarty> thelema: Also, the uninstall command should probably be
<hcarty> ^^ "ocamlfind remove gsl"
<hcarty> Rather than ocamlgraph
<thelema> hcarty: yes, lots of bugs still.
<thelema> hcarty: I guess I should use markus's version - I got this one off the original author's site
<zorun> kizzx2: that could be a feature request for utop :)
<thelema> Is there a nice way to do a efficient map across a collection of lists with sharing?
<thelema> i.e. the collection of lists has many lists where the tail of one list is physically equal to the tail of another
<thelema> and I don't want to compute [f] of that tail twice
<thelema> I want to compute [let rec f = function [x] -> x | h::t -> g h (f t)] on lists that have [h1::t1, h2::t2 where t1 == t2]
<thelema> One solution is caching - cache the results of f in an associative array, and try looking up the value in that array first before computing it.
<thelema> Another solution is to use records for my list and store the result into that record, so that all pointers to the record have the result.
<thelema> I've tried hashconsing, but it seems to just help with the first solution, and doesn't solve the problem on its own
avsm has quit [Quit: Leaving.]
emmanuelux has quit [Ping timeout: 244 seconds]
elehack has joined #ocaml
avsm has joined #ocaml
sebz has joined #ocaml
elehack has quit [Quit: Headed out, possibly to home]
yezariaely has joined #ocaml
Kakadu has quit [Quit: Page closed]
sebz has quit [Quit: Computer has gone to sleep.]
ankit9 has quit [Quit: Leaving]
Boscop_ is now known as Boscop
Boscop has quit [Changing host]
Boscop has joined #ocaml
kizzx2 has quit [Ping timeout: 255 seconds]
rixed has quit [Read error: Operation timed out]
milosn has quit [Ping timeout: 256 seconds]
ikaros has joined #ocaml
larhat has quit [Quit: Leaving.]
Kakadu has joined #ocaml
<metasyntax|work> http://ideone.com/1xbBV -- I don't understand why this code doesn't work. Since compile_filters is polymorphic, shouldn't this be OK?
<metasyntax|work> (Ignore the name_filters and address_filters names, I forgot to change them when I generalised the problem I was having in my real code.)
<thelema> metasyntax|work: be aware that in most cases, explicit typing declarations don't force the type.
<thelema> they just add restrictions to what the final type can be.
<thelema> for this example, if you make compile_filters a function, it'll be properly polymorphic.
<metasyntax|work> thelema: Sorry, I added those annotations trying to get better error messages from the compiler in my real code.
avsm has quit [Quit: Leaving.]
<metasyntax|work> Why is it that it isn't polymorphic when List.map is partially applied?
<thelema> in this case, the annotations are more general than the inferred type. there's no error or warning for this (maybe there should be a warning).
<thelema> because compile_filters isn't a function syntactically.
<thelema> it's a value, and values don't get promoted from '_a to 'a
<thelema> val compile_filters : (string * ('_a -> '_a -> bool)) list -> '_a filter list
<thelema> well, values that aren't top-level declared as functions don't get promoted.
<thelema> the solution is to just put [fun lst -> List.map ... lst]
<thelema> it seems that this is the same as what you wrote, but there's cases where what you wrote can break the type system if allowed to promote to full polymorphism
<metasyntax|work> Right, that's what I meant. I thought I was being clever. Too clever, clearly. :-)
<metasyntax|work> What's the difference between '_a and 'a ?
<thelema> too clever for the compiler
<thelema> "The type of this expression contains type variables that cannot be generalized"
<thelema> if you're using 3.12, you can do this: http://ocaml.janestreet.com/?q=node/79
<thelema> and this should give you the error you were expecting on the signature mismatch
lopex has joined #ocaml
ulfdoz has joined #ocaml
<metasyntax|work> thelema: Thank you for the excellent information. I'll take some time to digest it all.
<thelema> you're welcome.
eikke has quit [Read error: Operation timed out]
funtkronic has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
ikaros has joined #ocaml
ikaros has quit [Client Quit]
ikaros has joined #ocaml
Anarchos has joined #ocaml
NaCl has quit [Ping timeout: 255 seconds]
ulfdoz_ has joined #ocaml
ankit9 has joined #ocaml
ulfdoz has quit [Ping timeout: 244 seconds]
ulfdoz_ is now known as ulfdoz
milosn has joined #ocaml
eikke has joined #ocaml
sebz has joined #ocaml
eikke has quit [Ping timeout: 256 seconds]
junsuijin has joined #ocaml
eikke has joined #ocaml
emmanuelux has joined #ocaml
funtkronic has quit [Quit: Page closed]
<thelema> any suggestions on allowing users to get the comparison function of a polymorphic map?
struktured has quit [Read error: Connection reset by peer]
ikaros has quit [Quit: Ex-Chat]
struktured has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
Modius has joined #ocaml
sebz has joined #ocaml
yezariaely has quit [Quit: Leaving.]
djanatyn has quit [Ping timeout: 252 seconds]
djanatyn has joined #ocaml
ikaros has joined #ocaml
_andre has quit [Quit: leaving]
hcarty has quit [Quit: leaving]
NaCl has joined #ocaml
NaCl has quit [Changing host]
NaCl has joined #ocaml
sebz has quit [Ping timeout: 252 seconds]
<Anarchos> thelema i thought it was forbidden
<thelema> Anarchos: I'm about to add it
<Anarchos> thelema to the official ocaml ??
<Anarchos> thelema isn't it semidecidable ?
<thelema> to BatMap's polymorphic map
<Anarchos> thelema i will read about that tomorrow : sleep calls...
<thelema> cheers
sebz_ has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
Kakadu has quit [Quit: Konversation terminated!]
lpereira has joined #ocaml
sebz_ has quit [Quit: Computer has gone to sleep.]
alang has joined #ocaml
edwin has quit [Remote host closed the connection]
ulfdoz has quit [Ping timeout: 260 seconds]
dsheets has quit [Ping timeout: 252 seconds]
ikaros has quit [Quit: Ex-Chat]
dsheets has joined #ocaml
<_habnabit> thelema, well, it's accessible in the functorial interface. I don't see why not.
<_habnabit> also, a generated .d.byte executable shouldn't be doing any inlining, right?
<_habnabit> its backtrace looks like it's missing frames.
<_habnabit> yeah, hm, it's definitely doing inlining.
djanatyn has quit [Disconnected by services]
djanatyn has joined #ocaml
Modius has quit [Read error: Connection reset by peer]
wagle_ has joined #ocaml
wagle has quit [Read error: Connection reset by peer]
Amorphous has quit [Ping timeout: 260 seconds]
everyonemines has joined #ocaml
Amorphous has joined #ocaml
sebz_ has joined #ocaml
junsuijin has quit [Ping timeout: 258 seconds]
dnolen has joined #ocaml
lpereira has quit [Quit: Leaving.]
dnolen has quit [Quit: dnolen]
struktured has quit [Read error: Connection reset by peer]
struktured has joined #ocaml
ag4ve has joined #ocaml
cgroza has joined #ocaml
lopex has quit [Ping timeout: 258 seconds]
<cgroza> Hello everyone. Is it possible tocreate object instances like in imperative languages? or the Ocaml object system works in a total different way?
sebz_ has quit [Quit: Computer has gone to sleep.]
struktured has quit [Ping timeout: 252 seconds]
<everyonemines> cgroza: Did you not read any basic information about objects?
<cgroza> everyonemines: I am currently reading about methods and transformations.
lopex has joined #ocaml
<cgroza> everyonemines: I guess I should read that material instead. Thanks.
alang has quit [Ping timeout: 276 seconds]
sebz has joined #ocaml
<thelema> _habnabit: odd, I thought only ocamlopt did inlining.
struktured has joined #ocaml
arubin has joined #ocaml
eikke has quit [Ping timeout: 252 seconds]
alang has joined #ocaml
Boscop has quit [Ping timeout: 260 seconds]
junsuijin has joined #ocaml
emmanuelux has quit [Ping timeout: 244 seconds]