smimou changed the topic of #ocaml to: OCaml 3.08.3 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
vezenchio has quit ["Ayn Rand encapsulates the rage that every teenager feels on finding that his first paycheque has had taxes taken out of it"]
vincenz has quit ["leaving"]
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
Smerdyakov has joined #ocaml
Smerdyakov has quit [Read error: 104 (Connection reset by peer)]
mrsolo has quit [Read error: 104 (Connection reset by peer)]
Smerdyakov has joined #ocaml
Smerdyakov has quit [Read error: 104 (Connection reset by peer)]
kinners has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
Herrchen_ has joined #ocaml
Herrchen has quit [Connection timed out]
kinners has quit [Read error: 110 (Connection timed out)]
Smerdyakov has joined #ocaml
<ulfdoz_> re
bk_ has quit [""(quit)""]
Smerdyakov has quit []
r2d4 has joined #ocaml
r2d4 has left #ocaml []
monochrom has quit ["good morning, sweet dream"]
Herrchen_ is now known as Herrchen
Snark has joined #ocaml
<Snark> slt
mlh_ has quit [Client Quit]
_shawn has quit [Read error: 110 (Connection timed out)]
_shawn has joined #ocaml
pango has quit [Remote closed the connection]
Saulzar has quit ["Leaving"]
pango has joined #ocaml
haakonn has joined #ocaml
<haakonn> i often see people write 'let _ = foo' instead of just foo. what's the point with that?
<mflux_> inside a function I take it?
<mflux_> it it not the same as just 'foo'
<mflux_> it is about the same as 'ignore (foo)'
<haakonn> no, outside
<haakonn> as in the "main" code that sparks off execution
<mflux_> do you see ;;'s being used?
<haakonn> but ok, i can see the analogy to ignore
<haakonn> don't think so (don't have an example before me right now)
<mflux_> well
<mflux_> if ;;'s aren't used then plain foo isn't legal
<haakonn> but right now, the technique helps me (i get a syntax error without it), i'll have to think why :)
<mflux_> I think an evaluation unit is either let-statements or a single function application
<haakonn> ah, i see, i can ditch the let _ if i put ;; before the code
<haakonn> good point
<mflux_> I prefer not using ;;'s (because they don't need to be used), but I guess that's mostly a matter of taste
<haakonn> i've always found them rather ugly
<haakonn> but i've always used them, apparently in ignorance :)
<mflux_> there was this one website that tried to 'explain' the rules for when to use ;;'s, and that was not neat at all ;)
<haakonn> i think i read an attempt at that in the "ocaml for java programmers" tutorial once upon a time
<mflux_> anyway, I can't think of a single case where one would need to use ;;
<haakonn> that's good
<haakonn> there, cleansed my code of them. except ocaml{lex,yacc} insists on generating code with ;;
<haakonn> another matter of style: do people generally prefer to use begin .. end or ( .. )? i seem to use both :)
<pango> on the other hand the use of ;; may prevent error messages propagation
<haakonn> oh
<pango> if you forget to close some construct, error will be flagged at next ;; that's not at toplevel
<pango> so even if they're not mandatory, they can be useful
<mflux_> I guess you notice those quite fast anyway, if you have an autoindenting editor such as emacs
<haakonn> interesting
<mflux_> and I've found it most such problems to be tagged already at the next top-level let, as they don't have 'in'
<mflux_> (in some cases)
vodka-goo has joined #ocaml
<pango> haakonn: talking about programming style, you may find http://pauillac.inria.fr/caml/FAQ/pgl-eng.html interesting (is it the last version ?)
<haakonn> excellent, thanks
vodka-goo has quit []
Submarine has joined #ocaml
gim has joined #ocaml
_shawn has quit [Read error: 110 (Connection timed out)]
_shawn has joined #ocaml
calvin__ is now known as calvin_
vodka-goo has joined #ocaml
vodka-goo has quit [Client Quit]
vodka-goo has joined #ocaml
Snark has quit [Read error: 104 (Connection reset by peer)]
vodka-goo has quit []
Snark has joined #ocaml
Godeke has quit ["Leaving"]
vezenchio has joined #ocaml
__DL__ has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
sieni_ has joined #ocaml
sieni has quit [Read error: 145 (Connection timed out)]
sieni_ is now known as sieni
cmeme has quit [Remote closed the connection]
cmeme has joined #ocaml
cmeme has quit [Remote closed the connection]
cmeme has joined #ocaml
mrvn_ has joined #ocaml
_JusSx_ has joined #ocaml
mrvn has quit [Read error: 110 (Connection timed out)]
_Cougar has joined #ocaml
<_Cougar> Hi all, I'm just a newby with ocaml... I wan't to do some debug on mldonkey which is mainly coded with ocaml, When I run the binary (elf format) with the debugger, it says me that my binary is not an bytecode file... Is there a way not to compile ocaml code to enable debugging ?? am I missing something ? thanks...
<mflux_> you propably want to use gdb
<mflux_> for debugging native binaries
<mflux_> otherwise you want to compile a bytecode binary, after which you can use ocamldebug
<mflux_> I don't know how to instruct mldonkey to do tha latter though
<mflux_> but with the gdb-way you also need to instruct the compiler to compile debug information in
<mflux_> that can be done with the -g -switch, IIRC
<_Cougar> mflux_: thanks, I already put the -g switch... I didn't know gdb was able to interpret these symbols... I try it right now...
stef__ has joined #ocaml
stef__ has quit [Remote closed the connection]
stef__ has joined #ocaml
stef__ has quit [Read error: 104 (Connection reset by peer)]
joeytwiddle has joined #ocaml
joeytwiddle has quit [Read error: 104 (Connection reset by peer)]
joeytwiddle has joined #ocaml
joeytwiddle has quit [Read error: 104 (Connection reset by peer)]
Msandin has joined #ocaml
Msandin has quit [Client Quit]
Msandin has joined #ocaml
Submarine has quit ["Leaving"]
araujo has quit ["Programs must be written for people to read, and only incidentally for machines to execute"]
__DL__ has quit ["Bye Bye"]
Msandin has quit [Read error: 110 (Connection timed out)]
_Cougar has quit [Remote closed the connection]
Snark has quit ["Leaving"]
mrvn has joined #ocaml
mrvn_ has quit [Read error: 110 (Connection timed out)]
menace has joined #ocaml
rox has joined #ocaml
<rox> hello everybody
<rox> i have played with ocaml a few years ago, but now i want to learn it well. I am fluent in most common imperative languages, which seems to be a handicap for me ... any tips on where i should start learning?
<rox> ... apart from using documentation on the official website?
<menace> tried the books in the channel topic? :)
<rox> menace: which one would you recommend?
<rox> menace: like i said, i need to shift my imperative mindframe ... and this seems rather hard
<menace> shifting is done by doing :-)
<rox> menace: that's what i'm up to and that's why i'm asking you these things ... can you please recommend one of these books, or should i just pick one and go with it?
<menace> well, i would just pick one
<rox> ok, i assume i need some skills prior to starting to use the cookbook ... mening i have only one choice
<rox> menace: thank you ;)
<menace> np :-)
<menace> although, i didn't do anything in reality *g*
<rox> menace: helped me find a place to start .. that was what i came here for ;)
<menace> hehe
<rox> menace: are you fluent in ocaml?
<menace> i was, i want to code it, when studying time is over ^
<menace> ^
<rox> well ... if i program at home, i usually program to relax
<rox> ... i program during study breaks and such
<menace> i code for university/studies, i code for my job. when i'm at home, nowadays, i often just want to spend time with my girlfriend *g*
bk_ has joined #ocaml
<rox> well, i code for uni and job too ..
monochrom has joined #ocaml
menace has quit ["Verlassend"]
tre| has joined #ocaml
_JusSx_ has quit ["leaving"]
<rox> i'm having trouble understanding chapter 1.2, paragraph 3 ... could somebody please help me figure it out?
* rox will stich around in case anybody has the time/will to explain the stuff
<gim> first sentence ?
araujo has joined #ocaml
<gim> rox: it just says, that the "let x1 = a1;;" syntax is useful in practice (especially when using the toplevel), but not really needed to express the full programming capacity of ocaml since it can be replaced by "let x1 = a1 in ..." constructions
<rox> hmm, but what is the benefot of it ..
<rox> lacking any background in functional languages, i can't understand the meaning if the "in" keyword
<gim> let x1 =
<gim> oops
<rox> let x1 = a1 in let x2 = a2 in a <-- this is the example on the page ... if i understand correctly, those are three separate evaluations
<monochrom> { const int x=1; printf("%d", x); } is let x=1 in print_int x
<gim> "let x = 2 in x * x" for example evaluates to 4
<rox> monochrom: ok, i get that
<rox> but what about the in thing?
<monochrom> syntax
<rox> gim: meaning that you assing a value to something, but that value only applies in the expression that follows in?
<monochrom> Yes.
<rox> some sort of local variable then?
<gim> and in " .. (let x = c in a) .. ", x isn't defined anywhere execpt in the "a" term
<gim> yep
<rox> ok, now i get it ...
<monochrom> local constant (x is immutable), single-assignment statement.
<monochrom> "in" is just punctuation.
<monochrom> "let" is punctuation too.
mlh_ has joined #ocaml
<rox> so ... let x1 = a1;; let x2 = a2;; is realy different from let x1 = x1 in let x2 = a2;;
<rox> different in scope of x1
<monochrom> I am not sure about "really".
zeeeee has joined #ocaml
zeeeee has left #ocaml []
<rox> the page says that we can substitute former with later, but they are realy semantically different
<rox> or aren't they?
<monochrom> Semantically the same, syntactically different.
<rox> hmm ... ok, if we give those some context, they are also semantically different
<rox> like .. in one case you can use x1 again, while in the other you can't
<monochrom> maybe
<monochrom> I wouldn't worry about it.
<pango> they're "equivalent enough" for the purpose of the demonstration that follows
<rox> ok, i get it
<rox> thank you for clarification, guys
* rox reads on
<monochrom> In a compiled program I always write like let x1 = a1 in let x2 = a2 in a
<gim> "a" in a environment "let x1 = a1;; let x2 = a2;;" is semantically equivalent to "let x1 = x1 in let x2 = a2" in a empty environment
<gim> +"in a"
<rox> gim: ok, i get it, thank you ....
<rox> so the whole purpose of in is scoping?
<rox> or is there another purpose?
<gim> "in" always come with a "let", and the purpose of "let x = c in a" indeed is scoping
<gim> it's almost the same as "(fun x -> a) c"
<gim> but different when considering polymorphism later...
<gim> and a lot easier to write :)
<gim> and to read
<rox> ok ... so fun lets you declare something like an anonymous inner function, right?
<monochrom> "if ... then ... else ..." "then" and "else" really just act as delimiters or scoping. they have no real meaning or noble purpose.
<monochrom> "let ... in ..." same deal with "in"
<rox> or any function for that matter ...
<monochrom> anonymous inner function, yes, it's very cool
<rox> monochrom: ok, i get the ion thing now
<rox> monochrom: coming from the imperative world, stuff like anonymous inner functions is kinda advanced, but here it seems to be very basic
<monochrom> Yes!
<gim> yes function are first order data structures in functionnal programing languages
<monochrom> Also user-defined data types of the form type name = Name of string | Int of int
<gim> they are values like numbers, strings or lists
<rox> monochrom: that souds like a union
<monochrom> user-defined data types appear early on in a functional programming book.
<rox> s/souds/sounds/
<monochrom> they appear in the middle or the end in an imperative programming book.
<monochrom> As a result by chapter 3 in an FP book you're already on to binary search trees, whereas in an IP book it's like chapter 10.
<monochrom> Yes it's a union.
<gim> rox: not exactly as a union in C but like a (disjoint) union in maths
<rox> gim: well ... i ment realy a semi-variant type
<rox> gim: limited variant type
<monochrom> union, tagged union, variant, you can name it as you wish.
<rox> monochrom: i'll probably get back to this channel once i get to that
<monochrom> My point is that an IP book (e.g. K&R) gets bogged down too much in telling you how it is laid out in memory etc. (nice to know, but should go to a "computer organization" course) so you get bogged down too. it is considered an "advanced" topic.
<rox> i think it is very good to know the internals of programs ... but it is not allways helpful and most certainly it's not always useful
<monochrom> An FP book (and an FP language) just tells you how to use it, what you can use it for, so you get going early on and get things done. It's very easy to use with the right syntax and the right explanation.
<monochrom> Yes absolutely, you must be aware of the internals, but you learn that from a separate course.
<rox> the thing is, that the explainations are not very clear to me most of the time ... which is sorta understandable, since they come from a functional mindframe ...
<gim> "must be aware of the internals" only if you consider performances... not if you only care about the result
<monochrom> well, for the sake of a complete, well-rounded education.
<gim> (sometimes it's better to care about it if you wanna get a result some day of course...)
<rox> gim: well, considering the imperative nature of the machine, knowledge of internals gives you a lot of power
<gim> well also if you want to do a functionnal compiler one day :)
<gim> actualy, I don't even know how a list is represented in internals...
<gim> (haven't done enough bindings with C yet...)
<rox> i think it would be more fun to create a functional machine one day .. then functional programming would get to fully develop its power
<dan2> functional programming is so much more powerful than OO its amazing why we still use OO
<monochrom> In a parallel universe, Motorola 680x0 is the popular CPU and it is a G-machine. :D
<rox> dan2: oo is useless except for GUIs ... trust me, i work on a retarded semi-oo c++ priject at work, i know
<gim> dan2: you mean using modules instead of objects ?
<dan2> rox: I developed j2ee voip applications
<dan2> s/developed/develop/
<monochrom> There, the IP people get ridiculed because "it is inefficient to emulate mutable state on a G-machine"
<dan2> rox: I have a much closer understanding of OO
<rox> dan2: i have done other oo things too, but this project i'm working on realy revealed all the weaknesses of oo and expecially retarded c++ implementation of oo
<monochrom> The IP people fight back by saying "yeah but an imperative program is a *relation* which is more abstract and general than functions!"
<rox> monochrom: there is a place and use for IP
<monochrom> Oh yea, those IP guys in the parallel universe say that all the time. :)
<pango> rox: google for 'lisp machines'
vincenz has joined #ocaml