rwmjones changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab Ocaml 3.10.1 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
Snrrrub has joined #ocaml
marmottine has quit ["Quitte"]
bzzbzz has joined #ocaml
Snrrrub__ has joined #ocaml
ita has quit ["Hasta luego!"]
kmeyer has quit [Remote closed the connection]
kmeyer has joined #ocaml
Snrrrub has quit [Read error: 110 (Connection timed out)]
dbueno has joined #ocaml
AxleLonghorn has joined #ocaml
thermoplyae has joined #ocaml
t345 has joined #ocaml
hsuh has joined #ocaml
Snrrrub has joined #ocaml
Snrrrub__ has quit [Read error: 110 (Connection timed out)]
t345 has quit ["o00p"]
psykon has joined #ocaml
psykon has left #ocaml []
postalchris has quit [Read error: 110 (Connection timed out)]
ReachingFarr has joined #ocaml
Associat0r has joined #ocaml
Associat0r has quit [Read error: 104 (Connection reset by peer)]
Associat0r has joined #ocaml
Associat0r has quit [Read error: 104 (Connection reset by peer)]
mwc has quit ["Leaving"]
Snrrrub__ has joined #ocaml
Snrrrub has quit [Read error: 110 (Connection timed out)]
jderque has joined #ocaml
thermoplyae has left #ocaml []
Jedai has joined #ocaml
jderque has quit [Read error: 113 (No route to host)]
kmeyer has quit [Remote closed the connection]
ziph has joined #ocaml
kmeyer has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
<ReachingFarr> Besides using a match expression is there a way to tell which constructor was used to create an object?
<flux> reachingfarr, well, barring the similar construct "function", no
<ReachingFarr> flux: can you think of a way to make this more concise? Without being able to tell which of those constructors was used I can't think of a better way of writing that, let alone how I might get the values out of the type. http://pastebin.com/d673d3c3c
<flux> reachingfarr, not by much: http://pastebin.com/m46ca615d
<flux> reachingfarr, another option would be to embed a function to extract that information into the data itself; a bit similar to object oriented programming ;)
<flux> reachingfarr, btw, whatcha doing?-)
<flux> generating c/c++/java-code?
<flux> hm, not java
<ReachingFarr> Javaish
<ReachingFarr> MiniJava
<ReachingFarr> It is for my compiler and programming language class.
<flux> oh
<ReachingFarr> I have to think there is a better way to write that.
<ReachingFarr> Just need to find it :-)
<flux> you could construct the data the other way around
<flux> type data = (var_type * id_type * kind) and kind = Var | StaticVar etc
<flux> (or use records)
<flux> how short is your goal?
<flux> I don't think that's awfully long anymore
<ReachingFarr> Unfortunately I don't have any control over the definitions.
<ReachingFarr> They are given to me. I just have to use them.
<flux> are you doing that particular matching often? you could write a function to return it in another structure
<flux> and if you would need many of such functions, you could use camlp4 to do that for you :)
<flux> (mind you, I've barely scratched camlp4, I wouldn't know how)
AxleLonghorn has left #ocaml []
<ziph> ReachingFarr, why not just extract the string construction in to a local function?
<ReachingFarr> ziph: How? What are you suggesting?
<ReachingFarr> flux: This should be the only function that has to deal with these constructors so....
seafood_ has quit []
<ziph> With a function defined within print_vars that has var_type and id as arguments (e.g. like "let outer n = let inner a = a * 2 in inner n;;")
<flux> reachingfarr, personally, I would be able to let go of the one case of a three-line function and go on coding ;)
<ReachingFarr> flux: I'm not to worried about the length. I just think there is probably a better way to do this and I would rather figure it out at the beginning of the course where it would do me the most amount of good.
<flux> reachingfarr, btw, I would perhaps use Printf.sprintf in your case
<ReachingFarr> These aren't actually printing. They return strings to a grading program that runs regular expressions on the output. It is kind of a bass ackwards assignment.
<ReachingFarr> We are taking an Abstract Syntax Tree and printing out concrete syntax.
<ziph> Do you have control over the AST?
<ziph> Or is the structure of it predefined for the assignment?
<ReachingFarr> predefined.
<ziph> Also, sprintf doesn't print to the screen, it returns a string.
<ziph> Is what I meant before.
<ziph> Except if you're doing a lot of it you might want a function to take a sequence of tokens and produce strings from them so you're not having to fiddle with strings too much in your AST walker.
middayc has quit [Read error: 104 (Connection reset by peer)]
filp has joined #ocaml
ttamttam has joined #ocaml
love-pingoo has joined #ocaml
ReachingFarr has quit ["Leaving."]
ygrek has joined #ocaml
ygrek_ has joined #ocaml
kmeyer has quit [Remote closed the connection]
kmeyer has joined #ocaml
ygrek has quit [Remote closed the connection]
alexp has joined #ocaml
hsuh has quit ["send me a log of that discussion"]
maayhem has joined #ocaml
<maayhem> hello
<maayhem> I have a strange problem. In one module I define a type somevar = int
middayc has joined #ocaml
<maayhem> in another module I use a variable of type somevar and print it as a %u
<maayhem> and then I have an error message: This expression has type Module.somevar but is here used with type int
<maayhem> the error started to appear when I started to use the Format module
<maayhem> I tried with and without opening the module where somevar is defined, same result
<maayhem> the strangest is that I fail to reproduce the error in the interactive loop
<maayhem> everything there goes well
<maayhem> but not in the compiled code.
<maayhem> any idea ?
<maayhem> its painful to me cause I cant print variables of type somevar
<flux> do you use module signatures?
<flux> are you comfortable with the module system, that is, you're aware that when you have a file foo.ml, you will always implicitly have a Foo-module also? So if you were to define module Foo within the file, its name would be Foo.Foo
<flux> I suppose opening persistently would fix that problem
<flux> also is your toplevel "clear" in the sense there aren't old bindings around confusing you?
<flux> I need to be gone right about now, good luck :-)
<maayhem> I tried opening persistently and it changed nothing, the toplevel is fresh from a $ ocaml
<flux> maybe you can put an offending test case online and someone else can take a look at it (or I can after about two to three hours or so)
maayhem has quit ["Leaving"]
hkBst has joined #ocaml
Tetsuo has joined #ocaml
<alexp> hi!
<alexp> Is anyone here from the organization team of the ocaml metting ?
<zmdkrbou> ask your question, maybe someone can answer it
<alexp> I just want to go to this meeting but registration is closed :( (I woke up late and I did'nt see the registration limit in the caml list)
<love-pingoo> it's likely that you can still join the conference, but maybe not the lunch/dinner
Mr_Awesome_ has joined #ocaml
<alexp> I got a bad message from Sylvain (which is the main contact for this meeting), that I can't register at all so no conference, nothing :(
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
koeien has joined #ocaml
<middayc> no conference?
Tetsuo has quit [Remote closed the connection]
Snark has joined #ocaml
Mr_Awesome_ has quit [Read error: 110 (Connection timed out)]
Mr_Awesome_ has joined #ocaml
sergez_ has joined #ocaml
Mr_Awesome_ has quit [Remote closed the connection]
gene9 has joined #ocaml
gene9 has left #ocaml []
asmanur has joined #ocaml
koeien has left #ocaml []
middayc has quit []
dramsay has joined #ocaml
<petchema> did someone use Camomile under Debian testing? Even using ocamlfind, "open Camomile" gets rejected with "Unbound module Camomile"...
postalchris has joined #ocaml
Mr_Awesome has joined #ocaml
ziph has quit [Read error: 104 (Connection reset by peer)]
ben has joined #ocaml
<love-pingoo> petchema: Camomile has changed its layout
<love-pingoo> CamomileLibrary is now the name of the toplevel module
<love-pingoo> I use module C = CamomileLibrary.Default.Camomile.CharEncoding for example
jlouis_ has joined #ocaml
dbueno has quit ["This computer has gone to sleep"]
jlouis has quit [Read error: 110 (Connection timed out)]
postalchris has quit ["Leaving."]
postalchris has joined #ocaml
<petchema> love-pingoo: aha, thanks, now it works
ttamttam has left #ocaml []
dbueno has joined #ocaml
Tetsuo has joined #ocaml
middayc has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
l_a_m has joined #ocaml
ben has quit []
ben has joined #ocaml
dbueno has quit ["This computer has gone to sleep"]
dbueno has joined #ocaml
bluestorm has joined #ocaml
ita has joined #ocaml
dbueno has quit ["This computer has gone to sleep"]
filp has quit ["Bye"]
postalchris has quit [Read error: 110 (Connection timed out)]
ita has quit [Remote closed the connection]
Demitar has quit [Read error: 110 (Connection timed out)]
postalchris has joined #ocaml
Morphous has joined #ocaml
Morphous_ has quit [Read error: 110 (Connection timed out)]
dbueno has joined #ocaml
postalchris has quit [Read error: 110 (Connection timed out)]
Morphous has quit ["shutdown"]
Amorphous has joined #ocaml
ttamttam has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
ttamttam has left #ocaml []
alexp has quit ["Leaving"]
Snark has quit ["Ex-Chat"]
Snrrrub has joined #ocaml
Snrrrub__ has quit [Read error: 110 (Connection timed out)]
Snrrrub__ has joined #ocaml
postalchris has joined #ocaml
ReachingFarr has joined #ocaml
<flux> cool, ocamlexc has been ported to 3.10.0, now I actually have a great incentive for upgrading :)
<flux> or, atleast an attempt..
dbueno has quit ["This computer has gone to sleep"]
Snrrrub has quit [Read error: 110 (Connection timed out)]
ben has quit []
ttamttam has joined #ocaml
asmanur has quit [Read error: 104 (Connection reset by peer)]
Yoric[DT] has joined #ocaml
_KS has joined #ocaml
ygrek_ has quit [Remote closed the connection]
postalchris has quit [Read error: 110 (Connection timed out)]
dbueno has joined #ocaml
<Yoric[DT]> Well, this week's conclusion regarding teaching OCaml: when students don't get it, raise the level.
<Yoric[DT]> (ok, it's actually a bit more complex, but the idea's there)
<bluestorm> :D
<bluestorm> this seems quite a bit oversimplified
<Yoric[DT]> Last year, I was faced with a class that didn't really get Java and I taught them dumbed down OCaml. They ended up not really getting OCaml.
<Yoric[DT]> This year, I am faced with a class that still doesn't really get Java, possibly worse than last year and I teach them actual OCaml. After 3 lectures, their level is better than last year's class at the end of the term.
<bluestorm> hm
<bluestorm> what is "dumbed down" OCaml ?
<Yoric[DT]> Now, the class itself may be better, but every one of them managed to get to the end of my exercises today.
<jonafan> maybe you're better at teaching this year
<bluestorm> (did you get the syntax experiment as far as teaching your student the revised syntax ?)
<Yoric[DT]> And they required currification, taking functions as arguments, producing functions as results, etc.
<Yoric[DT]> And yeah, I'm teaching them revised syntax.
<Yoric[DT]> (which will be a problem when it comes to documentation but should help in other places)
<bluestorm> it's interesting
<bluestorm> as i haven't heard of any revised teaching so far
<jonafan> although i find the same thing is true when i am learning something on piano
<jonafan> i'll focus on the first page for a while, and it won't really come together. then i'll move to the second page anyway, and the first page gets better
<bluestorm> still, what was your "dumbed down Ocaml" ?
<bluestorm> maybe a, say, more abstract point of view is better
<Yoric[DT]> "dumbed down" = little to no abstraction.
<Yoric[DT]> "as long as they don't understand functions properly, let's not have them return functions or take functions as arguments"
<bluestorm> hm
<Yoric[DT]> + no mathematical background
<bluestorm> maybe the abstract one is actually easier for students with maths background
<bluestorm> erf :D
<Yoric[DT]> (in the lectures, that was)
_KS has quit []
<Yoric[DT]> etc.
<Yoric[DT]> This year, I do teach them mathematical reasons for some choices inside OCaml (i.e. types as an approximation of sets, pairs as cartesian product, etc.), I show them mind-expanding examples, etc.
<Yoric[DT]> I haven't reached recursivity or sum types yet.
<Yoric[DT]> But the beginning is quite promising.
<Yoric[DT]> Especially for a class that definitely didn't grok Java.
<bluestorm> :p
<jonafan> what exactly do you teach and where?
postalchris has joined #ocaml
adema has joined #ocaml
<adema> hello
<bluestorm> hi
<adema> tiens par hasard, serais tu français bluestorm ? parce que ton pseudo me dit quelque chose :)
<adema> i've got a problem in caml :P
<adema> let k = ref Array.length(vect) in <- i get an error here
<pango> let k = ref (Array.length vect) in ... ?
<adema> arf ...
<pango> at least parenthesis around vect had no purpose
<adema> thx :o
<adema> ocaml syntaxe is very strange
<bluestorm> function application is f x
<bluestorm> not f(x)
<flux> of course, ((((f))((x)))) is the same thing :)
postalchris has quit ["Leaving."]
<Yoric[DT]> jonafan: it's supposed to be algorithmics, but it's actually programming, in Université of Orléans (Faculty of Bourges), in a curriculum of mathematics and computer science.
postalchris has joined #ocaml
<Yoric[DT]> adema: just remember that parenthesis, in OCaml, are only used to force priority, just like in mathematics.
<adema> ok :)
<Yoric[DT]> (well, in mathematics they're also often used for function application, in OCaml, that's facultative)
<Yoric[DT]> (oh, I'm forgetting tuples, well, forcing priorities and tuples)
<bluestorm> actually, in classical syntax, parenthesis around tuples are not mandatory
<hcarty> bluestorm: except in (fun (x,y) -> ...) which ends up biting me now and then
<bluestorm> i could say your case resumes to a priority question :-'
<hcarty> Probably... but that does not make it less confusing when it first happens
<bluestorm> :p
<bluestorm> are you aware of any use of Ocaml in linguistics ?
<cygnus_> is anyone here with ieee ? if so do you know when they send a month's magazine? at the start or after that month
<adema> i need some help again please :'(
<bluestorm> ?
<adema> it doesn't work, it's a problem of syntaxe again
<adema> :s
<bluestorm> hm
<bluestorm> you should indent your code
<adema> yep^
<bluestorm> ah
<bluestorm> if ... then begin .. end else
<bluestorm> no ; after that "end"
<bluestorm> as the syntaxic form is "if ... then ... else"
<bluestorm> these are not different expressions
<bluestorm> ; only separate expressions
<bluestorm> moreover
<bluestorm> you've got "incr i" for "i := !i + 1"
<bluestorm> (akin to i++ in C-like languages)
<adema> thx for incr, there is decr too ?
<bluestorm> yes there is
<adema> bluestorm, so there is never ; after end ?
<bluestorm> depends
<bluestorm> begin print_string "foo" end; begin print_string "bar" end
<bluestorm> i use a ; to separate the two expressions
<bluestorm> (if a then b else c) is only one expression, so no ; in the between
<adema> k
<adema> thx :x
<adema> it works now
dramsay has left #ocaml []
ttamttam has left #ocaml []
ReachingFarr has quit ["Leaving."]
jlouis_ has quit [Remote closed the connection]
jlouis has joined #ocaml
ita has joined #ocaml
<bluestorm> hm btw
<bluestorm> i've been thinking recently about a ["OCaml Language Sucks" Sucks] page
<bluestorm> (or any less provocating title)
dbueno has quit ["This computer has gone to sleep"]
<adema> bluestorm, can i have a condition in a for loop?
<bluestorm> yes you can
<adema> like in many other languages
<adema> how?
<adema> well not for to do if else done;
<adema> i want to stop the for if a condition is bot true
<adema> not*
<bluestorm> ah
<bluestorm> you have to use while instead
<adema> ok :)
<bluestorm> for doesn't stop
<adema> ok :)
<bluestorm> (you could use exceptions for that but that's not really good style, and you shouldn't bother with that at first)
<adema> well for stops when it's done^^
<adema> i know exception :)
<adema> (i know python very well, but ocaml is very disapointing)
<ita> adema: with the twt preprocessor ocaml can look like python
<adema> i will read about that
<ita> adema: ocaml has real closures and static typing, which makes it much more suitable for large software than python (i have a large python project, it is a pain)
<bluestorm> mbishop:
<bluestorm> it's interesting to see that most of the "Possible improvements" he suggests at the end are on the way
<mbishop> bluestorm: in what? revised syntax or something?
<mbishop> or future versions of ocaml?
<bluestorm> hm
<bluestorm> revised syntax
<bluestorm> documentation
<mbishop> ah
<pango> revised syntax is not "on the way"
<bluestorm> (it's not really "self-documenting" but ocamldoc is useful and used troughout the stdlib)
<bluestorm> backtraces
<bluestorm> (when raising exceptions)
<pango> it's been there for years, in parallel to traditional syntax
<bluestorm> we have « interactively list the contents of modules »
<bluestorm> pango: right
<bluestorm> one of his troubles with the interpreter (the type overriding and thus cryptic error message) is handled by a toplevel patch i saw on the web
<bluestorm> (Enthop or the other one building on top of it)
<pango> what he's missing is how important is region highlighting when an error message is displayed
<bluestorm> i think error reporting is a real issue, but unfortunately not easily solvable
<pango> it's often as important as the message itself
<bluestorm> (to what i know, people have tried to get it right for years, and people still complain)
<bluestorm> (iirc there was for haskell an intent of a specialized interpreter oriented towards pedagogy and error-reporting)
<pango> well, maybe they could be improved, but I wonder if there's not some intrinsic difficulty because traditional syntax has little redundancy
bluestorm has quit ["Konversation terminated!"]
<Yoric[DT]> Well good night everyone.
<Yoric[DT]> See you tomorrow if you're at the devdays.
Yoric[DT] has quit ["Ex-Chat"]
Snrrrub__ has quit [Read error: 110 (Connection timed out)]
adema has quit [Read error: 110 (Connection timed out)]
smimou has quit ["bli"]
thermoplyae has joined #ocaml
harlos has quit ["[BX] Mr. Rogers uses BitchX. Won't you be my neighbor?"]
Tetsuo has quit ["Leaving"]
l_a_m has quit [Remote closed the connection]
Demitar has joined #ocaml