ChanServ 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
Miwong has joined #ocaml
<whee> is there any way to extract the value from a Some/None type other than matching it?
<MegaWatS> you can write a function for doing it, like
<MegaWatS> let get = function Some x -> x | None -> invalid_arg "get";;
<whee> yeah, okay
<steele> whee: there is no value in the None case ;)
<whee> my brain is a little fried today
<whee> been extending my program all day :D
<whee> only a 50 line increase in code though. weak :D
<whee> my lexer complexity skyrocketed though
Miwong has quit ["."]
<whee> is there an easy way to clean up a path with the Filename module or something?
<whee> like change /some/path/to/a/dir/./ to /some/path/to/a/dir/
MegaWatS has quit ["Oceania has ALWAYS been at war with Eastasia!"]
<mrvn_> whee: scan it
<whee> eh?
<whee> how would that work D:
<mrvn_> You split it into its poath elements and filter out any .
<whee> okay, that's what I ended up hacking into this
<whee> heh
<steele> cash has simplify_file_name
<mrvn_> Look for canonify or something
<whee> steele: I'd use cash but I'd like to not have external dependencies :\
<whee> if it ever makes it into the main dist I'd use it
mrvn_ is now known as mrvn
steele has quit [Remote closed the connection]
mrvn_ has joined #ocaml
mrvn has quit [Read error: 110 (Connection timed out)]
<whee> ermm
<whee> I have an interesting parser problem that just popped up, my parser is accepting anything that comes from the lexer and not raising any errors if the tokens don't match a form it should require
<whee> is that normal?
<whee> sigh. this is making no sense
Yurik has joined #ocaml
Yurik has quit [Remote closed the connection]
Yurik_ has joined #ocaml
Yurik_ has quit [Client Quit]
whee has quit ["Leaving"]
mattam has joined #ocaml
karryall has joined #ocaml
mattam has quit ["Lost terminal"]
two-face has joined #ocaml
<two-face> yo
<karryall> salut
<two-face> pas grand monde ici :) tous en weekend à la plage :)
<karryall> mouais ...
<karryall> two-face: y'a pas d'ocamlopt sur les mips ?
<two-face> karryall: non
<karryall> ah
<two-face> je suis en train de faire un snippet sur un bug que je n'arrive pas à comprendre
<karryall> dans ocamlsdl ?
<two-face> nan
<karryall> (ouf !)
<two-face> un bug dans un programme
<two-face> karryall: tu as 5 minutes stp ?
<karryall> ouaip !
<two-face> je peux paster du code ?
<karryall> bah oui je pense
<two-face> ok j'y vais
<two-face> foo.ml --------------------
<two-face> type a = [`a1 | `a2]
<two-face> type b = [a | `b]
<two-face> type -'a obj
<two-face> module F =
<two-face> struct
<two-face> external create : unit -> a obj = "create"
<two-face> external bar1 : [>`a] obj -> unit = "bar1"
<two-face> end
<two-face> class foo obj =
<two-face> object
<two-face> val obj = obj
<two-face> method ffoo = F.bar1 obj
<two-face> end
<two-face>
<two-face> foo.mli ----------------------
<two-face> type a = [`a1 | `a2]
<two-face> type b = [a | `b]
<two-face> type -'a obj
<two-face> module F :
<two-face> sig
<two-face> external create : unit -> a obj = "create"
<two-face> external bar1 : [>`a] obj -> unit = "bar1"
<two-face> end
<two-face> class foo : a obj ->
<two-face> object
<two-face> val obj : a obj
<two-face> method ffoo : unit
<two-face> end
<two-face>
<two-face> -----------------------
<two-face> voilà je ne comprends pas pourquoi il me fait une erreur de type
<karryall> ?
<karryall> tu t'enmeles pas un peu les pinceaux avec tes a tes `a
<two-face> bah [>`a] est un type ouvert non ?
<karryall> le bar1 il devrait pas etre [> a] ?
<karryall> c'est [> a], pas [> `a] que tu veux je pense
<two-face> attend, j'ai mal fait mon snipet
<two-face> remplacer [>`a] par [>`a1]
<karryall> ok
<two-face> mais toujours l'erreur
<pnou> type b = [a | `b]
<pnou> manque un `
<two-face> non
<two-face> c'est bien a , le type
<karryall> oui
<pnou> ha c'est le a du dessus
<pnou> c'est quoi l'erreur ?
<two-face> le mieux c'est de compiler
<two-face> The implementation foo.ml does not match the interface foo.cmi:
<two-face> Class declarations do not match:
<two-face> class foo :
<two-face> ([> `a1] as 'a) obj -> object val obj : 'a obj method ffoo : unit end
<two-face> does not match
<two-face> class foo : a obj -> object val obj : a obj method ffoo : unit end
<two-face> One parameter has type ([> `a1] as 'a) obj but is expected to have type a obj
<two-face> Type 'a is not compatible with type a = [ `a1 | `a2]
<pnou> c'est sympatique :)
<two-face> oui
<karryall> attends t'es sûr que bar1 toi prendre un type en [> truc] ?
<pnou> t'as essayé de lui faire pondre l'interface et de comparer ?
<karryall> d'ahbitude c'est dans l'autre sens ;)
<two-face> pnou: c'est possible ça ?
<pnou> oui ocamlc -i
<two-face> karryall: où ça ?
<pnou> ouais karryall mais là j'ai l'impression que c'est un problème technique plutôt qu'un problème de compatibilité de l'interface
<two-face> karryall: je veux que bar1 prenne en entree un type ouvert
<pnou> au fait ça sert à quoi le - devant le 'a ? j'ai jamais compris
<karryall> annotation de variance pour type abstraits
<pnou> oui mais ça veut dire quoi variant et contravariant ?
<two-face> pnou: du sous-typage
<karryall> bon ben c'est tout con en fait
<karryall> dans ta definition de classe
<two-face> si a :> b alors a obj :> b obj
<karryall> tu remplaces obj par (obj : a obj)
<two-face> karryall: ?
<two-face> où ça ?
<karryall> class foo obj =
<karryall> devient
<karryall> class foo (obj : a obj) =
<karryall> dans le .ml
<two-face> je teste
<two-face> ça marche
<two-face> karryall: pourquoi dois-je faire ça ?
<karryall> pour que ça marche ;)
<two-face> mais parce qu'il ne peut pas prendre de décision ?
<karryall> oui
<two-face> hmm
<two-face> karryall: il prend le type le plus général par défaut ?
<karryall> un truc comme ça oui
<two-face> très bien, merci bcp
<two-face> Je vais pouvoir tester mon interface Qt
<karryall> ohoh
<two-face> micro interface
<two-face> hello world :)
<karryall> comment t'as fait pour wrapper le C++ ?
<karryall> tu reconstruis les classes cote caml ?
<two-face> j'applatis toutes les méthodes
<two-face> en C
<two-face> + extern C
<two-face> mais je ne sais pas s'il faut que je recompile camlrun avec g++ comme un mail que j'ai lu de 1997
<karryall> ben essaye d'abord sans tout recompiler !
<two-face> oui
<two-face> mais pour l'instant c juste pour s'amuser, ya rien de très propre
<two-face> karryall: au fait il te reste quoi à faire opur que ocamlsdl soit complet ?
<karryall> pas grand-chose
<karryall> il reste un module YUV overlay par exemple
<karryall> mais bon je sais pas si ca interesse beaucoup de monde
<two-face> donc c'était 0.9 plutôt que 0.6 :)
<karryall> mouais si on veut
<karryall> je vais essayer de le faire marcher sous windows
<karryall> c'est pas encore ça :(
<two-face> erf
<karryall> je connais mal la progrmmation windows en plus
<two-face> moi aussi
<two-face> et en plus, çe ne me dérange pas :)
<karryall> :)
<two-face> comme ça je ne le mets pas sur mon CV
<karryall> pnou: alors ce magistere, ca roule ?
<pnou> rouler c'est beaucoup dire, disons plutôt que je survis :)
<karryall> t'as beaucoup de cours ?
<pnou> au début j'en avais cinq
<pnou> donc un d'info
<karryall> et le reste ? des maths ?
<pnou> mais j'ai laissé tomber l'info, les maths me prenait trop de temps
<pnou> ouais, mais je vais essayer de faire un peu d'info au second semestre
<pnou> sans doute de la logique informatique
<pnou> le prof d'info du cours que j'ai laissé tomber nous a fait tout un speech pour nous dire qu'il avait appris caml à leroy :)
karryall has quit [benford.freenode.net irc.freenode.net]
mrvn_ has quit [benford.freenode.net irc.freenode.net]
pnou has quit [benford.freenode.net irc.freenode.net]
Dybbuk has quit [benford.freenode.net irc.freenode.net]
lam_ has quit [benford.freenode.net irc.freenode.net]
xtrm has quit [benford.freenode.net irc.freenode.net]
two-face has quit [benford.freenode.net irc.freenode.net]
emu has quit [benford.freenode.net irc.freenode.net]
skylan has quit [benford.freenode.net irc.freenode.net]
Segora has quit [benford.freenode.net irc.freenode.net]
smkl has quit [benford.freenode.net irc.freenode.net]
two-face has joined #ocaml
skylan has joined #ocaml
emu has joined #ocaml
karryall has joined #ocaml
mrvn_ has joined #ocaml
Dybbuk has joined #ocaml
lam_ has joined #ocaml
xtrm has joined #ocaml
pnou has joined #ocaml
smkl has joined #ocaml
Yurik has joined #ocaml
<two-face> Yurik
<Yurik> re
<Yurik> two-face: hi
* Yurik has started $\mu$WEB development. OCaml is so good for such kinda program!
<Yurik> also OcamlNS partially supports module retrieval (not finished yet, anyway)
<two-face> no reaction from ocaml authors
<Yurik> about namespaces? yes. but i'm pretty happy w/ feedbacks and thanks from Alessandro
<two-face> ok
two-face is now known as two-face-away
<Yurik> it seems that ocaml authors are not interested in making ocaml an industry language, they are interested in their scientific researches. It is good too, however
zack has joined #ocaml
<Yurik> zack: hi
Yurik has quit ["later"]
<zack> hi
karryall has quit ["bye"]
zack is now known as zack|gnam
Yurik has joined #ocaml
<Yurik> re
docelic has joined #ocaml
two-face-away is now known as two-face
Yurik has quit [Read error: 104 (Connection reset by peer)]
Yurik has joined #ocaml
<Yurik> re
* Yurik has submitted early versions of OCamlBDB and OCamlGettext to caml-list
<two-face> i'm surprised there are so many packages need for a simple gettext interface
Yurik 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
<Yurik> nwo gettext is very simple in ocaml - few calls on locale and binding text domain
<Yurik> and then type `_"<some text>" and it will be gettexted
<Yurik> i mean _"<some text>" (w/ no `)
<two-face> yes
* Yurik is smoking Marlboro and drinking Obolon beer
<docelic> I suggest you try Cohiba "tabaco cubano" cigarettes :)) they stink like fertilizer and taste even worse.
<Yurik> what is fertilizer?
<docelic> animal shit you put around plants to grow better
<Yurik> ah
<Yurik> hehe
<docelic> on the pack I had, there was no indication of where they made them, and the tax mark was from Canarian Islands
<Yurik> hehe.. i usually smoke cigarettes produced here in Ukraine. And this Marlboro is not an exception. And tastes well.
<two-face> must optional arguments provide a default value?
<Yurik> yep
<two-face> hmm
<Yurik> if you want to make them true optional, use 'option' type ;)
<two-face> yes
<two-face> i was thinking of that
<Yurik> i do so
<Yurik> i suppose it is the only right way at this time to make arguments really optional
<two-face> yah
* Yurik is hearing that "Moonlighting" (about Moonlighting agency) is on air
<Yurik> w/ Bruce Willis
<Yurik> Bruce rules!
<two-face> ah, the young willis
<Yurik> yeah
* Yurik is away for TV :) cu later
Yurik has quit ["later"]
zack|gnam is now known as zack
docelic has quit [Remote closed the connection]
RichiH has joined #ocaml
two-face has quit [Remote closed the connection]
* RichiH looks around, greets mrvn_ and continues to idle
mattam has joined #ocaml
RichiH has quit ["trulala"]
Yurik has joined #ocaml
<Yurik> re
Yurik has quit [Read error: 104 (Connection reset by peer)]
skylan has quit [Read error: 104 (Connection reset by peer)]
systems has joined #ocaml
skylan has joined #ocaml
docelic has joined #ocaml
steele has joined #ocaml
whee has joined #ocaml
systems has left #ocaml []
spip has joined #ocaml
<whee> hey
<whee> is anyone familiar with how yacc operates? specifically, if it doesn't get any input that matches one if its patterns, does it just go and continue reading
<smkl> it should throw a parse error
<whee> mine doesn't appear to be doing that
<whee> :\
<smkl> yacc is sometimes hard to debug
<whee> bored enough to take a look?
<whee> the thing that gets me is that I really havent changed anything regarding what it parses and it was working perfectly
<whee> now it's just deciding to ignore any syntax problems
<smkl> ok
<whee> those are just the lexer/parser
<whee> and configuration files look like http://smaerty.ath.cx/Files/df.config
<whee> if I go and do something like "sort by extension hello I am having fun;" it goes and considers those extra words to be Latoms, doesn't read the semicolon, and exits
<smkl> does lexer work correctly?
<whee> and I'm not catching any exceptions it would throw so it should just abort
<whee> I believe it does
<whee> yeah it does, I did some testing of that one
<whee> although I think the Latom regexp could be a little more strict
<whee> should I be going and checking for syntax errors in the grammar with more grammar rules?
<whee> I just thought that yacc would die if something didn't match the rules, which would be good enough for me
<whee> oh you know what I think I see my problem
<whee> do the flags and flag rules look bad to you?
<whee> specifically where I put the EOS
<smkl> yes
TachYon25 has joined #ocaml
<whee> hrmf not it
TachYon25 has quit [Client Quit]
<smkl> does it have any conflicts?
<whee> nope
<whee> I guess I could throw in explicit checking for errors :\
<whee> it just seems extremely odd that when it gets an Latom as the first thing that it doesn't automatically die
<whee> because there's no way that would match any of those grammar rules
MegaWatS has joined #ocaml
RichiH has joined #ocaml
* RichiH waves
<RichiH> why doesn't
<RichiH> let rec revert x = match x with
<RichiH> |[] -> []
<RichiH> |x::n -> (revert n)@([x]);;
<RichiH> revert my string?
<RichiH> or my list, rather
<whee> it doesnt?
<whee> heh
<whee> # value rec revert = fun
<whee> [ [] -> []
<whee> | [x::xs] -> (revert xs) @ [x] ];
<whee> value revert : list 'a -> list 'a = <fun>
<whee> # revert [1;2;3;4];
<whee> - : list int = [4; 3; 2; 1]
<whee> might be quicker to use List.rev anyway :D
<RichiH> # let rec revert x = match x with
<RichiH> |[] -> []
<RichiH> |x::n -> (revert n)@([x]);;
<RichiH> val revert : 'a list -> 'a list = <fun>
<RichiH> # revert ['1','2'];;
<RichiH> - : (char * char) list = [('1', '2')]
<RichiH> #
<RichiH> List.rev?!?!
<RichiH> gah
<RichiH> # revert [1;2];;
<RichiH> - : int list = [2; 1]
<RichiH> hmm...
<whee> you used a comma in the first one
<whee> not a semicolon
<RichiH> what's the difference between '1','2' and 1;2?
<whee> which gets interpreted as a list of a single tuple
<steele> you're reverting a list with one element
<RichiH> *pling*
<steele> the tuple (1,2)
<whee> the revised syntax doesn't let you do that :D
* RichiH is so stupid
<whee> and this parser is pissing me off
<RichiH> whee: you cat be more confused by this than me ;)
<whee> I disagree
<whee> my parser is matching tokens with grammars that dont exist
<MegaWatS> hehe yeah the touple syntax can be kinda confusing
<MegaWatS> I think it should require parentheses around touples
<whee> it does in the revised syntax metawats
<whee> []'s are required around lists, ()'s around tuples, and a bunch more
<whee> it's really hard to get an ambiguiity
<MegaWatS> yeah but there are things about the revised syntax I don't like
<steele> ah, i wondered about the [x::xs]
<MegaWatS> like, for example, applying type constructors from the left
<MegaWatS> ie list char instead of char list
<whee> yeah that one gets me a couple times
<whee> but I can deal with that
<MegaWatS> IF you do it that way, I think, it should be list of char
<MegaWatS> the touple thing, however, I've gotten used to by now :)
<whee> hbaha my parser even accepts tokens that it has no rules for
<MegaWatS> anyway I don`t think it really matters - It`s just a good thing that you can use different syntaxes for ocaml
<mrvn_> so you can programs other people won't understand?
<whee> is there a better alternativeto yacc?
<MegaWatS> yeah it`s great for obfuscation X)
<MegaWatS> no, so different tastes can be met - synax isnt really what`s important after all
<steele> whee: you can use camlp4 for simple grammars
<mrvn_> But structure ist
<mrvn_> -t
<smkl> whee: your parser works fine here
<mrvn_> and having multiple syntaxes gets very confusing
<whee> it does?
<whee> what the
<whee> what ocaml version smkl?
<smkl> whee: 3.06
<whee> hrrrfmjd it's still accepting random input for me :|
<smkl> whee: perhaps you are catching all the execeptions
<whee> I'm catching Parsing.Parse_error and printing out the symbol_start and symbol_end but that's it
<whee> that line hasn't changed since I started and it did work at some point
<mrvn_> You still have to throw something further to make it stop.
<whee> the parser isn't even raising that exception though
<mrvn_> Do you have a rule for .?
<whee> no
<whee> geh I'll figure it out eventually
<whee> there probably is something wrong with my code that's hiding this and continuing
RichiH has quit ["The answer is 42 (the porpoise of life)"]
<whee> is there a way to turn a parser error into a line number in the actual source file?
<mrvn_> let line = ref 0
<mrvn_> "\n" => line := !line + 1; parse_token ()
<whee> then how would I get the line number into the exception raised by the parser on error
<mrvn_> exeption Parse_Error of int
<mrvn_> raise (Parse_Error !line)
<whee> right but then wouldnt I have to check for parsing errors manually
<whee> or is there some error rule for yacc tghat would handle this
<whee> s/tghat/that/
<mrvn_> whee: try parse () with Parse_Error -> printf "Parse Error in Line %d\n" !line
<mrvn_> !line will allways be around the current line.
<whee> my main problem is actually raising that exception
<whee> how could I get the parser to raise it on error on its own
<mrvn_> It should already.
spip has quit ["bye, ++"]
<mrvn_> TCW: das du das Packet auch in /afs/packets/ installieren kannst und nciht nur in /
<mrvn_> ups
TachYon25 has joined #ocaml
zack has quit [Read error: 113 (No route to host)]
magerquark has joined #ocaml
magerquark has left #ocaml []
docelic has quit ["later"]
Miwong has joined #ocaml
<Miwong> hello
<MegaWatS> hi
docelic has joined #ocaml
<whee> woo almost in a state where I can release
<whee> still need to find a new makefile that handles yacc and lex and all these files correctly though, my current one can't handle mixing revised and normal syntaxes :|
malc has joined #ocaml
<Miwong> whee: what are you writing??
<whee> working on dirfreak, a file sorting project: http://freshmeat.net/projects/dirfreak/
<whee> I just added configuration files (which includes matching by regular expressions), a basic unit system (for parsing 4MB or 3d8h2m)
<whee> it's helping me learn a bunch
malc has quit [Read error: 110 (Connection timed out)]
<Miwong> ah
gene9 has joined #ocaml
gene9 has quit [Read error: 54 (Connection reset by peer)]
Miwong has quit ["."]
Miwong has joined #ocaml
docelic has quit ["Client Exiting"]
TachYon25 has quit ["bez ki³y nie ma zaliczenia (z prawd studentek AM)"]
Kitam has joined #ocaml
<Kitam> hi!
<Kitam> is this an english speaking room?
<Miwong> yup
<Miwong> sup?
<Kitam> sup?
MegaWatS has quit ["Oceania has ALWAYS been at war with Eastasia!"]
divgrad has joined #ocaml
<whee> hooray for writing documentation
<whee> I should start commenting my .mli files so ocamldoc works too heh
graydon has joined #ocaml
Kitam has quit []