smkl changed the topic of #ocaml to: OCaml 3.07 ! -- Archive of Caml Weekly News: http://pauillac.inria.fr/~aschmitt/cwn, 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
Nutssh has quit ["Client exiting"]
__DL__ has quit ["Bye Bye"]
shawn has quit [Read error: 104 (Connection reset by peer)]
shawn has joined #ocaml
d2004xx has left #ocaml []
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"]
Demitar has quit [Read error: 110 (Connection timed out)]
whiskas has joined #ocaml
Etaoin has joined #ocaml
`John has quit ["ChatZilla 0.9.35 [Mozilla rv:1.5/20031007]"]
daemon has joined #ocaml
whiskas has quit [Read error: 54 (Connection reset by peer)]
daemon is now known as whiskas
Nutssh has joined #ocaml
cjohnson has quit ["Drawn beyond the lines of reason"]
cjohnson has joined #ocaml
cjohnson has quit [Client Quit]
cjohnson has joined #ocaml
whiskas has quit [Read error: 54 (Connection reset by peer)]
whiskas has joined #ocaml
<blueshoe> "lisp has horrible syntax" <- how many times have you heard that one?
<blueshoe> oops
<Nutssh> I couple of times. I've said it once or twice. Its not too bad most of the time, but I want my infix operators for formulas.
<whiskas> blueshoe: I was just reading an article defying that.
<whiskas> At least, O'Caml code aesthetically looks better :-P
<Nutssh> You should look at my code.. :(
<teratorn> but ocaml isn't lisp
<whiskas> How said it was?
<teratorn> lisp's syntax makes perfect sense for what it is
<whiskas> s/how/Who
Kinners has joined #ocaml
cjohnson is now known as cj|sleep
blueshoe has quit [Read error: 104 (Connection reset by peer)]
thelema has joined #ocaml
housetier has quit [Nick collision from services.]
housetier has joined #ocaml
thelema has quit ["good night"]
blueshoe has joined #ocaml
<blueshoe> oh yeah, i like programming
<blueshoe> grr
<blueshoe> must pay more attention to which window i'm typing in
<blueshoe> looks like the humps have a new look
<blueshoe> it's pretty nice
daemon has joined #ocaml
daemon has quit [Read error: 104 (Connection reset by peer)]
whiskas has quit [Read error: 104 (Connection reset by peer)]
whiskas has joined #ocaml
Nutssh has left #ocaml []
ott has joined #ocaml
<ott> re all
mimosa has joined #ocaml
mimosa has quit [Client Quit]
mimosa has joined #ocaml
Kinners has left #ocaml []
Swynndla has joined #ocaml
ayrnieu has quit ["Changing server"]
ayrnieu has joined #ocaml
ayrnieu has quit [Client Quit]
ayrnieu has joined #ocaml
Swynndla has quit [Read error: 60 (Operation timed out)]
Swynndla has joined #ocaml
blueshoe has quit [Read error: 54 (Connection reset by peer)]
blueshoe has joined #ocaml
<blueshoe> damn, i hate this...
<blueshoe> i get most awake and most inspired to actually program when it gets really late at night
<blueshoe> and if i indulge then get in late to work... and then won't feel like doing anything until very late again
<housetier> I feel ya
Swynndla has quit [Remote closed the connection]
Swynndla has joined #ocaml
__DL__ has joined #ocaml
karryall has joined #ocaml
whiskas has quit ["Leaving"]
Swynndla has quit ["Leaving"]
yangsx has joined #ocaml
det has quit ["Everyone hates me because I'm paranoid."]
whiskas has joined #ocaml
yangsx has quit ["离开"]
<whiskas> Hello.
<housetier> moin
<whiskas> What's up?
<whiskas> Hey, you know of any articles on O'Caml in real world? I've been googling for a while, but nothing interesting came up.
<ayrnieu> how do you define 'real world'?
<whiskas> Umm, dunno, every-day projects?
det has joined #ocaml
<blueshoe> and the humps
<whiskas> Thank you, much obliged.
<whiskas> Humps?
<ayrnieu> indeed, and #mldonkey on this network.
<karryall> the caml's hump
<whiskas> Aha.
<whiskas> Thank you again.
<blueshoe> enjoy :)
<whiskas> :-)
<whiskas> Hmm, so it is true that O'Caml can't be fast that C? (I'm not trying to start a war, just gather some facts)
<blueshoe> heh
<blueshoe> ocaml can be faster than c
<blueshoe> sometimes as fast as, and sometimes a bit slower than c
<whiskas> That like don't work.
<blueshoe> try the archive.org version
<blueshoe> or google's cache
<whiskas> Aah, right.
<whiskas> Hmm. Why do most people build interpreters or stuff in (Oca)ML?
<whiskas> Or am I getting it wrong?
<blueshoe> because it's easy to manage complex data structures in ocaml
<blueshoe> or so i'm told :)
<whiskas> Eeh..
<whiskas> Mate, you're a doll :-P
<blueshoe> :)
wazze has joined #ocaml
<whiskas> Hmm, dunno if I asked this before, but is there a OCaml coding style?
<whiskas> blueshoe: Do you love me, or what? :-P
<blueshoe> ocaml is my true love ;)
<whiskas> Aha, I see :-)
<blueshoe> there's also this: http://caml.inria.fr/FAQ/pgl-eng.html
<blueshoe> probably more official
<whiskas> He he, OCaml code looks so neat and geeky :-P
<blueshoe> ya
<blueshoe> ocaml looked kind of weird to me when i first saw it
<blueshoe> but now it kind of looks like c to me
<blueshoe> at least compared to stuff like lisp or assembly, which are really different looking
<whiskas> Hmm, I haven't done Lisp. By the way, is Lisp FP or some other weird breed?
<blueshoe> i'll defer to someone who actually knows lisp, but i've heard it's a hybrid, and that scheme is the lisp variant that's most functional
<blueshoe> #lisp might be a good place to ask, too
<whiskas> Hmm, I'd better get things straight with OCaml, then jump to Lisp, but I think that's going to take quite some time.
<blueshoe> learning the basics of the actual language should be relatively easy... it's getting your mind around the functional paradigm that might be challenging if you're new to it
<whiskas> Yeah, so it seems. And those OO things...
<blueshoe> yeah, i still haven't learned the oo part of ocaml
<blueshoe> i hear it's usually not necessary
<whiskas> Ooh?
<whiskas> How come?
<whiskas> OO is nice, most of the time.
<blueshoe> because ocaml's module system does all the stuff oo is used for
<blueshoe> or most of it, anyway
<whiskas> Hmm... I think we shall live and we shall leanr.
<whiskas> *learn.
<whiskas> Hmm, Jethro Tull's first album kinda sucks...
<blueshoe> which one was that?
<whiskas> This Was - A
<blueshoe> don't think i heard that one
<whiskas> I love Songs from the Wood.
<blueshoe> yeah, me too
<whiskas> Guess I'm gonna do some backtracking in OCaml.
<whiskas> Prolly the queens problem.
<whiskas> That's a classic.
<whiskas> Hmm, Stand Up sound blusier.
<whiskas> Wow, this is so cool: http://caml.inria.fr/oreilly-book/html/
<whiskas> (But I think you know of it)
<blueshoe> yeah
<whiskas> Any good?
<karryall> whiskas: excellent book
<blueshoe> i like cousineau and mauny's Functional Approach to Programming better
<blueshoe> but you have to pay for that
<whiskas> blueshoe: Is that online?
<blueshoe> no
<blueshoe> it's a real book
<whiskas> karryall: Cool :-)
<whiskas> This one's a real book, too :-P
<whiskas> Hmm, they say that OCaml is a distant descendant of Lips?
<whiskas> *Lisp, even.
<blueshoe> and Elements of ML Programming by ullman is even better, imo, at least for beginners... but it teaches ml, not ocaml (though translating from one language to the other is very easy, since they're virtually the same)
<karryall> whiskas: the very first caml environment were implemented in a lisp dialect
<blueshoe> yeah, i've heard ml referred to as "a statically typed lisp"
<blueshoe> without all the parenthesis, i guess
<whiskas> :-))
<blueshoe> it's one of the better online tutorials, iirc
<whiskas> Cool.
<whiskas> I love you, guys :-)
<blueshoe> :)
<blueshoe> and then there's this -> http://www.merjis.com/richj/computers/ocaml/tutorial/
<blueshoe> but i haven't read it
<whiskas> blueshoe: I did.
<blueshoe> how is it?
<whiskas> Pretty good, I learnt pretty much I know (which ain't much) from it.
<blueshoe> did it have some exercises for you to do?
<karryall> about the merjis tutorial ... it's pretty much on the imperative side
<blueshoe> ahh
<whiskas> Yeah, it's called something like OCaml for Java, Perl and C++ programmers.
<blueshoe> should be a gentle introduction to ocaml, then
<whiskas> Yes, it is.
<blueshoe> now try to understand the y combinator! :)
<blueshoe> actually, i don't understand it myself... anyway, i didn't when i last looked at it a year ago
<whiskas> Y combinator?
<blueshoe> but i'm an ocaml beginner myself
<blueshoe> it's some functional programming thingy
<blueshoe> i'm sure someone here could explain it better than i
<whiskas> Neah, I think I'll skip that 'till later.
<blueshoe> "The point of Y is to provide a mechanism to write self-referential programs without a special built-in means of accomplising it."
<whiskas> Bleah, I'm already lost.
<blueshoe> me too
<blueshoe> "Y is a function that takes a funciton that could be viewed as describing a recursive or self-referential function, and returns another function that implements that recursive function"
<blueshoe> hehe
<whiskas> What the heck? I hate Maths.
<blueshoe> sorry, don't mean to scare you
<blueshoe> you will have to conquer recursion, though, if you want to learn functional programming
<whiskas> Well, I don't actually hate it...
<whiskas> That's pretty easy.
<blueshoe> that's why i recommend the cousineau and mauny or ullman, as they're really good at explaining that... they go in to much more detail than any of the online books/tutorials, from my experience
<blueshoe> oh, recursion is easy?
<whiskas> Dunno if I'd find it here...
<blueshoe> then you're half way there
<whiskas> Heh...
Demitar has joined #ocaml
Herrchen has joined #ocaml
whiskas is now known as whiskas|off
mattam_ has joined #ocaml
mattam has quit [Nick collision from services.]
mattam_ is now known as mattam
whiskas|off is now known as whiskas
<whiskas> Duh, nobody told me there was an operator for concatenating lists!
<whiskas> Well, a reversing functions now comes so easy to mind.
<__DL__> a reversing funtions using the concatenation of list ? this seem to be the classical error. Well it work, but it so slow...
<whiskas> Hmm, I've done it another way around, too...
<Maddas> karryall: I really didn't like that online book much
* Maddas reads about Y
<karryall> the o'reilly one ?
<Maddas> karryall: yeah
<karryall> what's great about it is that is explains things like the garbage collector
<Maddas> I don't say it's bad, I just found many little quirks that annoyed me :-)
<Maddas> like code being used that wasn't defined anywhere
<karryall> how it works, etc. This isn't covered by the ocaml documentation
<Maddas> or the broken HTML in the practices/solutions part, and that the PDF doesn't have any TOC :-(
<Maddas> karryall: I see
<karryall> ah, well i didn't look at the code closely
<karryall> and yes the HTML is utterly broken
<karryall> it has also some higher-level thoughts about object vs modules
<karryall> again, you don't have this in the reference manual
<Maddas> I like that it isn't pure advocacy and doesn't claim O'Caml to be the best/fastest/whatever language in the world
<Maddas> And that it also mentions other languages without making them bad :-)
<Maddas> making them look bad, that is
<whiskas> Yay, I'm so cool :-P
<Maddas> whiskas: ceraitnly :)
<Maddas> er, certainly.
<whiskas> Hmm, is it hard to implement language parsers/analyzers in O'Caml?
<karryall> depends on the language you want to parse
<karryall> there is a Genlex module that gives you a simple lexer with the same lexing rules as caml
<whiskas> What about XML?
<karryall> then you can use camlp4 streams
<whiskas> Say I have some EBNF specs, and I want to build a parser out of that.
<karryall> there are XMl parsers in ocaml
<whiskas> Ooh?
<Maddas> PXP, expat wrappers
<whiskas> Validating, and stuff?
<whiskas> And what about native ones?
<karryall> yes, PXP is validating
<karryall> native ?
<whiskas> Like 100% O'Caml.
<karryall> PXP is 100% ocaml I think
<whiskas> Nice, I'll ckeck it out.
karryall has quit ["gottago"]
gim_ has joined #ocaml
mimosa has quit ["J'ai fini"]
mimosa has joined #ocaml
buggs has joined #ocaml
whiskas has quit ["Leaving"]
yangsx has joined #ocaml
yangsx has left #ocaml []
blueshoe has quit [Read error: 54 (Connection reset by peer)]
owll has joined #ocaml
stepcut has quit [Read error: 60 (Operation timed out)]
ott has quit ["changing servers"]
buggs has quit ["maybe it crashed"]
owll has left #ocaml []
blueshoe has joined #ocaml
blueshoe has quit [Read error: 104 (Connection reset by peer)]
Nomme has joined #ocaml
<Nomme> hi
<Nomme> functors hate me
<__DL__> no, they have no contience, they don't hate anybody, they just are...
<__DL__> (I mean Consciousness not this not existing word I wrote)
<Nomme> ;)
<Nomme> can someone explain me how to use "Set.Make" with a concrete example ?
<__DL__> module StringSet = Set.Make(struct type t = string let compare = compare end);;
<__DL__> or better, module StringSet=Set.Make(String) but this one is less obvious.
blueshoe has joined #ocaml
Demitar has quit [Read error: 54 (Connection reset by peer)]
Demitar has joined #ocaml
Nutssh has joined #ocaml
whiskas has joined #ocaml
<whiskas> Howdy.
<Nomme> oud oud
<Nutssh> Hi.
<whiskas> :-)
Herrchen has left #ocaml []
ayrnieu has quit [Remote closed the connection]
malc has joined #ocaml
Nutssh has quit ["Client exiting"]
mellum has joined #ocaml
<mellum> hi
<whiskas> Hello.
wazze has quit ["Learning about how the end letters on French words are just becoming more and more silent, I conclude that one day the French"]
malc has quit [brunner.freenode.net irc.freenode.net]
gim_ has quit [Read error: 104 (Connection reset by peer)]
gim_ has joined #ocaml
malc has joined #ocaml
<whiskas> Hmm, I don't get this expression:
<whiskas> let llnil = ([] : 'a list list);;
<whiskas> Why the second list?
<whiskas> Aah, wait, it's a list of lists of 'a.
<whiskas> Right?
<Maddas> Yes
malc has quit [Read error: 113 (No route to host)]
<whiskas> Good.
<Nomme> :)
<whiskas> I think I'
<whiskas> I'm getting good at this. =)
<whiskas> Does this poses any sense to you?
<whiskas> let add_general (x: 'a) (y: 'b) = add a b;;
<whiskas> Make that, add x y.
<Maddas> Does add take two parameters of the types 'a and 'b?
<whiskas> Hmm, supposedly, yes.
<Maddas> Why don't you just say this instead? let add_general = add
<whiskas> Well, it's not my code, it's taken from a book.
<whiskas> And anyway, what's the use of defining add_general, since add does the exact same thing?
<Maddas> No idea :-)
<Maddas> Maybe he has some intention to change add_general later on
<Maddas> (the author)
<Maddas> Or maybe I'm just overlooking something
<whiskas> Well, ok, thank you anyway.
<whiskas> Hmm, I have to create a function that returns the multiply table of some integer passed as an argument.
<Maddas> Good luck!
<Maddas> :-)
<whiskas> Thank you. I have found a way but it doesn't look that elegant...
<Maddas> Heh, you can't expect to write elegant functions right away
<Maddas> But feel free to paste it if it's small
<whiskas> :-)
<whiskas> Hmm, ok.
<Maddas> whiskas: Return it as a list or as an array?
<whiskas> Umm, list.
<whiskas> What about this?
<whiskas> let multab x = let rec multab2 x i = if i > 9 then [] else (x * i) :: multab2 x (i + 1) in multab2 x 1;;
<whiskas> It works as expected...
<whiskas> But it seems that I'm thinking a little bit imperative.
* Maddas reformats and looks at ti
<Maddas> it, even
<Riastradh> No, that's not at all imperative.
<whiskas> So would be a nicer way to do this?
<whiskas> Would it be, even.
<Riastradh> You could abstract the functionality of it using unfold.
<whiskas> Ooh?
<Riastradh> That is, assuming OCaml provided unfold in its List module. Bleh.
<whiskas> You lost me.
<Maddas> whiskas: Beware, Riastradh can easily twist your brain :-)
<Riastradh> unfold abstracts list construction.
<whiskas> I know (almost) nothing about the standard library, so far.
<Riastradh> unfold : ('a -> ('a * 'b) option) -> 'a -> 'b list
<Riastradh> Does that type make sense to you, first of all?
<whiskas> Hmm, let me see...
<Riastradh> Are you familiar with the option type?
<whiskas> A little.
<Riastradh> type 'a option = None | Some of 'a
<whiskas> Aah, yes.
<Riastradh> It represents a computation that may fail or succeed with a single value.
<whiskas> Hmm, do you mind if I say it's not that clear?
<Riastradh> Not at all. I'd be greatly annoyed at you if you didn't tell me when I'm unclear.
<whiskas> :-)
<Riastradh> I could simplify the sentence by saying: a value of type 'a option is either a success of one value, whose type is 'a, or a failure.
<Riastradh> Does unfold's type make sense now?
<whiskas> Let's look at it again.
<Riastradh> unfold is a function that takes another function f and a value of type 'a, and returns a list containing elements of type 'b.
<whiskas> O.K.
<Riastradh> f takes a value of type 'a and returns either a failure or a success that contains a tuple whose first element is of type 'a and whose second element is of type 'b.
<whiskas> Ok, that I really got.
<Riastradh> First, let's name these arguments a bit more descriptively.
<whiskas> Good idea.
_JusSx_ has joined #ocaml
<Riastradh> f is already named. The argument to unfold whose type is 'a we shall call seed; the argument to f whose type is 'a we shall call seed' (note the single-quote). The first element of the tuple that f might return we shall call next_seed; the second element of that tuple we shall call element.
<Riastradh> Next, let me state the base case of unfold: f returning None indicates that unfold shall return [].
<whiskas> Let me look over that again :-)
<whiskas> OK, go on.
<Riastradh> Should f return [[Some (next_seed, element)]], unfold shall recur. next_seed becomes seed for the next recursion of unfold; unfold returns a list whose first element is element, and the rest of which is produced by the recursive call.
<_JusSx_> Nomme : heya
<Riastradh> (the [[]] is just notation to signify deviation from English into code)
<_JusSx_> Nomme : how are you?
<Riastradh> To put unfold briefly, it generates a list of every element f produced, keeping state for each application of f in the seed.
<whiskas> Riastradh: I think I know where you're getting...
<whiskas> Aha!
<Riastradh> So, here's a brief example of using it. [[tabulate f size]] shall return a list from the integers zero, inclusive, to size, exclusive:
<Riastradh> let tabulate f size =
<Riastradh> unfold
<Riastradh> (fun seed' ->
<Riastradh> if seed' == size then
<Riastradh> None
<Riastradh> else
<Riastradh> Some (seed' + 1, seed'))
<Riastradh> 0
<whiskas> Whee, that's nice!
<whiskas> But we don't have unfold...
<Riastradh> All you need to do is define it.
<whiskas> So it seems.
<whiskas> But I'll go over this conversaition one more time, if you don't mind :-)
<Riastradh> Oops. I described tabulate wrong. It's like [[map f <the list I previously said it would return>]].
<Riastradh> Er.
<Riastradh> Sorry.
<Riastradh> Please ignore everything I said about tabulate. Cognitive gas discharge!
<whiskas> O.K.
<Riastradh> So, here's a brief example of using unfold. [[tabulate f size]] returns a list [f 0; f 1; f 2; ...; f (size - 2); f (size - 1)].
<Riastradh> let tabulate f size =
<Riastradh> unfold
<Riastradh> (fun seed' ->
<Riastradh> if seed == size then
<Riastradh> None
<Riastradh> else
<Riastradh> Some (seed' + 1, f seed'))
<Riastradh> 0
<Riastradh> And here's an example of using tabulate:
<Riastradh> # tabulate (fun x -> string_of_int (x * 2)) 5;;
<Riastradh> - : string list = ["0"; "2"; "4"; "6"; "8"]
<Riastradh> # tabulate (fun x -> string_of_int (x * 2)) 5;;
<Riastradh> - : string list = ["0"; "2"; "4"; "6"; "8"]
<Riastradh> Er, whoops. Bloody X copy and paste.
<whiskas> That's nice.
<Riastradh> Now go off and implement unfold and come back when you've got a question or you're ready to figure out how to use unfold to implement the operation you described.
<whiskas> O.K. Thanks for the homework :-)
<whiskas> (Gotta save this conversation somewhere :-P)
<Maddas> Heh
<whiskas> How come you are so nice?
<Riastradh> Magic.
<whiskas> Aah, that would explain a lot.
whiskas has quit ["Leaving"]
karryall has joined #ocaml
Nutssh has joined #ocaml
buggs has joined #ocaml
gim_ has quit []
_JusSx_ has quit ["Killed by BillGates (Windows Linux 98 -- jizz your pants!)"]
mimosa has quit ["J'ai fini"]
Nomme has quit ["Leaving"]
Riastrad1 has joined #ocaml
Riastradh has quit [Nick collision from services.]
Riastrad1 is now known as Riastradh
Nutssh has quit ["Client exiting"]
buggs is now known as buggs^z