cjeris changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/
b00t has joined #ocaml
jlouis_ has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
joshcryer has joined #ocaml
murky has joined #ocaml
murky is now known as murky_sea
Smerdyakov has quit ["Leaving"]
johnnowak has joined #ocaml
<murky_sea> johnnowak: Hey, you just joined half the channels I'm in. :-)
murky_sea has quit []
Z4rd0Z has quit []
johnnowak has quit []
benny has joined #ocaml
benny_ has quit [Read error: 110 (Connection timed out)]
Mr_Awesome has quit ["...and the Awesome level drops"]
svenl has joined #ocaml
smimou has joined #ocaml
_JusSx_ has joined #ocaml
vital304 has quit ["Leaving."]
_JusSx__ has joined #ocaml
_JusSx___ has joined #ocaml
_JusSx_ has quit [Read error: 110 (Connection timed out)]
b00t has quit [Remote closed the connection]
_JusSx__ has quit [Read error: 110 (Connection timed out)]
bluestorm_ has joined #ocaml
love-pingoo has joined #ocaml
Foxyloxy has joined #ocaml
slipstream-- has joined #ocaml
slipstream has quit [Read error: 110 (Connection timed out)]
bluestorm_ has quit ["Konversation terminated!"]
_JusSx_ has joined #ocaml
<vorago> Is here anyone who speaks Polish?;-)
<vorago> I'm writting tiny O'Caml introduction in this language and I'm sure there are many things somebody would correct.
_JusSx___ has quit [Read error: 110 (Connection timed out)]
a-priori_ has joined #ocaml
a-priori has quit [Read error: 110 (Connection timed out)]
Z4rd0Z has joined #ocaml
SooW has joined #ocaml
<SooW> hi
<SooW> i'm wondering if there anyway to call a caml methid from a c function
<SooW> i mean, i know how to call caml function, but for methods, i can't find any help
<SooW> well, maybe it's a bit stupid...
<SooW> as c couldn't understand what a "method" is...
<SooW> sorry for bothering you
SooW has quit ["Quitte"]
bluestorm_ has joined #ocaml
falseep has joined #ocaml
bluestorm_ has quit ["Konversation terminated!"]
cjeris has joined #ocaml
falseep has quit [Read error: 104 (Connection reset by peer)]
swater has joined #ocaml
bluestorm_ has joined #ocaml
jacobian has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
Smerdyakov has joined #ocaml
nuncanada has joined #ocaml
postalchris has joined #ocaml
jdev has quit [Read error: 104 (Connection reset by peer)]
Mr_Awesome has joined #ocaml
<tsuyoshi> it says in the manual.. there's a sort of hash lookup you have to do for the method
<mrvn> tsuyoshi: manual 18.3.5: callback(caml_get_public_method(foo, hash_variant("bar")), foo); in case he comes back
sioraiocht has joined #ocaml
sioraiocht has left #ocaml []
vital303 has left #ocaml []
pango has quit [Remote closed the connection]
pango has joined #ocaml
bluestorm_ has quit ["Konversation terminated!"]
ulfdoz_ has quit [Remote closed the connection]
ulfdoz has joined #ocaml
bluestorm_ has joined #ocaml
swater has quit [Remote closed the connection]
<vorago> http://bla.thera.be/ocaml password:ocaml
<vorago> It's my "OCaml Introduction" written in Polish, I'd like somebody to check it somehow.. ;-)
<vorago> Maybe just see the code samples and tell me if there aren't better ways to do things...
<vorago> You know what I mean.
<bluestorm_> hum
<bluestorm_> about your fib version
jlouis_ has quit [Remote closed the connection]
<bluestorm_> i personaly prefer to code the short, trivial cases (n <= 1) first, and the complex case after it
<mrvn> vorago: You should translate http://caml.inria.fr/pub/docs/manual-ocaml/index.html
<bluestorm_> because if your trivial case is in the "else", it may be too far from the original condition, and thus be forgotten
<bluestorm_> furthermore, introducing recursivity with fib is a strange idea
<bluestorm_> because this naive fibonacci implementation is terrible
<bluestorm_> why not use factorial instead ?
<mrvn> And don't use let rec foo x = if x ...
<mrvn> let rec fix = function 0 -> 0 | 1 -> 1 | x -> fix (x - 1) + fib (x - 2)
<bluestorm_> hm mrvn, maybe he didn't want to teach pattern matching at this point
<mrvn> That mirrors the mathematical definition used for fib.
<bluestorm_> if (n <= 1) is reasonably clear
<bluestorm_> (and it handles the "negative n" case :-°)
<mrvn> Maybe. I can't read the text, just code.
<bluestorm_> so do i ^^
Z4rd0Z has quit []
johnnowak has joined #ocaml
<mrvn> I would have expected an example of let rec fac x = if x <= 1 then 1 else x * fac (x-1)
jlouis has joined #ocaml
<bluestorm_> hm
<bluestorm_> let func a = a, "tekst";;
<bluestorm_> maybe you should use (a, "tekst") first time
<mrvn> bluestorm_: as example for recursion
<bluestorm_> they may find it easier to read
<bluestorm_> mrvn: i agree, fac seems a better example than fib
<mrvn> Ahh, I agree with bluestorm_. Write tuples as (a, b). I still always do that for better readability.
<mrvn> And add an example of fold_left
<bluestorm_> i personally use "let a, b = ..." instead of "let (a, b) = ..."
<mrvn> bluestorm_: too confusing to people used to int a, b = 1, c, d = 5;
<bluestorm_> hm
<mrvn> And I'm totaly missing type list = NIL | CONS of int * list
<mrvn> followed by how you implement map and fold_left and then 'a list
<bluestorm_> i agree
<bluestorm_> assuming you're speaking to a general audience, i think the "functional programming" point of view should be emphasized
<mrvn> And let a = fun(ction), match x with ...
<bluestorm_> by introducing pattern matching sooner in the document, and doing more recursive things
david_koontz has joined #ocaml
<bluestorm_> (working on list with map and fold_* are good brainwork for that)
<mrvn> exactly.
<mrvn> A good example for fold_left could be: # List.fold_left (+) 0 [1;2;3];;
<bluestorm_> hm mrvn, but with this example, how will you explain the difference with fold_right ?
<mrvn> Start off with List.fold_left (fun x acc -> x + acc) 0 [1;2;3] and then this shorter version
<mrvn> bluestorm_: that you only see if you implement the two and explain tail recusion
<bluestorm_> maybe there are easy applications where fold_right and fold_left give really different results
<bluestorm_> hm
<mrvn> That can be hard to understand and I would do that later. Beginers don't tend to have such big examles that fold_right fails.
<vorago> bluestorm_, i've got it.
<bluestorm_> yes, tail recursion isn't easy for a recursion beginner
<vorago> mrvn, I was thinking of introducting matching later (it's in the last chapter, bot in written yet)
<mrvn> I think matching is one of the major features for ocaml. The alternatives type makes it so powerfull.
<vorago> I'll add factorial example.
<vorago> It's good idea.
<vorago> Probably next to fib, and then add some description after example.
<mrvn> For fib you could show how one can transform the code to be tail recursive.
<vorago> Ok, I'll add () around tuples with a comment where it can be omitted.
<vorago> Hm..
<bluestorm_> vorago:
<bluestorm_> about fib
<bluestorm_> it may be interesting to show a better implementation
<mrvn> let fib x = let rec loop acc prev y = if y >= x then acc else loop (acc+prev) acc (y+1) in loop 1 1 1
<mrvn> Shw how you write a function by first writing a helper and then call that.
<vorago> As for type list = NIL | CONS of int * list I wanted to introduce variants in prelast chapter. Maybe it's wiser to do this earlier.
<mrvn> vorago: It is the 4th thing the official manual teaches you.
<vorago> I've got introduction a bit expanded. It goes like this: meeting with ocaml, how types are inferred, functions and general use of "let", tuples and arrays, records and references, how iterations are done, bigger ocaml example and variants.
<vorago> I'll copy this talk somewhere and use it to slighthly rewrite this.
<mrvn> functions as values/parameter/arguments is missing
<bluestorm_> you could explain curryfication too
<bluestorm_> let add = fun a -> fun b -> a + b;;
<mrvn> People not familiar with functional languages won't know that you can just pass around fucntions like you would ints in C.
<vorago> There's a comment for that, but I see no example.
<mrvn> let inc = add 1
<bluestorm_> vorago: it's useful to understand partial application
<bluestorm_> hm
<bluestorm_> or
<bluestorm_> List.map (( + ) 2) [1; 2; 3];;
<mrvn> and oppsoe that to let inc x = add 1 x
<vorago> There's a "addfive" example.
<vorago> let add a b = a+b;;
<vorago> let addfive = add 5;;
<mrvn> And do you have code that plays tic-tac-toe yet?
<vorago> With quite big comment.
<mrvn> Which reminds me. I always wanted to rewrite my self learning tic-tac-toe programm in ocaml.
<vorago> Hm. (-;
<vorago> I will move variants higher.
<vorago> It's good idea.
<vorago> Generally - I've got lot's of thing to do after this talk. Thanks.
<vorago> It'd cool if I found somebody who speaks polish and knows OCaml. The problem is - there're few of us.
<mrvn> You can make good examples with let color = GREEN | YELLOW | BLACK (simple enum), then add FOO of x, then lists, trees and such.
<mrvn> Do you have a chapter on the module system and on classes?
<vorago> I guess I be correcting this text forever. Wouldn't you split this text into two subpages?
<vorago> I want to write about OO code in OCaml, and module system, but not yet.
<mrvn> Good look and have fun.
<vorago> I'll at least write that there's sth like this with link too some more documentation.
nuncanada has quit ["Leaving"]
<mrvn> and don't forget exceptions
<vorago> There's a single exception in the last/bigger example.
<vorago> With comment that it uses matching to handle them...
<vorago> I need to place this matching+variants earlier.
<vorago> Okay; Thanks mrvn and thanks bluestorm_.
<vorago> Cya.
mbishop has quit ["Leaving"]
bluestorm_ has quit ["Konversation terminated!"]
fezsentido has joined #ocaml
fezsentido has quit [Read error: 104 (Connection reset by peer)]
nuncanada has joined #ocaml
_JusSx_ has quit ["leaving"]
smimou has quit ["bli"]
cjeris has quit [Read error: 104 (Connection reset by peer)]
JeffSmac has joined #ocaml
<JeffSmac> hello. is anyone here proficient with labltk programming?
pants1 has joined #ocaml
postalchris has quit ["Leaving."]
JeffSmac has quit []
love-pingoo has quit ["Connection reset by pear"]
love-pingoo has joined #ocaml