cjeris changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/
postalchris has quit ["Leaving."]
G has quit [Read error: 110 (Connection timed out)]
pedro_ has joined #ocaml
pedro_soc has quit [Read error: 113 (No route to host)]
malc_ has joined #ocaml
sourcerror has quit [Read error: 113 (No route to host)]
mikeX has quit ["leaving"]
malc_ has quit [Read error: 110 (Connection timed out)]
delamon has quit [Read error: 101 (Network is unreachable)]
tspier2 has quit ["Lost terminal"]
a-priori_ has quit [Read error: 54 (Connection reset by peer)]
a-priori_ has joined #ocaml
sourcerror has joined #ocaml
<seoushi> can anyone tell me what this error is refering to? http://rafb.net/p/fpbsxG28.html (error is at the end)
<seoushi> seems when I pasted it the lines numbers are off, line 32 is actually the last line "init_2d (float width) (float height)" and the last character it's talking about is ")"
<pstickne_> it it balanced?
<pstickne_> *is
<seoushi> I think so
<seoushi> I could be wring as I'm new to ocaml
<seoushi> err wrong
<flux> let-expression should end with 'in'
<flux> let-expressions are different from top-level let-declarations
<seoushi> you talking about in open_window? there is an in
<flux> let screen = ..
<seoushi> oh
<seoushi> I didn't see that one, thanks
<seoushi> now I have another error but I can fix that one, thanks again
Smerdyakov has quit ["Leaving"]
david_koontz has joined #ocaml
G_ is now known as G
david_koontz has quit ["This computer has gone to sleep"]
Mr_Awesome has quit ["...and the Awesome level drops"]
love-pingoo has joined #ocaml
benny_ has joined #ocaml
benny has quit [Read error: 60 (Operation timed out)]
love-pingoo has quit ["Connection reset by pear"]
smimou has joined #ocaml
Submarine has quit ["Leaving"]
beschmi has quit [Read error: 113 (No route to host)]
vorago has quit [Read error: 110 (Connection timed out)]
love-pingoo has joined #ocaml
vorago has joined #ocaml
G_ has joined #ocaml
G has quit [Nick collision from services.]
G_ is now known as kG
smimou has quit ["bli"]
kG is now known as G
TaXules has joined #ocaml
kig has joined #ocaml
<ulfdoz> Does anyone have link to the ocamlmakefile? The one in the ocaml hump is dead.
<mattam> google
TaXules has quit [zelazny.freenode.net irc.freenode.net]
a-priori_ has quit [zelazny.freenode.net irc.freenode.net]
jlouis has quit [zelazny.freenode.net irc.freenode.net]
araujo has quit [zelazny.freenode.net irc.freenode.net]
lucca has quit [zelazny.freenode.net irc.freenode.net]
TaXules has joined #ocaml
a-priori_ has joined #ocaml
jlouis has joined #ocaml
araujo has joined #ocaml
lucca has joined #ocaml
mikeX has joined #ocaml
love-pingoo has quit ["Leaving"]
z_ has joined #ocaml
Sparkles has joined #ocaml
bluestorm_ has joined #ocaml
G_ has joined #ocaml
Sparkles has quit []
jlouis has quit [Read error: 104 (Connection reset by peer)]
jlouis has joined #ocaml
Sparkles has joined #ocaml
G has quit [Connection timed out]
Smerdyakov has joined #ocaml
a-priori_ has quit [Remote closed the connection]
a-priori_ has joined #ocaml
cjeris has joined #ocaml
love-pingoo has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
kig has quit [Read error: 110 (Connection timed out)]
kig has joined #ocaml
Sparkles has quit [Read error: 110 (Connection timed out)]
gunark has joined #ocaml
gunark has quit [Client Quit]
gunark has joined #ocaml
smimou has joined #ocaml
sourcerror has quit [Connection timed out]
sourcerror has joined #ocaml
gunark has quit [Read error: 104 (Connection reset by peer)]
Oatmeat|umn has quit ["Leaving"]
Oatmeat|umn has joined #ocaml
love-pingoo has quit ["zou"]
er_ocaml has joined #ocaml
<er_ocaml> how does one express a null character in ocaml?
<er_ocaml> '\0'
<er_ocaml> something shorter than char_of_int 0 I guess
er_ocaml has quit []
swater has joined #ocaml
er_ocaml has joined #ocaml
er_ocaml has quit [Client Quit]
benny99 has joined #ocaml
<benny99> hi
<benny99> http://caml.inria.fr/pub/docs/oreilly-book/html/book-ora016.html#toc21 <-- I got a question here -- how does Node(insert x lb, r, rb) work here ?
<benny99> ah, I guess I got it
<benny99> no, I don't :|
<ulfdoz> I have a design problem: Does anyone know of some kind of compiler or interpreter which separates parsing and interpretation of the parse-tree? I.e. I want an interpreter, where I can simply substitute the way, the tree is interpreted.
<benny99> :(
<pango> the whole function takes an element and a binary search tree, and returns the binary search tree with that element added at the right place
<pango> and its implementation is purely functional (and recursive)
<mrvn> ulfdoz: ocaml?
<ulfdoz> mrvn: Yes, implementation is in ocaml. The language I work on, is sieve.
<mrvn> ulfdoz: no, i ment ocaml as example for what you want
<pango> benny99: "if the element is smaller than the root element, then the tree with the element added is the tree with the element added to the left subtree", etc.
<mrvn> pango: balanced?
<pango> mrvn: no, they don't even handle the case when the element is already in the tree...
<ulfdoz> mrvn: I hoped, I could get something which is a bit easier to overview.
<benny99> pango: sorry, I got what it is doing, but I don't know how that special point, Node(insert x lb, r, rb), is working
<benny99> pango: because it seems to generate Node(Node(...) lb, r, rb) :(
<mrvn> benny99: insert creates a new tree with the element inserted and Node build the new root of the tree.
<benny99> mrvn: yeah, that's what I got already ;)
<mrvn> And it stops when it hits EMPTY
<benny99> mrvn: I know how that piece should work, but I don't know how that point is working
<benny99> mrvn: since Node got 3 members, not a tuple member and 2 other
<benny99> oh
<benny99> Node((Node(...) * lb), r, rb) <-- it's creating this huh ?
<mrvn> 'insert x lb' is the left side, r the element and rb the right sight.
<benny99> mrvn: yeah, I know
<mrvn> Then what is your question?
<benny99> doesn't matter, I hope my explanation is right then :p
<mrvn> benny99: The code goes down the tree till it hits empty, adds the element and then goes back restitching the tree.
<benny99> mrvn: yeah
<benny99> mrvn: that's not the problem
<mrvn> But that is all there is
<benny99> mrvn: the problem was, that I didn't understand, that it's also possible to create a Node with a Tuple
<mrvn> It isn't and you don't.
<benny99> mrvn: i.e. Node(*TUPLE-OF-NODE-AND-ELEMENT*, r, rb)
<benny99> mrvn: but it's doing that
<benny99> Node (insert x lb, r, rb) <-
<ulfdoz> benny99: It is a three-argument-constructor.
<mrvn> benny99: That is a constructor with 3 arguments.
<benny99> yeah, but one of them is a tuple
<mrvn> No
<benny99> insert x lb
<mrvn> That is a Tree
<ulfdoz> benny99: There is a difference between "Node of foo * bar * baz" and "Node (foo * bar * baz"
<ulfdoz> +)
<mrvn> yeah, Node (foo * bar * baz) is a syntax error
<ulfdoz> yes, "of" missing.
<benny99> what is "insert x rb"
<benny99> that's the only problem
<mrvn> benny99: a 'a bin_tree
<mrvn> or rather a function call with that result
<benny99> mrvn: I guess I totally do not understand why :|
<benny99> ah :O
<mrvn> benny99: becvause inset is a function 'a -> 'a bin_tree -> 'a bin_tree
<benny99> insert generates a function
<benny99> that takes an element + a node
<mrvn> insert even
<pango> benny99: I suppose you're confused by the 'function' keyword ? insert is a function of *2* parameters
<benny99> pango: no
<benny99> I missed the second parameter I geuss ;)
<benny99> but now I understood
<mrvn> 'let rec insert x = function' is the same as 'let rec insert x t = match t with'
<benny99> mrvn: yeah
<benny99> mrvn: that was my problem, sorry
<benny99> mrvn: am a NewB :|
<mrvn> np.
<pango> benny99: let f = function ... <=> let f = fun x -> match x with ...
<pango> benny99: so you could rewrite the first line like, 'let rec insert x tree = match tree with'
<benny99> mrvn: I wonder if OCAML is really worth learning --> it looks extremly interesting, but is it so smart, that it's nearly unprogrammable or do you get used to it :p ?
<pango> there's no tuple anywhere here
<pango> let me repeat, insert is a function of arity 2
<pango> val insert : 'a -> 'a bin_tree -> 'a bin_tree = <fun>
<benny99> pango: yeah, that's what mrvn said already I guess
<mrvn> benny99: you get used to is so much you don't want to use anything else
<benny99> it appears to be fast and I really ike that "function is an object"-term :p
<benny99> but if you programmed C-kind-languages for years it's hard to understand :|
<benny99> ah, that I'm bothering already --> anybody knows a good tutorial ?
<benny99> or should I stick to this one ?
<benny99> it's like an "Imperative book for a functional language" I guess, hope that's not causing any damage to me :p
<pango> the value of insert x lb is of type 'a bin_tree, as mrvn said
<pango> a (recursive) call to insert with two parameters
<mrvn> benny99: the ocaml manual if quite good if you already know about programming in general.
<tsuyoshi> I learned lisp before ocaml, and the hardest things to understand were currying and pattern matching
<benny99> tsuyoshi: and how to use it ? :p
<tsuyoshi> how to use what?
<benny99> the language
<tsuyoshi> oh and ;
<tsuyoshi> the ocaml ; looks deceptively like the c ;
<vorago> o_O.
<benny99> I stress it a bit -- using ocaml imperative appears to be wrong
<tsuyoshi> but they work completely differently
<benny99> the ocaml ; is twice as good as the C ones, cause you type it two times ";;"
<tsuyoshi> imperative is ok in ocaml
<bluestorm_> benny99: actually ;; isn't needed
<benny99> bluestorm_: huh ?
<bluestorm_> ;; are not mandatory
<bluestorm_> only in the toplevel
<tsuyoshi> now that is confusing.. I still don't understand ;;
<benny99> bluestorm_: hm, I got used to it, I'll type it anyway
<bluestorm_> [20:27:59] <benny99> mrvn: I wonder if OCAML is really worth learning --> it looks extremly interesting, but is it so smart, that it's nearly unprogrammable or do you get used to it :p ?
grzywacz has joined #ocaml
<bluestorm_> Alan Perlis, Award Turing, said : « A language that doesn't affect the way you think about programming, is not worth knowing. »
<benny99> bluestorm_: I got used to ";"
grzywacz has left #ocaml []
<pango> benny99: not to mention I already said you must be confused by the 'function' keyword, 10 minutes ago ;)
<benny99> bluestorm_: it does affect <_<
<pango> that's the one I used, almost 5 years ago
<bluestorm_> s/Award Turing/Turing Award/
<pango> it's missing the new features, or mentions restrictions that are now lifted, but it's still quite good imo
<pango> benny99: both ; and ;; exist
<benny99> pango: I give it a lol :p
<pango> tsuyoshi: the best explanation for ;; I've found is in www.ocaml-tutorial.org
<pango> tsuyoshi: http://www.ocaml-tutorial.org/the_structure_of_ocaml_programs, "Using and omitting ;; and ;"
<benny99> pango: yeah, I'm already at chapter 2, what do you excpect :P
<pango> benny99: mmh ?
<bluestorm_> hm
<benny99> read that once ago
<bluestorm_> btw, i really should translate ocaml-tutorial to french
<benny99> there was also a way to use :: to add 2 numbers :/
<bluestorm_> i'm just procrastinating a lot ^^
<pango> benny99: not everything is excellent in this tutorial, but on that point I learned something
<benny99> ah, it was using ;
<pango> bluestorm_: I did the translation of the first chapters, but I'm missing time to go on (it's very time consuming...)
<benny99> pango: I forgot it again :p
<bluestorm_> (i translated the beginning of the merjis page "how to install ocaml" :-° )
<pango> bluestorm_: also, I don't totally agree with the next chapter, downplaying the usefulness of functional programming in ocaml ;)
<bluestorm_> hm
<bluestorm_> by the way
* benny99 gone reading
<tsuyoshi> pango: hmm I already understand how ; works, and that doesn't really explain ;; too well
<bluestorm_> i asked myself what would happen if i were to write some new content on the french page only
<bluestorm_> is there a hm regular way to do this ?
<bluestorm_> it seems that there is only translation for now
<pango> tsuyoshi: uh ?
<bluestorm_> i do not know how we could handle divergences in the different languages
<tsuyoshi> it just says sometimes you can skip the ;;
<pango> tsuyoshi: in short, ;; ought to be mandatory between each toplevel expression
<tsuyoshi> that's pretty much how I use it
<bluestorm_> try to delete it everywhere, and to see where this make problems :p
<pango> tsuyoshi: but parser is "smart", so in many cases you can avoid using it (or avoid using it totally, using alternatives like inserting let () = ...)
<bluestorm_> pango: do you have free expressions (those that need let () = ...) in the middle of you code ?
<pango> tsuyoshi: yes, too bad the compiler doesn't always barf if ;; is not only found at toplevel :/
<bluestorm_> i put them only at the end, and let () = ... then looks like a cool way to say "main"
<pango> bluestorm_: yes... still, if ;;s were mandatory, let () = ... would not be needed
<bluestorm_> but ;; are ugly and let () = is cool, so this seems like a good deal to me ^^
<pango> personally I'd take ;; if they were reliable toplevel expressions separators
Submarine has joined #ocaml
<tsuyoshi> never seen let () before
<benny99> tsuyoshi: even I did
<tsuyoshi> just let _
<benny99> uh, I'm gone again
<benny99> yeah, "let _ = ... ;;" is the most useful expression you got in ocaml I guess
<bluestorm_> let _ = ... is a oh-look-this-is-a-pattern-matching way to say let () = ... generally
<pango> tsuyoshi: let _ = is more lax
<bluestorm_> (sometimes it means "ignore")
<benny99> huh, is it really useful?
<tsuyoshi> so with let (), the expression has to return ()?
<bluestorm_> let () = is needed when you delete ';;'
<bluestorm_> tsuyoshi: yes
<pango> tsuyoshi: yes
<tsuyoshi> I see
<ulfdoz> Most common example is probably let () = print_endline "foo" in ();;
<pango> the 'in ()' is not required, since print_endline returns () already
<flux> it's a different thing in this context anyway?
<ulfdoz> Ok, better example: let () = print_endline "now I'm doing something weird." in doing_weird_things;;
<tsuyoshi> oh.. I would just write: print_endline "..."; do_weird_things;;
<bluestorm_> this could be an example of code without ;;
<ulfdoz> benny99: The binding causes the right hand of the '='-sign to evaluate without returning it. often useful for e.g. debugging-ouput.
<bluestorm_> (the first code i found in my ~)
<benny99> ah
<benny99> I don't know about ~ and ? yet :(
<benny99> what are they doign ?
<pango> labels (named parameters) and optional parameters
<benny99> <_< oh
<benny99> I guess the book will refer to that later
<benny99> (800 pages of brute OCAML-learning...)
<pango> not sure labels existed at the time
<benny99> they did
<benny99> look at the appendix
<pango> correct
<benny99> where did you learn ocaml ??
<ulfdoz> at home.
<pango> learned about ocaml at uni (not much - only a few hours iirc), and rediscovered it several years later ;)
<pango> so I'd say from home, too
<ulfdoz> I just stumbled across and found that it has a good performance and seemed to be quite expressive.
<ulfdoz> Actually its "expressiveness" is also its biggest disadvantage. Too many concepts.
<ulfdoz> +imho
<benny99> too !many! concepts?
<pango> I'm still to use several ocaml's features ;)
<pango> including OO and polymorphic variants
<benny99> hm, I guess the number of ocaml users is quite small ?
<ulfdoz> benny99: Whatever you can imagine to use in daily programming, ocaml seem to have it.
<benny99> ulfdoz: that's not bad I guess
<ulfdoz> benny99: Depends, syntax gets quite complex and sometimes, concepts are completely unrelated, e.g. modules and classes.
<tsuyoshi> the biggest disadvantage I think is macros
<benny99> ulfdoz: oh :(
<benny99> tsuyoshi: is there a need for macros in OCAML ?
<ulfdoz> benny99: Often you try to use a single feature and several LoCs later you find yourself imprisoned inside this feature.
<tsuyoshi> benny9: there's a preprocessor, camlp4, but it's pretty difficult to use compared to lisp macros
<ulfdoz> oops, I see I haven't paid my ticket for parking at the wrong place.
<tsuyoshi> but compared to c.. I don't think there are any disadvantages
<benny99> ulfdoz: uh, that's really bad :( -- do you think they'll solve that ?
<benny99> to D ?
<ulfdoz> tsuyoshi: Know, at least it knows about memory management.
<ulfdoz> s/Know/No/1
<tsuyoshi> oh wait, there is one
<tsuyoshi> the compiler doesn't support shared libraries
<ulfdoz> benny99: It's unlikely to see big changes because the language will probably not break earlier versions.
<benny99> *wagh* -- hm, doesn't matter often I guess
<benny99> ulfdoz: uh :(
<tsuyoshi> I think sooner or later it will support shared libraries though
<benny99> ulfdoz: did you program anything in OCAML yet ?
<benny99> ulfdoz: ie anything bit bigger ?
<ulfdoz> benny99: Nothing big, I'd call myself a beginner.
<ulfdoz> No experience, no support by daily business and often no time.
swater has quit ["Quat"]
<pango> tsuyoshi: isn't Lisp's macros simplicity related to the uniformity of underlying datastructure ? (dynamically typed lists ?) camlp4 can't beat that, I guess
<benny99> anybody "really" used ocaml yet ?
<tsuyoshi> pango: yeah.. sometimes I think about writing a preprocessor to bring lisp syntax to ocaml
<tsuyoshi> it really wouldn't be all that hard
<pango> benny99: I use it to hack mldonkey, wrote some small programs, and use it for prototyping at work
<tsuyoshi> I guess ocaml does have shared library support
<tsuyoshi> need a c wrapper though
<mrvn> I'm writing a filesystem in ocaml
<tsuyoshi> mrvn: is it kernel- or user-space
<mrvn> user-space. ocamlfuse.
<mrvn> Getting ocaml code into the kernel would be somewhat difficult.
<tsuyoshi> yeah.. putting a garbage collector into a kernel module would be an interesting challenge
<benny99> so it is used then ;)
<pango> well, ocaml's gc doesn't have huge requirements, like hardware support or stuff like that
<seoushi> I'm currently using it to make a game but I would still call myself a beginer
malc_ has joined #ocaml
kig has quit [Read error: 110 (Connection timed out)]
slipstream has quit [Read error: 54 (Connection reset by peer)]
postalchris has joined #ocaml
slipstream has joined #ocaml
<benny99> seoushi: a !Game! using OCAML ? Is that really the "destiny" of this language ?
<seoushi> for me yes
<benny99> for me, too, if it wasn't that complicated
<seoushi> heh
<benny99> seoushi: so, where did you learn it ? from which book/tutorial??
<seoushi> I'm just sick of c++ and ocaml looked like the next best alternative
<flux> benny99, I wrote this: http://www.modeemi.cs.tut.fi/~flux/goba/
<flux> plug related to games in ocaml ;)
<seoushi> I followed the oreily book and ocaml-tutorial.org
<seoushi> I've only written a tutorial on getting ocamlsdl working on the mac
<benny99> ah, ok :)
<benny99> the whole book ?
<seoushi> yeah it's the whole book, it's free online
<seoushi> one sec
<benny99> I got it
<benny99> but did you read the whole one ?
<seoushi> nah
<benny99> it's a bit "brute-learning" huh ?
<seoushi> I read the first chapters and such but I figured I would learn the rest as I went along
<benny99> aj :)
<seoushi> I liked the ocaml-tutorial.org better
<benny99> and you are satisfied with your code ?
<seoushi> it's not bad
<benny99> o k, thanks for the interview ;P
<seoushi> heh, np
<tsuyoshi> I learned by writing a program
<tsuyoshi> did a japanese-english dictionary using edict
<tsuyoshi> although the majority of the code was actually in c.. wrapper for berkeley db
<tsuyoshi> the type system made a lot more sense after I did that wrapper
<mrvn> I wouldn't use berkeley DB. That one just sucks.
<tsuyoshi> what would you use
<mrvn> write something simple or use sql.
<tsuyoshi> I didn't want to require a dbms
<tsuyoshi> otherwise I would have used sql
<mrvn> With libdb I have seen to many DBs getting corrupted.
<mrvn> Worst if you run out of diskspace.
<tsuyoshi> actually I wanted to just use dbm.. since ocaml already had a wrapper for that
<tsuyoshi> but I wanted to do partial key searches
<tsuyoshi> and dbm doesn't support that
slipstream-- has joined #ocaml
TaXules has quit [Read error: 104 (Connection reset by peer)]
slipstream has quit [Read error: 110 (Connection timed out)]
G_ is now known as G
<pango> you could have used sqlite bindings
<tsuyoshi> sqlite is horrible
<tsuyoshi> it doesn't have any real data types at all.. it basically throws out all the good things about sql
<tsuyoshi> and has no subqueries or.. gah I don't even want to think about it
<pango> yep... "everything is a zero terminated string"
<pango> (personally I'm waiting for a db binding with prepared statements...)
<seoushi> so glOrtho is defined like this "val glOrtho : float -> float -> float -> float -> float -> float -> unit" and so I goto call it with 6 floats and I get "This expression has type float -> float -> unit but is here used with type int", my line of code looks like this "glOrtho 0.0 width 0.0 height -1.0 1.0" . Why does it only want two floats?
<benny99> is there a way to do something like : let rec fib x = match x with y < 0 -> ... ????
<seoushi> try using an if statement
<benny99> yeah, thought about that too
<benny99> but there must be a way using matching
<malc_> benny99: match x with n when n < 0 ->
<seoushi> that too
<pango> seoushi: height -1.0 must be interpreted as height - 1.0, try height (-1.0), or height ~-1.0
<benny99> malc_: thank you :))
<seoushi> ah
<seoushi> that seemed to work thanks. Still working on the quirks :)
<benny99> I'm gone playing some Zelda :D
cjeris has quit [Read error: 104 (Connection reset by peer)]
Sparkles has joined #ocaml
Sparkles has quit [Client Quit]
er_ocaml has joined #ocaml
ozzloy has left #ocaml []
<benny99> gone for today -- help folding at home ;)
er_ocaml has quit []
benny99 has left #ocaml []
ikaros has joined #ocaml
bluestorm_ has quit ["Konversation terminated!"]
G is now known as Gone
postalchris has quit [Read error: 113 (No route to host)]