vect changed the topic of #ocaml to: OCaml 3.07 ! -- Archive of Caml Weekly News: http://pauillac.inria.fr/~aschmitt/cwn, ICFP'03 http://www.icfpcontest.org/, A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/, A free book: http://cristal.inria.fr/~remy/cours/appsem, Mailing List (best ml ever for any computer language): http://caml.inria.fr/bin/wilma/caml-list
__DL__ has quit [Remote closed the connection]
Vincenz has joined #ocaml
Vincenz has quit []
axolotl has quit [Read error: 110 (Connection timed out)]
Kinners has joined #ocaml
maihem is now known as zebedie
zebedie is now known as maihem
maihem has quit ["Client exiting"]
buggs|afk has quit [Read error: 60 (Operation timed out)]
brwill has joined #ocaml
brwill is now known as brwill_zzz
<Defcon7> anyone online ?
<Riastradh> Yes.
<Defcon7> :)
<Defcon7> im finally finished the program where i was working yesterday
<Defcon7> thanks for the help you give me
<Defcon7> now im trying to compile popget
<Defcon7> a program that i've found on ocaml hump
<Defcon7> but i get a syntax error in a point where i dont figure what that syntax does so im unable to handle it
<Defcon7> let num = match tokens (compare_line "+OK") with parser
<Defcon7> [<'Ident "+"; 'Ident "OK"; 'Int num; 'Int size >] ->
<Defcon7> this is the code
<Defcon7> the syntax error appears in the first chars of second line
* Riastradh doesn't know anything about stream literals.
<Defcon7> so we are 2 :)
<Kinners> Defcon7: you need to use camlp4o.cma (or camlp4r.cma for the revised syntax)
<Defcon7> oh.
<Defcon7> i have to use that just like any other .cma ?
<Kinners> at the toplevel you can that load it like any other, I'm not sure about compiling
<Kinners> maybe using something like, ocamlc -pp "camlp4o" popget.ml etc.
<Defcon7> camlp4 - Pre-Precessor-Pretty-Printer for OCaml
<Defcon7> oh :)
<Defcon7> it works now
<Defcon7> thank :)))
buggs|afk has joined #ocaml
lam_ has joined #ocaml
lam has quit [Read error: 110 (Connection timed out)]
Herrchen_ has joined #ocaml
Herrchen has quit [Read error: 110 (Connection timed out)]
<Defcon7> defcon7@spawn:~/ml$ ocamlopt -o pbs -I +mysql prova.ml mysql.cmxa unix.cmxa str.cmxa usleep.c
<Defcon7> /usr/lib/ocaml/mysql/mysql.cmi is not a compiled interface
<Defcon7> why that :?
<Smerdyakov> It's gremlins.
<Defcon7> haha probably
<Defcon7> you have to say something more useful ?
<Defcon7> :P
<Smerdyakov> It's Class A gremlins.
<Defcon7> this is really useful
<Defcon7> you are useful.
<Smerdyakov> I am useful.
Kinners has left #ocaml []
<Defcon7> someone knows why what error ?
<Defcon7> that.
wax has joined #ocaml
Riastradh has quit [Read error: 110 (Connection timed out)]
<smkl> Defcon7: your sql library and compiler have incompatible versions
lus|wazze has joined #ocaml
srv has joined #ocaml
mattam_ has joined #ocaml
gim has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
async has joined #ocaml
buggs|afk is now known as buggs
mattam_ is now known as mattam
karryall has joined #ocaml
Herrchen_ is now known as Herrchen
maihem has joined #ocaml
srv has quit ["leaving"]
ddaa has joined #ocaml
mimosa has joined #ocaml
Demitar has quit [Read error: 54 (Connection reset by peer)]
Demitar has joined #ocaml
maihem has quit ["Client exiting"]
srv has joined #ocaml
owll has joined #ocaml
owll has left #ocaml []
Riastradh has joined #ocaml
maihem has joined #ocaml
maihem has quit ["Client exiting"]
__DL__ has joined #ocaml
owll has joined #ocaml
carm has joined #ocaml
owll has left #ocaml []
phubuh has joined #ocaml
<carm> hello all
noss has joined #ocaml
ddaa has quit ["Client exiting"]
malc has joined #ocaml
<carm> anyone here?
<Demitar> carm, apparently 41 people, I suppose that counts as "anyone".
<carm> good point.
<carm> I meant "at the keyboard"
<carm> Can I discuss a topic with you briefly Demitar?
<Demitar> I can't tell you if you'll get a useful answer unless I know the topic. :) Note that asking to ask is generally useless on irc. ;-)
<carm> I know this, I just have a general question. How do you like OCAML, have you made any big projects on it yet?
<Maddas_> carm: While I have never made any big projects in it (or any other language, for that matter), I like it a lot.
<malc> OCaml is bloody abomination, and anyone who makes any projects with it, leave alone, big is insane
<Maddas_> :-)
<carm> I just started using (formerly a big SML fan), and I like it alot too. I've almost finished a network based texas holdem game with it
<Demitar> carm, I love ocaml, the type system is the best part imo. ;-) 10k loc easily gets unwieldy in python once you start to refactor types.
<carm> I also interfaced ocaml with the poker evaluator library written in C. I like how you can write "wrappers" into C.
<Maddas_> malc: I like that rant though, gotta remember that one.
<malc> Maddas_: glad to be of service
<carm> I love OCAML thus far, but I have run into 2 problems. 1 (theoretical): Classes or Modules?
<Smerdyakov> Modules when you can. Classes when you can't.
<mattam> depends on culture too
<carm> my code has been teetering between the two of them. Writing a poker server / client is very naturally object orientated.
<Smerdyakov> carm, how so?
<carm> Smerdyakov: well the game itself is a really a mutable state.
<Smerdyakov> Mutable state isn't OO!
<Smerdyakov> It's just imperativity!
<carm> Smerdyakov: mutable state and OO are quite compatible however.
<carm> Think of all the mutable fields a texas holdem game requires
<mattam> OO in ocaml is both functional and imperative - friendly
<carm> all those fields are not something I want to always pass along functionally
<Smerdyakov> Good thing mutable fields of class obejcts aren't the only imperative features OCaml provides!
<carm> Smerdyakov: collectively, how would one represent a group of mutable related fields, and pass this data easily to other functions?
<Demitar> carm, type foo = { mutable bar : int; }
<Smerdyakov> An abstract type.
<mattam> Smerdyakov: ?
<carm> Demitar: thats like a glorified struct in C. why not use an object? have some cute methods to change the fields?
<Smerdyakov> You use whatever implementation you want (probably a record), but you only allow one module to know what it really is.
<Smerdyakov> That module has the traditional accessor and mutator methods that you think of as being associated with "OO."
<mattam> oh yeah
<carm> Smerdyakov: I still dont see how everything would come together as nicely as it would OO.
<noss> Someone should implement a CLOS like OO for ML. I'm not voluntary.
<karryall> carm: it's just a matter of writing "operation obj args" instead of "obj#operation args"
<carm> karryall: well thats merely the syntactical difference.
<karryall> that's the point : unless you need row polymophism and/or inheritance, the difference is almost only syntaxical
<carm> karryall: row polymorphism?
<carm> noss: CLOS?
<noss> common lisp object system.
<carm> ahh
<karryall> when you have several classes that have methods in common, you can write polymorphic methods that use only these methods
<carm> well anyway, I have some modules, but primarly it is object oriented, for the better or worse. Its not really that I prefer either, but the OO approach jumped on me faster, thats for sure.
<carm> karryall: thanks
<Maddas_> Gotta love freedom of choice
<carm> could someone point me out to an example of a simple class, and its module analog?
<carm> Maddas_: certainly one of the beauties of ocaml.
<Demitar> carm, iirc the ocaml book lists some examples.
<karryall> carm: you change all attributes of the class into a record with fields
<carm> Demitar: you referring to the ocaml manual?
<karryall> carm: and then the method to functions taking the record as first argument
<carm> or the o'reilly book?
<Demitar> carm, the o'reilly book.
<Smerdyakov> carm, one thing with using OO is that you use a method dispatch table at runtime, which is nice to avoid if you can.
<Smerdyakov> carm, if you use no inheritance/subclassing, then this really is superfluous.
<carm> Smerdyakov: how much overhead are we talking about, really
<Smerdyakov> Not much. Just not as clean as it could be, conceptually. :D
<carm> karryall: ah so it is oreilly
<Demitar> Smerdyakov, the only hitch with modules is that typing can become tedious, and with oo they type errors can be hard to read.
<carm> Demitar: well I know from ML the virtues and vices of the type system.
<Smerdyakov> Demitar, I've not found typing to be "tedious" with modules.
<carm> hehe I sense an argument
<Demitar> Smerdyakov, I often remember I need a parenthesis to evaluate a function correctly too late and need to move back a bit to add the '('. :-)
<Smerdyakov> OK....
<Demitar> carm, well, it wouldn't be the first time this specific argument comes up. :) But we're all happy doing things our own way. :
<carm> Demitar: yeah I recall reading about the overhead with classes, but tihs project of mine regardless has a made a great learning experience with OCAML.
<carm> karryall: ok I think I see the translation. However, it seems uglier to me
<Demitar> Also consider (String.sub (Buffer.contents (List.hd foo) ...) vs foo#hd#contents#sub ... you type the way you think in the second case. Now I do usually prefer modules because of other benefits but it can get tedious. :-)
<carm> karryall: on the other hand, my code contains imperative / functional / OO in a crazy mix
<carm> Demitar: I'd like to believe that program should sort of lend itself well to a particular approach
<karryall> carm: sure, you cannot always do this "translation"
<carm> karryall: particularly with inheritance?
<Demitar> Well partial function applications get easily get messy with objects on the other hand.
<karryall> carm: anyway if it works fine the way you wrote it, there's no need to rewrite everything
<carm> Demitar: this is true, but I have no need for that in this project.
<karryall> carm: yes, you do some inheritance with modules, up to a point
<noss> How often do you people use partial evaluation?
<carm> ok, well I guess we could have philosophical arguments on this all day, but I think I've heard enough.
<karryall> I'm afraid it will soon get heavy
<Smerdyakov> noss, can you be more specific? Does any use of a curried function count?
<Demitar> noss, quite often, especially when iterating lists.
<carm> Demitar: Its a very powerful technique- to create a new function just by passing an argument to the orginal.
<noss> Smerdyakov: Well, my background is with langauges that doesnt have currying. I find the examples of its use elegant but I do not see such frequent use of it for my plain code.
<Smerdyakov> noss, well, for instance (List.map someFunction) can be passed to another function that operates on lists
<Maddas_> Same here, especially when defining operations on matrices or such
<noss> I just wonder if ill learn to see where i can use it, or if it is more of a theoretical feature.
<Maddas_> It's not something people don't use.
<malc> %100 theoretical
<malc> no real use
<carm> the ocaml manual has an example I have always like using derivites: http://caml.inria.fr/ocaml/htmlman/manual003.html
* Demitar gives malc a cookie.
<malc> clever people avoid it like a plague
<noss> Well, I could use closures to archive the same thing.
<Smerdyakov> noss, you could, but it takes more code to get the same effect. (Not that currying isn't creating closures already)
<Maddas_> noss: It always takes getting used to features you got around without before - same like when you see OO the first time, you might not see them as useful
<Smerdyakov> noss, imagine a 15 argument function you want to specialize based on a given first argument.
<noss> smeardyakov: on the other hand i wouldnt have to think about the order of my argument so it would be of maximal use when curried.
<Smerdyakov> noss, you'll have to pattern match every one of the remaining 14 arguments without currying. :D
<carm> one thing I have realized through experience is that records get real ugly when they are too big. Can't remember order of parameters
<Smerdyakov> carm, order and records? How do you mean?
<malc> Smerdyakov: do you realize that function of 15 args tells us a lot about your quality as a programmer, or lack thereof
<malc> sigh
<Smerdyakov> malc, sure, but 3 args is reasonable.
<carm> Smerdyakov: well I mean record in the ML sense, ie. (int * bool * char) is a record of size 3
<Maddas_> let sum = List.fold_right (+) 0
<Smerdyakov> malc, the point is that the amount of finger-typing work grows proportionately to the number of arguments.
<Smerdyakov> malc, whereas currying allows you to specialize one argument with constant finger-typing.
<malc> Smerdyakov: heresy
<malc> go tell that to SML crowd
<Demitar> malc, laziness is probably closer to the truth than quality. :-)
<malc> they will laugh at you, and probably spank a bit
<Smerdyakov> Is malc usually here?
<carm> malc: haha this is great.
<Maddas_> Oh, so currying is O(1) :-)
<malc> Demitar: laz_y_ness is an invention of evil peyton johnes and kun
<malc> and maybe the guys who did miranda
<malc> should be outlawed
<carm> malc: if you didn't believe in laziness, you would only use assembly.
<carm> malc: or possibly a turing machine implementation like brainfuck
<malc> carm: come to think of it, i do only use assembly
<malc> i much prefer intercal thank you very much
<Herrchen> intercal has this comefrom statement, doesn't it?
<carm> malc: yuck. you must be joking
<malc> carm: im dead serious, constantly
buggs is now known as buggs|afk
<carm> malc: tell me a decently sized program you've written this langauge.
<Defcon7> SYS_gettimeofday(0x59225e00, 0, 0x0831e9e4, 0x2237836c, 0x22358050) = 0
<Smerdyakov> carm, malc is trolling right now. You should probably ignore him.
<Defcon7> someone can tell me an ocaml function which uses this syscall ?
<carm> Smerdyakov: just making sure that people who use intercal dont exist
<carm> :)
<malc> carm: DNA selection for producing square cucumbers was probably the most complete..
<malc> ~700KLOC
<Defcon7> which makes this syscall
<Defcon7> :)
<malc> Unix.gettimeofday ?
<carm> Defcon7: what syscall?
<Defcon7> oh :P
<Defcon7> gettimeofday
<carm> oh
<Defcon7> thats ok
<Defcon7> thanks
<malc> geesus
<malc> there must be a corporal punishment for questions like this
<Defcon7> i dont supposed theres a Unix.gettimeofday :P
<carm> Unix.gettimeofday;; - : unit -> float = <fun>
<carm> Defcon7: make sure you load the unix module - ie. #load "unix.cma";;
<Defcon7> nop im trying to debug a program
<Defcon7> mldonkey, do you know ?
<Defcon7> ltracing it seems uses that function when idle
<carm> Defcon7: yes, thats how I first got introduced to OCAML
<Defcon7> and then eates a lot of cpu
<carm> odd
<noss> Defcon7: how often does it make that syscall?
<Defcon7> in a loop flavour
<noss> yah, but tell me the time between two calls.
<carm> Defcon7: well thats unhealthy at best
<carm> ok hungry, bbl.
carm is now known as carm|afk
<noss> many userspace implementation of timers or threads use lots of frequent calls to gettimeofday
<Defcon7> yes im not sure of what said before, it just seems
<Defcon7> 17:22:26.114520 SYS_gettimeofday(0x5bcbdc80, 0, 0x0831e9e4, 0x2ccbe560, 1) = 0
<Defcon7> 17:22:26.114878 SYS_gettimeofday(0x5bcbdc50, 0, 0x0831e9e4, 0x083d8ebc, 13) = 0
<Defcon7> 17:22:26.115096 SYS_gettimeofday(0x5bcbdc80, 0, 0x0831e9e4, 0x083d8ebc, 13) = 0
<Defcon7> it is a 700mhz duron processor with load avg around 1.3
<noss> well, it is possible that some thread in mldonkey is doing something stupid by polling.
<Defcon7> yup
<noss> profile it.
malc has quit ["no reason"]
<Defcon7> i started a fresh mldonkey client without active servers/downloads and the fact is a lot more visible
<Defcon7> now im really supposing its being used like a sleep function in the mainloop
<Defcon7> ill walk in mldonkey srcs
<noss> it might be that each call to select(2) is followed up by a call to gettimeofday(2) so the process knows the current time.
<noss> and select has a timeout for some business it needs to be automagic about.
<Defcon7> src/utils/lib/stubs_c.c- while(1){
<Defcon7> src/utils/lib/stubs_c.c: gettimeofday(&now, NULL);
<Defcon7> ohohohoh
<karryall> this is in mldonkey source tree ?
<Defcon7> yup but dont know if its used in the mldonkey client or in a tool distribuited with it
<Defcon7> i have to verify
maihem has joined #ocaml
noss has quit ["Client exiting"]
srv has quit ["leaving"]
karryall has quit ["home"]
<Defcon7> im installing cdk2 from ocaml.org
<Defcon7> how i can enable lablgl ?
<Defcon7> (when doing ./configure)
__DL__ has quit [Remote closed the connection]
lus|wazze has quit ["If we don't believe in freedom of expression for people we despise, we don't believe in it at all -- Noam Chomsky"]
buggs|afk has quit [Read error: 110 (Connection timed out)]
Vincenz has joined #ocaml
buggs has joined #ocaml
eternite has joined #ocaml
<eternite> Hello evrybody!
<Riastradh> HI!
<Demitar> Greetings eternite.
Hipo has quit ["Kiki. :-)"]
<mellum> Okay, maybe this time... Does anybody know why Ocaml has no call/cc? Implementation too difficult? Lack of percieved usefulness?
<mimosa> I think that you have a very similar mechanism with exceptions no ?
<mellum> Well, continuations seem more flexible... and SML/NJ has them
maihem has quit [Read error: 104 (Connection reset by peer)]
<mattam> would be nice to have them i think
<mattam> so maybe it's just a matter of dev. choice
<mimosa> mellum: what can you do whith callcc that you cannot do with exceptions ?
<Riastradh> mimosa, re-enter.
systems has joined #ocaml
<mimosa> mmm yes
<mimosa> thanks
<Riastradh> Exceptions are a subset of continuations.
<mellum> Riastradh: well, not really
<mellum> Riastradh: in fact, in a pure, typed language, exceptions are strictly more powerful :)
<Riastradh> ??
<mellum> If you add exceptions to a typed lambda calculus, you get a turing-complete language, but not if you add continuations
<mellum> however, real languages have explicit recursion, so that doesn'r really apply
<Riastradh> The Lambda-Calculus is _already_ Turing-complete.
<mellum> Riastradh: not the typed onw
<Riastradh> Oh.
<mellum> So comparing the "power" of exceptions and continuations os somewhat difficult
* Riastradh isn't quite sure what he meant when he said 'subset.'
<mellum> Well, you can usually replace use of exceptions in real languages with use of contionations, without changing a lot of code, maybe even using macros. But formalizing that statement doesn't seem possible.
* Riastradh thinks someone must have been using nitrous nearby for a few moments when he said that.
<phubuh> hey, this channel is active!
<mellum> Sorry, did I break some vow of silence?
<phubuh> unfortunately.
<Riastradh> Now we'll have to kill you.
<mellum> You'll never get me! Bwahahahaha!!
<Riastradh> Would you prefer death by being beaten over the kneecaps with Zippy dolls, or being killed with the...Comfy Chair?!!?
systems has quit ["Client Exiting"]
<mellum> What is this, some kind of Spanish Inquisition?
<Riastradh> NOOOOOOBODY EXPECTS THE SPANISH INQUISITION! Our chief weapon is surprise.
<Riastradh> ...er, and fear.
Xolution has joined #ocaml
<Xolution> Hey, how can I do something like this:
<Xolution> let foo () =
<Xolution> bar ()
<Xolution> and bar () =
<Xolution> "blah";;
<Xolution> ?
<Xolution> nm
<Xolution> let rec ...
<Xolution> fixes it
<Defcon7> let rec foo () = let bar = blah in foo ();;
<Defcon7> i think
<Defcon7> this is a loop
<Defcon7> if whats u mean
<Defcon7> if it is what you wanted.
Demitar has quit [Read error: 104 (Connection reset by peer)]
<eternite> by
eternite has quit ["Arlg connection crash!"]
malc has joined #ocaml
Xolution has quit [Read error: 110 (Connection timed out)]