dylan changed the topic of #ocaml to: OCaml 3.09.1 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/
slipstream has joined #ocaml
JosephRivers has joined #ocaml
<JosephRivers> Do the ocaml bindings for Gtk+ implement a function that will read a pixmap in from a file? I see the create_from_xpm function, but what about other formats?
Skal has quit [Remote closed the connection]
_fab has quit [Remote closed the connection]
<descender> JosephRivers, Gdkpixbuf.from_file is one
<descender> sorry make that GdkPixbuf.from_file
<JosephRivers> Thank you. I'll give that a try.
slipstream-- has quit [Read error: 110 (Connection timed out)]
dark_ has joined #ocaml
dark_light has quit [Connection timed out]
HatchBack176 has joined #ocaml
shawn__ has joined #ocaml
easy4 has joined #ocaml
shawn has quit [Connection timed out]
JosephRivers has quit [Remote closed the connection]
shawn__ has quit [Connection timed out]
easy4 has quit []
khaladan_ has quit [Read error: 104 (Connection reset by peer)]
dark__ has joined #ocaml
dark_ has quit [Read error: 113 (No route to host)]
mikeX has joined #ocaml
<tspier2> Hey mikeX
<mikeX> hello
<tspier2> How was your day?
<tspier2> :>
<mikeX> ok :)
<tspier2> (Nobody else seems to be talking in here, so I'll chit-chat)
<mikeX> hehe
<mikeX> how about yours?
<tspier2> My day was pretty good. I was reviewing some OCaml stuff, and looking at some source from pango and you. Now I just have to get ready for the weekend, because I am packed with plans.
<mikeX> :)
<mikeX> I got the book on lisp I ordered, so I have my hands full too
<tspier2> Nice
<tspier2> Well see, I have plans with the ladies this weekend, not with my buddy OCaml. ;)
<dylan> tspier2: You could always invite your buddy ocaml along with the ladies, so to speak.
<mikeX> lol
<dylan> Though, my lass dislikes ocaml. And not the syntax, it seems.
<mikeX> what then!?
<tspier2> Lol
<dylan> She likes lisp and perl. :P
<tspier2> Perl isn't bad.
<dylan> which is fine, as those are in my languages of choice list, too.
<tspier2> I use it for simple IRC bots for a few channels I need to have someone/something administrate.
<dylan> Perl is cool. Perl6 is even cooler. :)
<mikeX> haven't looked at perl yet, but it's not on my todo list, ugly syntax :P
<tspier2> Yeah it does.
<dylan> some say that of ocaml.
<tspier2> Meh
<dylan> I stopped caring about syntax when I learned ocaml. You can get used to anything.
<tspier2> Asm has ugly syntax. ;)
<mikeX> hehe
<mikeX> indeed syntax is a minor issue in most cases
<tspier2> Yep
<mikeX> but a language that allows this http://www.99-bottles-of-beer.net/language-perl-737.html scares me a little bit
<tspier2> Whoa
<dylan> pssh, this is worse:
<tspier2> Wow
<tspier2> I will find one that is worse...
<dylan> it implements a caching system because how it calculates strings is very ineffcient.
<tspier2> :P
<tspier2> Look at the bottom program.
<mikeX> lol
<tspier2> Makes you feel like a cave man...
<tspier2> :P
<mikeX> hehehe
<tspier2> mikeX and dylan...
<tspier2> What is the most complex application you guys have created, and what does it do?
<tspier2> In OCaml
<mikeX> well I'm new to ocaml so I haven't done much (yet hopefully)
<tspier2> Well, based on how far you have come, what has it been?
<mikeX> my biggest project is an unfinished gui application ~2000 lines of code, I guess it's the most complex too, but just cause of the gui part
<tspier2> What does/will it do?
<mikeX> it's a database frontend :\
<mikeX> i did it mostly for learning, not very useful
<mikeX> most of my programs are like that
<tspier2> Oh
<tspier2> dylan, what about you?
<tspier2> mikeX, think on the bright side...you've done more than me.
<mikeX> hehe
<tspier2> Seriously though, the most I've done is just create a simple loop. That is how much of a n00b I am.
cmeme has quit ["Client terminated by server"]
<mikeX> well I've been struggling with ocaml for almost a year now
<tspier2> Oh
<tspier2> I've had a week. :P
<mikeX> :)
cmeme has joined #ocaml
<tspier2> It just makes me upset that I couldn't create that application even with you guys throwing code at me.
<mikeX> well as pango noted, it's not just syntax, you have to become familiar with some concepts first
<tspier2> Hmm
<mikeX> for example coming from pascal, it should strike you as weird that variables are by default immutable
<tspier2> mikeX, would you mind running me through a program...like what each line does?
<tspier2> It isn' that big.
<tspier2> isn't*
<dylan> tspier2: oh. I wrote a make replacement with a general javascript-like language with lexical variables and closures.
<tspier2> Whoa
<tspier2> So you create your own programming language then?
<tspier2> created*
<dylan> it's a domain specific language for describing how to build software.
<tspier2> Gah, I'm bad at typing tonight.
<dylan> it builds itself, too. :)
<tspier2> Nice
<tspier2> mikeX?
<mikeX> I got introduced to O'Caml in my Compilers class, but I haven't used it yet for anything like that
<mikeX> tspier2: I can try
<tspier2> pango wrote it.
<tspier2> When I taught him about Stem and Leaf Plots
<mikeX> i see, well some parts are hard for me to explain in it
<tspier2> :/
<tspier2> Can you try?
<mikeX> ok, I suppose you understand lines 9,10 right?
<tspier2> Yep
<tspier2> Should I explain what it does?
<tspier2> Then you tell me if I am right.
<mikeX> ok
<tspier2> Line 9 defines the function "stem_of n", as n / 10, so that when "stem_of" and a number is printed, that number will be divided by ten to define what stem_of is. Same for line 10, but swapped to mod and leaf_of.
<mikeX> yeap
<mikeX> how about the classify function?
<tspier2> Wow...too much.
<tspier2> I don't even know what it does anymore.
<mikeX> well that's the main part of the program
<mikeX> do you know what a hash table is?
<tspier2> Nope
<mikeX> ok, think of it as an assosiative array
<mikeX> for example, a typical array is intexed by integers, array.(0) , array.(1) etc
<tspier2> Yeh
<mikeX> an associative array can be indexed by any type of value
<mikeX> like array("el1" => 34234, "el2" => 4, "el3" => 3)
<mikeX> (that syntax is php, not ocaml)
<tspier2> Okay
<mikeX> this is an array, whose element "el1" is 34234 etc
<tspier2> Wait, so you are defining it so the way to get the value of el1 is by using 34234, instead of say...array.(0)?
<mikeX> more like array.("el") will hold value 34234
<mikeX> but in the classify function, integers are still used for indexing
<tspier2> Alright, but is it always "Hashtbl"?
<mikeX> Hastbl is a module
<mikeX> hmm, i think i'm only confusing you more
<mikeX> and probably explaining things the wrong way
<tspier2> Meh
<mikeX> think of a module as a separate file, where some functions, types and values are defined for the moment
<mikeX> that's why the . notation is used, Hastbl.create is execute the function 'create' in the file hashtbl.ml
<tspier2> Alright...what is Hastbl creating?
<tspier2> Hashtbl*
<mikeX> well, a new (and initially empty) hash table, with size 5
<mikeX> hash tables can expand as needed as you add elements
<tspier2> Alright...so a hash table is like a binder...you can create the amount of pages in it with the number after it. So "Hasthbl.create 5 in" creates the binder with five pages that data can be stored in?
<tspier2> Gah. I meant to type Hashtbl*
<mikeX> hmm, I guess
<tspier2> Alright. How do you store information/data on those "pages" though?
<mikeX> with Hashtbl.add
<mikeX> this takes 3 arguments
<mikeX> the hash table where you want to add your data, a key and a value
<mikeX> Hashtbl.add some_htable "el4" 234
<mikeX> this creates a new entry in some_htable, with key "el4" and value 234
<tspier2> So would you call the value 234 with, "some_htable(.e14)"?
<mikeX> if you call Hashtbl.find some_htable "el4", you will get 234
<tspier2> Oh
<mikeX> since hash tables are not really an array, but a more complex data structure, you can't use that syntax
<mikeX> can you figure out what type are the keys and values in the hashtbl of the clasify function?
<tspier2> I don't understand the question.
<tspier2> Let me try to make an example hash table...
<mikeX> in my example I have been using a hash table which has strings for keys, and integers as values
<mikeX> you can use (almost) any type you want
<mikeX> did you install the toplevel?
<tspier2> Hashtbl.create 2 in
<tspier2> Hashtbl.add time_type "tM" Military
<tspier2> Hashtbl.add time_type "tA" American
<tspier2> Hashtbl.find time_type "tM"
<tspier2> Would that work?
<mikeX> line 1 should be 'let time_type = Hashtbl.create 2 in'
<tspier2> Oh yeah
<mikeX> and there should be a statement like 'type some_type = Military | American'
<mikeX> preceeding all these
<tspier2> Oh
<tspier2> Alright, let me try again...
<mikeX> unless you wante to put strings there
<mikeX> in which case you missed the double quotes
<tspier2> type _time_type = Military | American
<tspier2> let time_type = Hashtbl.create 2 in
<tspier2> Hashtbl.add time_type "tM" Military
<tspier2> Hashtbl.add time_type "tA" American
<tspier2> Hashtbl.find time_type "tM"
<tspier2> Better?
<mikeX> yeah, you are still missing the semicolons on line 3 and 4
<tspier2> Ah
<mikeX> but besides that, your example should return American
<tspier2> Why?
<tspier2> Shouldn't it give Military for tM?
<mikeX> em sorry, Military
<tspier2> Phew
<mikeX> :)
<tspier2> Alright...would it print out "Military"?
<mikeX> you really should install ocaml and try things on the toplevel
<mikeX> nope, it would just return Military
<mikeX> which is a new type you have defined
<tspier2> I can't install OCaml right now. This weekend is packed, but I might be reinstalling Ubuntu on my new hdd on Sunday, so then I can test stuff out more often.
<mikeX> are you on windows?
<tspier2> No, right now I am on a Live CD of Linux.
<tspier2> That's the problem.
<mikeX> i see :/
<tspier2> Yeah
<mikeX> anyway, do you know what 'ref' is?
<tspier2> Isn't it when you define something as a reference to the whole program?
<mikeX> not sure what you mean by that
<tspier2> Uh...like defining something as a global variable?
<mikeX> not really
<mikeX> let i = ref 0
<mikeX> i is a reference to 0, and it's value can be changed
<mikeX> let i = 0
<mikeX> i is an integer with value 0, it's value can not be changed
<tspier2> Oh, so "let i = ref 0" makes it polymorphic?
<mikeX> no not polymorphic, i can't be anything other than a reference to an integer
<mikeX> but it's value can change
<tspier2> Hmm
<mikeX> it's hard to explain all this without practicing them on the ocaml toploop
<tspier2> Yeah
<tspier2> And considering I am talking to my friend Jessika, you are doing a good job, because it is actually getting through to my head.
<tspier2> That makes it a miracle!
<tspier2> ^_^
<mikeX> hahahha
<tspier2> Seriously...she makes my hormones go wild. ;) Now that is the type of girl every guy needs.
<mikeX> ;)
<tspier2> We're talking about whips and chains. :P
<mikeX> kinky
<tspier2> Actually, originally, I robbed a bank, and she came to the scene. She took my shirt, and my gun. Then she put handcuffs on me, and put me in her car. She has to change out of her itchy, police clothes, so she is getting her sexy, female assistant to restrain me.
<tspier2> O:->
<tspier2> Hehe, I need a life.
<mikeX> hhahahahah
<tspier2> Wow, I've made a travesty of this channel. Lol
<tspier2> I come here, and people are getting help and asking questions. Now people come here, and read the logs...find out about whips and chains, and other kinky stuff, whilst little questions are being asked.
<mikeX> who knows, this might attract more people
<tspier2> Hehe
mikeX has quit ["zzz"]
shawn has joined #ocaml
bzzbzz has quit ["Lost terminal"]
<dylan> ocaml is a bondage and disipline language?
<tspier2> Yep
<tspier2> :D
bzzbzz has joined #ocaml
<tspier2> You can program females to use handcuffs, and beat you with chains. That is what you use OCaml for.
<tspier2> :>
<tspier2> Night dylan
<dylan> g'night pervert. ;)
<tspier2> :D
tspier2 has quit ["Leaving"]
kryptt has joined #ocaml
Smerdyakov has quit ["Leaving"]
HatchBack176 has quit []
mrsolo_ has joined #ocaml
kryptt has left #ocaml []
pauldia has joined #ocaml
pango is now known as pangoafk
pangoafk is now known as pango
mattam_ is now known as mattam
srle has joined #ocaml
<srle> hola, a todos :)
<srle> I have a question.
<srle> is anybody there?
<srle> help
PierreTramo has quit [Read error: 113 (No route to host)]
srle has quit ["BitchX: it won't get you laid"]
srle has joined #ocaml
<srle> hi
<pauldia> srle: im new to ocaml but maybe i can help you
<pauldia> shoot
smimou has joined #ocaml
<srle> pauldia: hi
<pauldia> srle: hi, whats your problem
<srle> look at the following code:
<srle> let a = [1;2;3;4];;
<srle> let f y = List.fold_left (+) 0 (List.map (fun x -> x*x) y);;
<srle> for example if I want to change 'a' to be array, I would have to change List to Array twice
<srle> is there something like:
<srle> import List as mod;;
<srle> let f y = mod.flod_left ...
<srle> So that I could change: import List as mod to import Array as mod
<srle> pauldia : and?
<pauldia> i dont really get it. what do you need to change twice?
<pauldia> could you not use Array.of_list?
<mellum> srle: module Mod = Array;;
<mellum> Note the capital M
<srle> tnx
PierreTramo has joined #ocaml
Skal has joined #ocaml
<pango> (couldn't write module My_module_for_lists = My_module(List) and module My_module_for_arrays = My_module(Array) because of the missing t type declaration... Maybe someone has an idea...
bluestorm has joined #ocaml
love-pingoo has joined #ocaml
Anarchos has joined #ocaml
<Anarchos> how to skip one char in a semantic action of ocamllex ?
<zmdkrbou> rule bla = mychar { bla lexbuf }
<Anarchos> i have a C function which reads two chars and skips them one by one , comparing them to "*" and "/". I would like to mimic this function in my semantic action in ocamllex
<zmdkrbou> you want to recognize C comments ?
<zmdkrbou> if so, this is not the right way, you don't need to check the '*' and '/' by hand
<Anarchos> ok so "/*" .* "*/" should
<Anarchos> do the job
<zmdkrbou> a nice way is to have a "/*" pattern, which calls a rule dedicated to eating comments, and in this rule you return when you find "*/"
<Anarchos> how do you do this in the second part ?
<zmdkrbou> | commentopen { eat_comment lexbuf }
<zmdkrbou> (...)
<zmdkrbou> and eat_comment = parse
<zmdkrbou> commentclose { next_token lexbuf }
<zmdkrbou> | "\n" { let _ = (current_line := !current_line + 1)
<zmdkrbou> in eat_comment lexbuf }
<zmdkrbou> | eof { raise Comment_eof }
<zmdkrbou> | _ { eat_comment lexbuf }
<Anarchos> ok i will try this
Smerdyakov has joined #ocaml
Anarchos has quit [Read error: 110 (Connection timed out)]
PierreTramo has quit ["Ex-Chat"]
pauldia has quit ["Leaving"]
GCarrier has joined #ocaml
GCarrier has quit ["Ex-Chat"]
kasv has joined #ocaml
pauldia has joined #ocaml
Snark has joined #ocaml
pauldia has quit [Client Quit]
kasv has quit ["Leaving"]
pauldia has joined #ocaml
pango is now known as pangoafk
pangoafk is now known as pango
multani has joined #ocaml
<multani> hello
<bluestorm> hello ;)
<multani> i'm trying to use ocamldoc to generate documentation for a project I have done
<multani> i wanted to make custom tags, but i'm stuck with my generator :/
dark__ has quit [Connection timed out]
<multani> i have followed the documentation, which say to have a new method like "method html_of_bar t = (* your code here *)", but i can't figure out how to use "t" there :D
Boojum has joined #ocaml
Snark has quit [Read error: 110 (Connection timed out)]
pauldia has quit [Read error: 110 (Connection timed out)]
Boojum is now known as Snark
piggy_ has joined #ocaml
piggy_ has left #ocaml []
multani has quit ["Parti"]
tspier2 has joined #ocaml
pauldia has joined #ocaml
kasv has joined #ocaml
Snark has quit ["Leaving"]
mikeX has joined #ocaml
tspier2 is now known as tspier2|Abwesend
kasv has quit ["Leaving"]
pauldia has quit [Read error: 110 (Connection timed out)]
joshcryer has quit [Client Quit]