systems changed the topic of #ocaml to: http://icfpcontest.cse.ogi.edu/ -- OCaml wins | http://www.ocaml.org/ | http://caml.inria.fr/oreilly-book/ | http://icfp2002.cs.brown.edu/ | SWIG now supports OCaml| Early releases of OCamlBDB and OCamlGettext are available | Caml Weekly news http://pauillac.inria.fr/~aschmitt/cwn/
<taw> mmm
<taw> what macros ?
<taw> it would be best if i could just put all data on stdout from c++ program
<taw> and then have ocaml program eat it on stdin
<mrvn> taw: use ocamls datastructures.
<taw> in c++ ?
<mrvn> you interface via C
<reltuk> how well suited will ocaml be to like l system and fractal generation?
<reltuk> it seems like it would do really well
<mrvn> reltuk: coding wise its a dream. speed wise better use C for the heavy computations.
<mrvn> On alpha ocaml doesn't unbox floats which realy realy hurt performance for fractals.
<mrvn> For L-Systems it might be best to use the runtime so one can just generate code and execute it on the fly for user input.
<reltuk> ahh, very cool...I'm doing some testing/playing with procedural world generation and the likes...
<reltuk> since it's just playing for now, speed won't be the major concern, so it should be awesome :)
docelic is now known as docelic|sleepo
<mrvn> type sym = A | B | L | R | X;;
<mrvn> let l = function X -> [ A; L; X; B; A; R; X; B; ] | x -> [x];;
<mrvn> let iter l list = List.fold_left (fun accu s -> accu @ (l s)) [] list;;
<mrvn> let string_of_s = function A -> "{" | B -> "}" | L -> "L" | R -> "R" | X -> "x";;
<mrvn> let string_of_l list = List.fold_left (fun accu s -> accu^(string_of_s s)) "" list;;
<mrvn> let start = [ X ];;
Oniroi has joined #ocaml
<mrvn> let rec loop list = function
<mrvn> 0 -> ()
<mrvn> | i -> let list = iter l list in print_string (string_of_l list); print_newline (); loop list (i-1);;
<mrvn> loop start 4;;
<mrvn> Like that?
<lus|wazze> if theres one thing ocaml REALLY needs imho its a 'named let' construct like there is in scheme
<mrvn> Whats that?
<lus|wazze> you can do something like let loop x = 2 and y = 3 in if x < 10 then loop (x + 1) y else foobar which is then equivalent to let loop x y = if x < 10 then loop (x+1) y else foobar in loop 2 3
<lus|wazze> it makes an inline recursion look more like a loop, by keeping all the starting values of variables at the beginning
<lus|wazze> well im off to bed now ^^
<lus|wazze> 'night
lus|wazze has quit ["Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Univ]
<mrvn> # let rec foo ?(x=2) ?(y=3) () = if x = 10 then foo ~x:(x+1) () else "done";;
<mrvn> val foo : ?x:int -> ?y:int -> unit -> string = <fun>
<mrvn> # foo ();;
<mrvn> - : string = "done"
<mrvn> Like that?
<mrvn> args. sleepy head.-
<taw> omg
<taw> what's that ?
<mrvn> optional arguments
<taw> is ocaml really trying to be more syntax-heavy than perl ?
<taw> hmmm
<taw> looks wonderful
<taw> is it anything more than syntactic sugar ?
<mrvn> afaik it gets translated to simple option types.
<mrvn> "Optional arguments are actually implemented as option types."
<mrvn> Its nice if you have e.g. a GUI where you can open a window with lots and lots of extra options but only with and hight are essential.
<taw> what about ?(x=10)
<taw> is it int option or just plain int in that case ?
__DL__ has quit [Connection timed out]
<Smerdyakov> mrvn, those are "width" and "height"
__DL__ has joined #ocaml
Verbed has joined #ocaml
Verbed has quit [Remote closed the connection]
lament has joined #ocaml
Smerdyakov has quit ["sleep"]
mrvn_ has joined #ocaml
Verbed has joined #ocaml
mrvn has quit [Read error: 60 (Operation timed out)]
Verbed has quit [Remote closed the connection]
taw has left #ocaml []
Verbed has joined #ocaml
__DL__ has quit [Read error: 110 (Connection timed out)]
__DL__ has joined #ocaml
lament has quit ["NO ONE IS INTERESTED IN MY UNDERPANTS"]
lament has joined #ocaml
<reltuk> what are the two opengl bindings? camlgl and...?
kirkland has joined #ocaml
wax has quit [Remote closed the connection]
mkfort has quit [Read error: 110 (Connection timed out)]
wax has joined #ocaml
kirkland has quit [Read error: 110 (Connection timed out)]
mrvn has joined #ocaml
mattam has joined #ocaml
mrvn_ has quit [Read error: 110 (Connection timed out)]
TachYon has joined #ocaml
themus has quit ["Client Exiting"]
themus has joined #ocaml
TachYon has quit [Remote closed the connection]
lament has quit ["NEXT TIME IT COULD BE ME ON THE SCAFFOLDING"]
gl has quit [Read error: 60 (Operation timed out)]
gl has joined #ocaml
<karryall> reltuk: lablGL
gene9 has joined #ocaml
<reltuk> karryall : thanks :)
Verbed has quit ["Client exiting"]
docelic|sleepo is now known as docelic
lus|wazze has joined #ocaml
rhil is now known as rhil_zzz
taw has joined #ocaml
docelic is now known as docelic|away
systems has joined #ocaml
SlackwarrSleep is now known as Slackwarrior
<Slackwarrior> hello!
systems has quit [asimov.freenode.net irc.freenode.net]
polin8 has quit [asimov.freenode.net irc.freenode.net]
taw has quit [asimov.freenode.net irc.freenode.net]
systems has joined #ocaml
taw has joined #ocaml
polin8 has joined #ocaml
polin8 has quit [Remote closed the connection]
polin8 has joined #ocaml
systems has quit [Read error: 110 (Connection timed out)]
taw_ has joined #ocaml
taw_ has quit [Remote closed the connection]
taw has quit [Read error: 110 (Connection timed out)]
<Slackwarrior> how come when i launch ocaml <filename> i get syntax error and when i launch ocaml and write the same program i get no error?
vegai has quit [Read error: 60 (Operation timed out)]
vegai has joined #ocaml
Smerdyakov has joined #ocaml
Slackwarrior has quit ["X-Chat 2.0.0 for Linux"]
pattern_ has quit [asimov.freenode.net irc.freenode.net]
vegai has quit [asimov.freenode.net irc.freenode.net]
gl has quit [asimov.freenode.net irc.freenode.net]
themus has quit [asimov.freenode.net irc.freenode.net]
Oniroi has quit [asimov.freenode.net irc.freenode.net]
Zadeh has quit [asimov.freenode.net irc.freenode.net]
reltuk has quit [asimov.freenode.net irc.freenode.net]
smkl has quit [asimov.freenode.net irc.freenode.net]
docelic|away has quit [asimov.freenode.net irc.freenode.net]
__DL__ has quit [asimov.freenode.net irc.freenode.net]
asqui has quit [asimov.freenode.net irc.freenode.net]
polin8 has quit [asimov.freenode.net irc.freenode.net]
lus|wazze has quit [asimov.freenode.net irc.freenode.net]
gene9 has quit [asimov.freenode.net irc.freenode.net]
wax has quit [asimov.freenode.net irc.freenode.net]
Yurik has quit [asimov.freenode.net irc.freenode.net]
Smerdyakov has quit [asimov.freenode.net irc.freenode.net]
mattam has quit [asimov.freenode.net irc.freenode.net]
liyang has quit [asimov.freenode.net irc.freenode.net]
foxster has quit [asimov.freenode.net irc.freenode.net]
mellum has quit [asimov.freenode.net irc.freenode.net]
Riastradh has quit [asimov.freenode.net irc.freenode.net]
rhil_zzz has quit [asimov.freenode.net irc.freenode.net]
lam has quit [asimov.freenode.net irc.freenode.net]
karryall has quit [asimov.freenode.net irc.freenode.net]
mrvn has quit [Nick collision]
async has quit [Nick collision]
mrvn has joined #ocaml
async has joined #ocaml
Smerdyakov has joined #ocaml
vegai has joined #ocaml
polin8 has joined #ocaml
lus|wazze has joined #ocaml
gene9 has joined #ocaml
gl has joined #ocaml
themus has joined #ocaml
mattam has joined #ocaml
wax has joined #ocaml
__DL__ has joined #ocaml
Oniroi has joined #ocaml
karryall has joined #ocaml
lam has joined #ocaml
asqui has joined #ocaml
Yurik has joined #ocaml
reltuk has joined #ocaml
docelic|away has joined #ocaml
liyang has joined #ocaml
smkl has joined #ocaml
Zadeh has joined #ocaml
pattern_ has joined #ocaml
Riastradh has joined #ocaml
rhil_zzz has joined #ocaml
foxster has joined #ocaml
mellum has joined #ocaml
emu_ has joined #ocaml
emu has quit [Connection reset by peer]
docelic|away is now known as docelic
vegai_ has joined #ocaml
vegai has quit [Read error: 60 (Operation timed out)]
gene9 has quit [Read error: 104 (Connection reset by peer)]
vegai_ is now known as vegai
noss has joined #ocaml
lus|wazze is now known as afkts
PsionV has joined #ocaml
PsionV has quit [Remote closed the connection]
PsionV has joined #ocaml
Smerdyakov has quit [Killed (NickServ (Nickname Enforcement))]
PsionV is now known as Smerdyakov
PsionV has joined #ocaml
Smerdyakov has quit [Killed (NickServ (Nickname Enforcement))]
PsionV is now known as Smerdyakov
afkts has quit ["Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Univ]
<vegai> programming is like too long quit-messages
<docelic> adn we know that quote anyway :)
docelic is now known as docelic|away
noss has quit ["[x]chat"]
TachYon has joined #ocaml
Smerdyakov has quit ["i left"]
Smerdyakov has joined #ocaml
rhil_zzz is now known as rhil
<vegai> I don't in fact, how does the quote end?
lam has quit [Read error: 110 (Connection timed out)]
Smerdyakov has quit []
pattern_ has quit [Remote closed the connection]
pattern_ has joined #ocaml
docelic|away is now known as docelic
TachYon has quit [Remote closed the connection]
docelic has quit ["brb"]
afkts has joined #ocaml
afkts is now known as lus|wazze
docelic has joined #ocaml
reltuk has quit []
lam has joined #ocaml
lus|wazze has quit ["Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Univ]
pattern_ has quit ["..."]
jhy has joined #ocaml
<jhy> yo
<jhy> does ocaml support unicode?
<mrvn> via modules
<jhy> ic. is the string datatype 8-bit clean without using 3rd party modules
<mrvn> Would be pretty difficult not to be 8 Bit clean.
pattern_ has joined #ocaml
Smerdyakov has joined #ocaml
Oniroi has left #ocaml []
angelfire has joined #ocaml
angelfire has left #ocaml []
Smerdyakov has quit ["bye"]
reltuk has joined #ocaml
noss has joined #ocaml
<reltuk> ok, I've got a program I can run with ocaml and some tags because it uses lablgl...
<reltuk> I want to compile the program to an executable...how do I do that?
<reltuk> currently I have to run it with --> ocaml -I +labltk -I +lablgl labltk.cma lablgl.cma togl.cma %1
<mrvn> reltuk: ocamlc or ocamlopt
<reltuk> mrvn : same parameters? ocamlopt didn't know what to do with labltk.cma and friends...
<reltuk> mainly, how do I tell it to link against libraries like lablgl.lib?
<mrvn> .cmxa iirc
<mrvn> ocamlc/ocamlopt should do the liniking for you.
<reltuk> I get "Undefined global reference to "Focus"...
<reltuk> no ideas, eh?
async has quit [Read error: 104 (Connection reset by peer)]
<mrvn> Do you have the right order of modules?
<reltuk> I don't really know what you mean...I don't know hwo to tell it to use a certain module...
<reltuk> like, if I ran it with the above command...what would I compile with :-p
<reltuk> oh, I got it
<reltuk> sorry, I'm a moron :-p
<reltuk> ok, another stupid question...
<reltuk> I got it compiling to bytecode with ocamlc
<reltuk> ocamlopt would work, but I get "'ml' is not recognized as an internal or external command,
<reltuk> operable program or batch file.
<reltuk> should that be ocaml, or should I make a copy, or what?
docelic has quit [No route to host]
docelic has joined #ocaml
docelic is now known as nudedude
mattam_ has joined #ocaml
Slackwarrior has joined #ocaml
<Slackwarrior> hello
mattam_ has quit [Client Quit]
<reltuk> hi
<Slackwarrior> i get a weird error...
<Slackwarrior> can i do let rec.... and..... in ?
<karryall> sure
mattam has quit [Read error: 110 (Connection timed out)]
<Slackwarrior> ummmm
<Slackwarrior> weird...
noss has quit ["[x]chat"]
<Slackwarrior> sorry for the dumb question...
<Slackwarrior> how can i concatenate two lists?
<reltuk> @
<reltuk> [1;2;3] @ [4;5;6];;
<Slackwarrior> but if the first list is represented by a function?
<reltuk> doesn't matter
<Slackwarrior> well i get a weird error
<reltuk> (List.map ((+) 3) [-2;-1;0]) @ [4;5;6];;
<Slackwarrior> ummmm ok
<Slackwarrior> i corrected it
<Slackwarrior> can you write me a simple function that reverses a list? (without using List.rev)
<karryall> what for ? List.rev is fine
<Slackwarrior> the problem is that i cant use it
<Slackwarrior> its a homework
<reltuk> homework
<reltuk> I'm sure he wrote one in class
<Slackwarrior> no
<Slackwarrior> he didnt
<reltuk> where do you go to school?
<Slackwarrior> Universit? La Sapienza
<Slackwarrior> the first university of Rome
<Slackwarrior> (dont laugh please)
<mrvn> Slackwarrior: We are not here to do your homnework. Figure it out yourself or give up and read the ocaml source.
<Slackwarrior> ive read it
<Slackwarrior> ive read the part the prof explained
<reltuk> nah, it has a reverse function that you could just copy
<Slackwarrior> huh?
<Slackwarrior> where
<reltuk> in stdlib/list.ml
<mrvn> in List.rev of cause
<Slackwarrior> i cant use the List class
<Slackwarrior> or whatever it is
<mrvn> go read its source
<reltuk> just copy that function
<Slackwarrior> ok
<reltuk> or make one that's very very siilar to it
<Slackwarrior> /usr/lib/ocaml/list.ml i got it! :)
<reltuk> see, I'm trying to think of calculating the product of a list with tail recursion and not performing a single multiplication if there's a 0 anywhere in the list
<Slackwarrior> let rev l = rev_append l []
<Slackwarrior> im sorry ;)
<reltuk> Slackwarrior : yes, we all have access to the source too ;)
<Slackwarrior> so i just have to copy and paste rev and rev_append...
<Slackwarrior> i like this! :)
<reltuk> that'll probably look suspicious
<reltuk> like you don't know how the hell it works
<Slackwarrior> ummm i can guess :)
<Slackwarrior> a moment
<Slackwarrior> why cant i do it by myself?
<Slackwarrior> (maybe cos it will take a week?)
<reltuk> maybe you should write a crappy non-tailed reverse so it doesn't look suspicious
<reltuk> something using @
<Slackwarrior> ah
<Slackwarrior> lol
<reltuk> let rec reverse lst = match lst with [] -> [] | (x::xs) -> (reverse xs) @ x;;
<Slackwarrior> let rec reverse l = match l with
<Slackwarrior> [] -> []
<Slackwarrior> |hd::tl -> (reverse l)::hd;;
<Slackwarrior> it doesnt work
<Slackwarrior> omg standard ml is easier!
<reltuk> use @ and tl instead of l and ::
<Slackwarrior> ok
<Slackwarrior> it works! :)
<Slackwarrior> how is my indentation?
<Slackwarrior> :)
async has joined #ocaml
<Slackwarrior> well the function works but in another function it doesnt work...
<Slackwarrior> weird ocaml....
<Slackwarrior> wait a moment...
<Slackwarrior> let rec reverse l = match l with
<Slackwarrior> [] -> []
<Slackwarrior> | hd::tl -> (reverse tl)@hd;;
<Slackwarrior> val reverse : 'a list list -> 'a list = <fun>
<Slackwarrior> 'a list list?????????
<reltuk> it's a list of lists
<reltuk> I fucked up...it should be (reverse tl)@[hd];;
<reltuk> sorry
<Slackwarrior> yeah but i dont want a list of lists
<Slackwarrior> aaaahhh ok
<Slackwarrior> now it works :)
<Slackwarrior> thanks
<reltuk> btw, that's a horrible reverse function :-p
emu_ is now known as emu
<Slackwarrior> why is it horrible? :(
<Slackwarrior> i think that i like of ml is polymorphism...
<Slackwarrior> it's like a macro in c!
<reltuk> it's horrible because it's slow and doesn't scale
<reltuk> that's why the rev function in List is done the way it is
<Slackwarrior> well i dont know what "doesnt scale" mean but they appear to have the same speed...
<reltuk> try it on a 100 element list
<Slackwarrior> huh
<Slackwarrior> both are done in O(n)
<Riastradh> Your reverse function isn't tail recursive; it could cause stack overflows.
<Slackwarrior> ah...
<Riastradh> And (@) is expensive -- it conses up a new list every time.
<Riastradh> So I don't think your reverse is O(n).
<karryall> Slackwarrior: yours is O(n^2)
<Riastradh> That sounds more accurate.
<Slackwarrior> k
<Riastradh> let reverse l =
<Riastradh> let rec loop r = function
<Riastradh> [] -> r
<Riastradh> | head :: tail -> loop (head :: r) tail
<Riastradh> in loop [] l
<Riastradh> ...is a much better reverse function -- O(n), I believe, and tail-recursive.
<Slackwarrior> ok sorry....
<Riastradh> Oh, damnit, that was a homework problem.
* Riastradh slaps himself for not reading up earlier.
<reltuk> doesn't matter, he already looked it up in stdlib/list.ml
<reltuk> I told him to use the appending one because it's more likely that's something his professor would believe he came up with
<reltuk> Riastradh : you got any hints for compiling something with ocamlopt that uses lablgl?
Smerdyakov has joined #ocaml
mattam has joined #ocaml
<Slackwarrior> can i do something like:
<Slackwarrior> match t with
<Slackwarrior> something ->
<Slackwarrior> t=somethingelse.....
<Slackwarrior> ?
<reltuk> why not just let something = t in...
<reltuk> or let something = t and t = somethingelse in...
<Slackwarrior> and???
mattam has quit [Read error: 60 (Operation timed out)]
<reltuk> try it
<reltuk> let x = 4 and y = 5 in x * y;; --> 20
<Slackwarrior> what does that and mean?
<reltuk> what does it look like it means?
<Slackwarrior> and :)
<Slackwarrior> well i got
<reltuk> it means and...together with, as well as...
<Slackwarrior> type term = Const of int | Var of string | Term of string * term list;;
<Slackwarrior> and im trying to do
<Slackwarrior> let rec applysubst sigma t = match t with
<Slackwarrior> Var x -> t=apply x.....
<Slackwarrior> ....
<Slackwarrior> where apply is another function
<reltuk> I dont' think you can really t =..
<reltuk> variables aren't mutable in ocaml
<mrvn> of cause you can.
<reltuk> record fields can be mutable if you mark them as such...
<mrvn> (=) : 'a -> 'a -> bool = <fun>
<mrvn> Its just not what he means.
<Smerdyakov> mrvn is being a smart-ass! ;D
<reltuk> hah, yes, yes he is
<mrvn> I already told him that yesterday.
<Smerdyakov> Slackwarrior is the world's biggest whiny bastard. He still hasn't figured out to read his textbook or ask his teacher.
<Slackwarrior> thanks
<Slackwarrior> mrvn: you didnt tell me that
<reltuk> I'm stuck on two trivial functions for a homework assignment in ocaml too
<reltuk> if it's any consolation Slackwarrior
<Slackwarrior> on the same ship....
<Slackwarrior> :)
<Smerdyakov> You are both sad cases. :D
<reltuk> hah, I'm not sitting here trying to milk answers Smerdyakov ;)
<Slackwarrior> lol
<mrvn> Slackwarrior: and yes I did tell you
<Smerdyakov> It's sad to be stuck on Ocaml homework!
<mrvn> reltuk: what problem?
<reltuk> one of 'em I just haven't thought about yet, it's just make a power set from a list