flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
[R]ayne has joined #ocaml
[R]ayne has left #ocaml []
pants1 has joined #ocaml
pantsd has quit [Read error: 110 (Connection timed out)]
pants1 has quit [Read error: 60 (Operation timed out)]
darinm has joined #ocaml
<darinm> anyone know about an interface mismatch problem when trying to compile camlp5 with ocaml 3.10.2? I get the same problem (Error while loading "./pa_lispr.cmo": interface mismatch on MLast.) with both camlp5 5.08 and 5.09
pantsd has joined #ocaml
Associat0r has joined #ocaml
darinm has quit []
thelema has joined #ocaml
tar_ has quit ["byebye"]
davidm123 has quit ["ChatZilla 0.9.83 [Firefox 3.0.2/2008091620]"]
pantsd has quit [Connection timed out]
electronx has joined #ocaml
Submarine has joined #ocaml
Snark has joined #ocaml
Mr_Awesome has quit [Remote closed the connection]
Mr_Awesome has joined #ocaml
seafood has joined #ocaml
snhmib has quit ["Good riddance!"]
seafood has quit [Connection timed out]
bluestorm has joined #ocaml
bluestorm has quit [Client Quit]
electronx has quit []
johnnowak has joined #ocaml
Palace_Chan has joined #ocaml
olgen has joined #ocaml
<Palace_Chan> i seem to have a type error beginning in line 17 here that i dont know how to fix...it's only a "type" error so i figured somebody more experienced in ocaml could see it: http://pastebin.com/d6abfca1e
Palace_Chan has quit [Client Quit]
Palace_Chan has joined #ocaml
<olegfink> Palace_Chan: what's the (x y z) notation you use in lines 17-20?
<olegfink> my guess is that it should be a list construction similar to other cases in the match
<Palace_Chan> so yes, the other cases in the match are one, the diff is i give more than one there
<Palace_Chan> but the error i get when i compile
<Palace_Chan> is strange, it says: File "expressions.ml", line 40, characters 26-31:
<Palace_Chan> Syntax error
<olegfink> first of all, that's not a type error
<Palace_Chan> true
<Palace_Chan> but i then added
<olegfink> and as I already said, there isn't such notation in ocaml
<Palace_Chan> ::
<Palace_Chan> (as in the lower match cases)
<olegfink> so?
<Palace_Chan> that gives me: This expression has type 'a list but is here used with type X86lite.LInsn.t
<olegfink> could you paste the version you're currently working with? that would help a lot.
<Palace_Chan> which confuses me because apparently the overall return type is a list type
<Palace_Chan> that one gives me the type error
<Palace_Chan> in line 15 by the way
<olegfink> the first three cases in your match don't have a type of 'a list
<Palace_Chan> hmm which is what i apparently should be getting, you mean they need :: too ?
<Palace_Chan> although at the end of the match there is a ::
johnnowak has left #ocaml []
<olegfink> if I understood correctly, your match looks like this:
<Palace_Chan> i started getting that problem when i added the matches with more than one line today
<olegfink> LInsn.Add (esp, CImm 4l) :: ( the match ) :: :: accum_r
<olegfink> neverminf the double ::.
<Palace_Chan> yes
<olegfink> well, you know x::xs is a 'a list
<Palace_Chan> true, so that is why i added :: to the match cases with more than one line
<olegfink> but you can't use 'a list in the position of x
<olegfink> wrong, the whole match should have type X86lite.LInsn.t
<Palace_Chan> ohh, i have to use @ ?
<olegfink> no, your match shouldn't be of type list at all
<olegfink> otherwise the latter :: doesn't make any sense
<Palace_Chan> then there would be no way of getting those multi-lined match cases
<olegfink> there is.
<olegfink> turn the last :: into @
<olegfink> and surround any non-list cases in match with either [ ] or add ::[] after them
<Palace_Chan> so like line 17 for example ?
<olegfink> what's with line 17?
<Palace_Chan> ah surrounding with []....by last :: do you mean the last one in the multi-Insn cases ?
<olegfink> no, the one that is :: accum_r
<Palace_Chan> non-list cases would be those like line 9 ?
<olegfink> yes, just turn them into one-element lists
<Palace_Chan> let me give that a try
<olegfink> a saner option is to surround them with [...], a future-proof version (in case you'd want to add more instructions to them) is to add ::[] after
<olegfink> by the way, you miss that [] in multi-instruction cases too
<olegfink> remeber :: is 'a -> 'a list -> 'a list
<Palace_Chan> right, so a multiline needs [ and ] at the end with , separating the elements i guess
<olegfink> see, there are several ways to define a list
<olegfink> [1;2;3] is the most common
<olegfink> what you're trying to do is 1::2::3::[]
<olegfink> which is also possible
<Palace_Chan> oh semicolons..oops
<olegfink> do you study at penn?
<Palace_Chan> thanks for the help, yea
<olegfink> I wish we also had some ocaml courses here.
<Palace_Chan> it's not an ocaml course (which is why you can see how my ocaml SUUUCKS)
<Palace_Chan> it seems pretty nice but i need to actually try and learn it a bit more as in itself so i could appreciate it more (so far inrias manual has been all)
<olegfink> well, it's probably some compiler course, but you seem to be forced to use ocaml for X86Lite stuff
<Palace_Chan> yes indeed, its a compiler course
<Palace_Chan> wow it compiled
<Palace_Chan> took me a while to get use to ocaml types....at least less confused with stuff like 'a -> ('a -> 'b -> 'a list) -> 'a * 'a -> 'b etc....
<olegfink> they torture as with java here :(
<Palace_Chan> for compiler writing ?
<olegfink> as if.
<olegfink> just stupid java.
<olegfink> well, ocaml's type system is pretty much usual algebraic stuff.
olgen has quit []
<Palace_Chan> lol java, at the moment i have a much much harder time using ocaml than even C but i can see how its pretty neat if i had some more time to learn it properly
<olegfink> that's the point
<olegfink> when I started learning ocaml, I was quite familiar with C and sometimes ocaml made me cry
<olegfink> but nowadays I just can't do java properly -- it misses just everything! where's currying? higher-order functions? closures?
<Palace_Chan> they "taught" us ocaml in a day so i feel like im still hacking my way around it...i even feel happy when i go back to double pointers, pthreads and forking compared to not even understanding syntax errors
<Palace_Chan> did you use any resources aside the manual and stdlib to learn ocaml ?
<olegfink> but the bonus is, that once you fix your type errors you have very high chances that your code will work properly
<olegfink> hmm, I think I used my teacher a bit
<olegfink> we had an ocaml course in secondary school
<Palace_Chan> yea i guess, ill have to learn it some more as soon as i get rid of this compiler course
olgen has joined #ocaml
<olegfink> so the initial stuff - like understanding its type system and functional languages as a whole -- wasn't from a book for me
<Palace_Chan> functional languages as a whole...it's a leap from the usual way of thinking in C family and java and those
<Palace_Chan> like 2 weeks ago i would be in here asking about those 'a -> 'b -> etc.. chains
<olegfink> yeah, and I'm thankful this leap was done pretty early and having some people to talk to about those matters.
<olegfink> functional programming is a bit difficult to master if you're used to C, but then you'll miss every feature of it in an imperative language
<olegfink> when we were studying ocaml, we often wrote the program in C and then translate it to ocaml
<ozy`> that's weird
<olegfink> then we started learning java and tried to do the opposite, which was much more painful
<ozy`> translate ocaml into java?
<olegfink> yep.
<Palace_Chan> strange, like OO ocaml into java at least ?
<olegfink> I just can't get why do you need an explicit for loop if all you want is to print out your array's elements.
<ozy`> Java was designed with the mindset that starting with C++ and removing features would result in a more useful language
<olegfink> I don't mean literate translation, it's just that it's easier to think in functional programming for me these days
<ozy`> and since C++ doesn't have a way to distinguish automatically between a pointer and an array...
<Palace_Chan> easier ? interesting, as im new to ocaml it still sorta blows my mind...but mostly syntax wise for now since im so new to it
<olegfink> ozy`: ...java decided to hide pointers.
<ozy`> olegfink: and it didn't occur to its designers that that was the perfect opportunity to introduce useful array-specific syntax
<Palace_Chan> aight, it's like 5 am, thanks for the help ill go sleep a bit
<ozy`> because after all, the main goal was to remove features
Eridius has left #ocaml []
<ozy`> (at least, to remove language features, not implementation features)
<olegfink> see, people still prefer C with GObject for OOP
<olegfink> this pretty much proves that java has failed to be useful
<olegfink> coding mainly in java now, I still can't understand how it's possible
olgen has quit []
<Palace_Chan> why C with GObject rather than C++ ?
<olegfink> speaking of which, does ocamljava has the ability to call java methods?
<olegfink> Palace_Chan: _I_ have no idea. I tried to speak to some developers, they say it's more useful.
<ozy`> I've never heard of GObject
<Palace_Chan> C with GObject than C++ ? interesting
<Palace_Chan> i wonder why
<olegfink> ozy`: it's cfront take #2
<olegfink> another set of preprocessor macros to add classes to C
<ozy`> olegfink: never heard of cfront either...
<ozy`> don't worry though, I looked up GObject :p
<olegfink> cfront was the first implementation of what became C++
<ozy`> ahhh
<olegfink> it was a preprocessor emitting C
<Palace_Chan> anyways gnight
Palace_Chan has quit [Client Quit]
<olegfink> GObject is pretty much the same, unportable (it sort of works only with GCC), not even having its own preprocessor (uses cpp)
<ozy`> I knew that C++ used to emit C
<ozy`> but not what it was called in those days
<olegfink> the question of the day is, why do they had to stay with C syntax?
<olegfink> so the usual code in GObject looks like:
<olegfink> g_object_some_function_which_takes_some_params(g_some_caster(g_get_some_value(), g_some_type), g_get_value());
<olegfink> this time they didn't miss the opportunity to introduce new syntax, as their aim was to add classes to C
olgen has joined #ocaml
SanguineV has joined #ocaml
olgen has quit []
svenl has quit []
guillem has joined #ocaml
svenl has joined #ocaml
Yoric[DT] has joined #ocaml
<Yoric[DT]> hi
jlouis has joined #ocaml
romildo has joined #ocaml
<romildo> Hi.
<romildo> Is it possible to print a value of an arbitrary type in OCaml without writing a specific function for that?
jlouis has quit ["Leaving"]
Linktim has joined #ocaml
<thelema> romildo: not unless you accept memory dumps - the type of a value gets erased during compilation
<olegfink> romildo: see Printexc
<olegfink> but that uses Obj.magic
<thelema> The two bets options are: 1) use camlp4 to generate custom printing functions
<thelema> or 2) parse the binary image of a value and do your best.
hkBst has joined #ocaml
<romildo> olegfink, I do not see how Printexc can help. (Printexc.print fn x) applies fn to x and prints any exception that is raised.
Linktim_ has joined #ocaml
<olegfink> romildo: look at implementation
seafood has joined #ocaml
vpalle has joined #ocaml
Linktim has quit [Read error: 113 (No route to host)]
jlouis has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
vpalle has quit ["Leaving"]
seafood has quit [Client Quit]
Axioplase_ is now known as Axioplase
olgen has joined #ocaml
olgen_ has joined #ocaml
olgen has quit [Read error: 104 (Connection reset by peer)]
<romildo> How do I get a stack trace printed out when my program finishes with an unhandled exception?
<thelema> romildo: compile with -g and set environment variable OCAMLRUNPARAM=b
olgen has joined #ocaml
olgen_ has quit [Read error: 104 (Connection reset by peer)]
romildo has quit ["Leaving"]
Philonous has quit [Remote closed the connection]
Associat0r has quit [Read error: 104 (Connection reset by peer)]
Associat0r has joined #ocaml
olgen has quit []
Proteus has joined #ocaml
itewsh has joined #ocaml
Linktim has joined #ocaml
longh has joined #ocaml
subconscious has quit [Read error: 60 (Operation timed out)]
subconscious has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
thelema has quit [Read error: 110 (Connection timed out)]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
tomh has joined #ocaml
subconscious has quit [Read error: 104 (Connection reset by peer)]
subconscious has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
sporkmonger has quit []
Linktim_ has joined #ocaml
thermoplyae has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
itewsh has quit ["KTHXBYE"]
GustNG2 has quit ["Leaving."]
jlouis has quit ["Leaving"]
Submarine has quit ["Leaving"]
tomh has quit ["http://www.mibbit.com ajax IRC Client"]
sporkmonger has joined #ocaml
Snark has quit ["Ex-Chat"]
Amorphous has quit [Read error: 110 (Connection timed out)]
jlouis has joined #ocaml
Amorphous has joined #ocaml
tomh has joined #ocaml
delamarche has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
Linktim_ has quit ["Quitte"]
Demitar has quit [Read error: 110 (Connection timed out)]
Mr_Awesome has quit ["aunt jemima is the devil!"]
seafood has joined #ocaml
subconscious has quit [Read error: 60 (Operation timed out)]
longh has quit [Read error: 104 (Connection reset by peer)]
delamarche has quit []
jeddhaberstro has joined #ocaml
<Yoric[DT]> Yeah, we got our second Batteries Troll!
<jlouis> yay!
<dobblego> what's a batteries troll?
guillem has quit [Remote closed the connection]
jlouis has quit ["Leaving"]
tomh has quit ["http://www.mibbit.com ajax IRC Client"]
DroneZilla has joined #ocaml
DroneZilla has quit []
DroneZilla has joined #ocaml
Axioplase is now known as Axioplase_
DroneZilla has quit []
bohanlon has quit ["leaving"]
<Yoric[DT]> 'night everyone
Yoric[DT] has quit ["Ex-Chat"]