sponge45 changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/
pango_ has joined #ocaml
danly has quit ["Leaving"]
delamarche has quit []
johnnowak has joined #ocaml
delamarche has joined #ocaml
pango has quit [Remote closed the connection]
Leonidas has quit ["An ideal world is left as an exercise to the reader"]
MisterC has joined #ocaml
smimou has quit ["bli"]
mbishop has quit ["leaving"]
Skal has quit [Connection timed out]
Smerdyakov has joined #ocaml
slipstream has joined #ocaml
delamarche has quit []
ziggurat has quit ["Leaving"]
rillig has quit ["exit(EXIT_SUCCESS)"]
mindCrime_ has joined #ocaml
sponge45 has joined #ocaml
malc_ has quit ["leaving"]
yondalf has joined #ocaml
Roughest has joined #ocaml
<Roughest> hay guys how do i call a method when an object is initialized
<Roughest> i.e. like a constructor
<Roughest> a.k.a. initializer
<Roughest> ah nevermind i can probably just do it differently...
<Roughest> hmmm no
<Roughest> The instance variable self
<Roughest> cannot be accessed from the definition of another instance variable
<stevan> Roughest: there is an initializer method
shawn has quit [Read error: 110 (Connection timed out)]
postalchris has quit [Read error: 60 (Operation timed out)]
delamarche has joined #ocaml
delamarche has quit [Client Quit]
sponge45 has quit ["zzzzzzzzzz"]
yondalf has quit [Read error: 110 (Connection timed out)]
Smerdyakov has quit ["Leaving"]
mbishop has joined #ocaml
bluestorm has joined #ocaml
bluestorm has quit ["Konversation terminated!"]
mbishop has quit ["brb"]
martin_ has joined #ocaml
martin_ is now known as mbishop
sponge45 has joined #ocaml
ikaros has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
slipstream-- has joined #ocaml
slipstream has quit [Read error: 104 (Connection reset by peer)]
pango_ has quit [Remote closed the connection]
pango has joined #ocaml
delamarche has joined #ocaml
delamarche has quit [Remote closed the connection]
delamarche has joined #ocaml
delamarc1e has joined #ocaml
yondalf has joined #ocaml
ikaros has quit [brown.freenode.net irc.freenode.net]
mbishop has quit [brown.freenode.net irc.freenode.net]
Roughest has quit [brown.freenode.net irc.freenode.net]
MisterC has quit [brown.freenode.net irc.freenode.net]
ramkrsna has quit [brown.freenode.net irc.freenode.net]
jacobian_ has quit [brown.freenode.net irc.freenode.net]
buluca has quit [brown.freenode.net irc.freenode.net]
seafood_ has quit [brown.freenode.net irc.freenode.net]
univac has quit [brown.freenode.net irc.freenode.net]
bebui has quit [brown.freenode.net irc.freenode.net]
love-pingoo has quit [brown.freenode.net irc.freenode.net]
pattern has quit [brown.freenode.net irc.freenode.net]
Oatmeat|umn has quit [brown.freenode.net irc.freenode.net]
Demitar has quit [brown.freenode.net irc.freenode.net]
levi_home has quit [brown.freenode.net irc.freenode.net]
delamarc1e has quit [brown.freenode.net irc.freenode.net]
slipstream-- has quit [brown.freenode.net irc.freenode.net]
ozzloy has quit [brown.freenode.net irc.freenode.net]
Shimei has quit [brown.freenode.net irc.freenode.net]
Hadaka has quit [brown.freenode.net irc.freenode.net]
sponge45 has quit [brown.freenode.net irc.freenode.net]
mahogny has quit [brown.freenode.net irc.freenode.net]
yondalf has quit [brown.freenode.net irc.freenode.net]
delamarche has quit [brown.freenode.net irc.freenode.net]
johnnowak has quit [brown.freenode.net irc.freenode.net]
seafood has quit [brown.freenode.net irc.freenode.net]
gim has quit [brown.freenode.net irc.freenode.net]
flux__ has quit [brown.freenode.net irc.freenode.net]
ulfdoz has quit [brown.freenode.net irc.freenode.net]
pingu has quit [brown.freenode.net irc.freenode.net]
DRMacIver has quit [brown.freenode.net irc.freenode.net]
mellum has quit [brown.freenode.net irc.freenode.net]
joshcryer has quit [brown.freenode.net irc.freenode.net]
Ugarte has quit [brown.freenode.net irc.freenode.net]
mattam has quit [brown.freenode.net irc.freenode.net]
cypher23 has quit [brown.freenode.net irc.freenode.net]
jdev has quit [brown.freenode.net irc.freenode.net]
pango has quit [brown.freenode.net irc.freenode.net]
mindCrime_ has quit [brown.freenode.net irc.freenode.net]
stevan has quit [brown.freenode.net irc.freenode.net]
ppsmimou has quit [brown.freenode.net irc.freenode.net]
revision17_ has quit [brown.freenode.net irc.freenode.net]
haelix has quit [brown.freenode.net irc.freenode.net]
Norgg has quit [brown.freenode.net irc.freenode.net]
_JusSx_ has joined #ocaml
ikaros_ has joined #ocaml
yondalf has joined #ocaml
delamarc1e has joined #ocaml
pango has joined #ocaml
slipstream-- has joined #ocaml
sponge45 has joined #ocaml
mbishop has joined #ocaml
Roughest has joined #ocaml
mindCrime_ has joined #ocaml
MisterC has joined #ocaml
johnnowak has joined #ocaml
levi_home has joined #ocaml
buluca has joined #ocaml
love-pingoo has joined #ocaml
ramkrsna has joined #ocaml
joshcryer has joined #ocaml
jacobian_ has joined #ocaml
seafood has joined #ocaml
bebui has joined #ocaml
seafood_ has joined #ocaml
univac has joined #ocaml
pingu has joined #ocaml
pattern has joined #ocaml
Oatmeat|umn has joined #ocaml
Demitar has joined #ocaml
ulfdoz has joined #ocaml
stevan has joined #ocaml
gim has joined #ocaml
Shimei has joined #ocaml
Hadaka has joined #ocaml
flux__ has joined #ocaml
ozzloy has joined #ocaml
DRMacIver has joined #ocaml
mellum has joined #ocaml
mahogny has joined #ocaml
ppsmimou has joined #ocaml
revision17_ has joined #ocaml
jdev has joined #ocaml
haelix has joined #ocaml
Norgg has joined #ocaml
Ugarte has joined #ocaml
mattam has joined #ocaml
cypher23 has joined #ocaml
triple_ has quit [Connection reset by peer]
triple_ has joined #ocaml
yondalf_ has joined #ocaml
yondalf has quit [Read error: 110 (Connection timed out)]
smimou has joined #ocaml
yondalf_ has quit ["leaving"]
sponge45 has quit ["zzzzzzzzzz"]
mikeX has joined #ocaml
smimou has quit ["bli"]
Leonidas has joined #ocaml
ikaros_ has quit ["Leaving"]
ikaros has joined #ocaml
johnnowak has quit []
love-pingoo has quit [Remote closed the connection]
love-pingoo has joined #ocaml
bluestorm has joined #ocaml
jacobian_ has quit ["Leaving"]
MisterC has quit [Remote closed the connection]
descender has quit ["Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good ed"]
love-pingoo has quit [brown.freenode.net irc.freenode.net]
pattern has quit [brown.freenode.net irc.freenode.net]
Oatmeat|umn has quit [brown.freenode.net irc.freenode.net]
Demitar has quit [brown.freenode.net irc.freenode.net]
Demitar has joined #ocaml
pattern has joined #ocaml
love-pingoo has joined #ocaml
Oatmeat|umn has joined #ocaml
swater has joined #ocaml
descender has joined #ocaml
Smerdyakov has joined #ocaml
cmeme has joined #ocaml
cmeme has quit [Remote closed the connection]
malc_ has joined #ocaml
cmeme has joined #ocaml
cmeme has quit [Read error: 131 (Connection reset by peer)]
cmeme has joined #ocaml
cmeme has quit [Remote closed the connection]
cmeme has joined #ocaml
jacobian_ has joined #ocaml
<jacobian_> can you have mutually recursive types in ocaml?
<bluestorm> yes
<bluestorm> using "and"
<mikeX> yes, type ... and ...
<bluestorm> (hehe)
<jacobian_> ah, great :)
<jacobian_> do people use ocaml instead of ML because of the quality of the compiled code?
<Smerdyakov> No. OCaml is far behind SML in terms of optimizing compilers.
<jacobian_> really?
<jacobian_> I guess I've heard that mlton has a very advanced optimizing compiler
<jacobian_> Is it features then?
<jacobian_> or library
<Smerdyakov> IMHO, people use OCaml either because OCaml had a head start in targetting "serious" development, so it has more libraries, etc., already written; or because they are just ignorant about all of the advantages of SML over OCaml!
<jacobian_> haha
<jacobian_> god thats life isn't it
<jacobian_> advertisment is everything
dark_light has joined #ocaml
<love-pingoo> there are also a few more features in OCaml: polymorphic variants, labels, objects
<bluestorm> Smerdyakov: are the advantages so interesting ?
<Smerdyakov> love-pingoo, all out of favor with a good portion of the ML community.
<jacobian_> I'm not a big object fan, but I like labels
<Smerdyakov> bluestorm, sure. Having an optimizing compiler alone is enough to settle the issue for me.
<love-pingoo> code in C ;)
<bluestorm> hm
<DRMacIver> OCaml's optimising compiler is pretty damn good isn't it? (Ignoring the quality of the SML optimising compiler for the moment)
<bluestorm> Smerdyakov: is it so difficult to increase the ocaml one ?
<Smerdyakov> OCaml doesn't have any optimizing compiler.
<bluestorm> hum
<Smerdyakov> So it is incorrect to speak of "increasing."
<bluestorm> ok
<bluestorm> so, adding one
<love-pingoo> well, it's about choices, too. ocaml is behind mlton because it cares about modular compilation
<bluestorm> jacobian_: i personally like object
<Smerdyakov> Writing an optimizing compiler is a huge amount of work, so, yes, it is difficult!
<love-pingoo> recompiling a project when you change just one module can be veeeery long with mlton
<Smerdyakov> love-pingoo, SML has a language standard and multiple compilers, several of which support separate compilation.
<DRMacIver> Huh? I though the main OCaml compiler was optimising...
<Smerdyakov> DRMacIver, nope. It is named poorly.
<DRMacIver> Am I just plain confused?
<Smerdyakov> DRMacIver, following the usual definition of "optimizing," which requires dataflow analysis.
<jacobian_> I read a paper on doing fold/unfold transformations on OCaML, and it seemed like it was very recent
<DRMacIver> Ah, I see.
<jacobian_> So it seems like it is being worked on
<DRMacIver> So 'optimising' has some special meaning in the context of a compiler? Because I'm sure it's the case that the ocaml compiler does perform optimisations.
<Smerdyakov> DRMacIver, it performs some "easy", local ones.
<DRMacIver> ok
<Smerdyakov> I don't think anyone would claim that the ocamlopt compiler makes any effort to "understand" programs.
<Smerdyakov> We usually require such an effort from an optimizing compiler.
<DRMacIver> I'm not making any claims. I'm just trying to understand what's going on. :)
<DRMacIver> My compiler-fu is very weak, and I'd like to fix that.
<jacobian_> do you concider loop-hoisting and such to be optimizing transformations?
<jacobian_> Or does it need to be something as non-trivial as deforestation
<Smerdyakov> Loop hoisting counts, surely.
<mellum> IIRC, Ocaml doesn't even do common subexpression elimination.
<Smerdyakov> If I were going to give a "doesn't even do," I would pick a simpler optimization than that. ;)
<mellum> Why would CSE be difficult?
<jacobian_> Do MLton compiled ML programs tend to be faster?
<mellum> across basic blocks, maybe. But not within
<Smerdyakov> jacobian_, yes, especially for large projects making good use of abstraction.
<jacobian_> mlton is commercial though isn't it
<jacobian_> how is sml?
<Smerdyakov> No.
<Smerdyakov> There are no commercial ML compilers left.
<DRMacIver> I'm vaguely surprised there were any to start with, but I admit my knowledge of ML's history is basically nonexistent.
<jacobian_> Harlequin had one
<DRMacIver> Although I guess I know people using ML in commercial applications, so I suppose it shouldn't shock me. :)
<jacobian_> at least until they turned into xanalys
mariano has joined #ocaml
mariano has quit [Remote closed the connection]
jajs has joined #ocaml
<DRMacIver> Hm. And now I'm reminded of one of the reasons I've been using OCaml rather than SML.
<DRMacIver> It's easier to make it work on my machines. :)
<DRMacIver> (The support for AMD64 architectures doesn't seem to have arrived yet)
<jacobian_> yeah
<jacobian_> I had to run a dual install to get twelf to compile
<DRMacIver> MosML works fine (I presume this is because it's written mostly in C or something like that. I've not investigated in detail). Neither MLTon nor sml/nj want to compile.
<mellum> well, you can always use an i386 binary
<DRMacIver> I suppose.
<DRMacIver> Bet it'll have problems though. :)
<mellum> why should it?
shawn has joined #ocaml
<DRMacIver> Mostly cynicism on my part.
<DRMacIver> Anyway, I'm trying it now and hoping to be pleasantly surprised. :)
<bluestorm> hm
<bluestorm> ok, so now that you learned MLton was doing global analysis, you're gonna switch ?
<bluestorm> tssk
<DRMacIver> Not really.
<DRMacIver> I've always preferred SML to OCaml from a purely linguistic point of view.
<bluestorm> ah
<bluestorm> hum
<DRMacIver> So I figure I'll give MLTon a try.
<bluestorm> i've not learned SML for now so i can't say anything about this
<bluestorm> but as an ML language it should be honest at least
<bluestorm> (as haskell is)
<DRMacIver> 'Honest'?
<bluestorm> hum
<bluestorm> i mean "good" ^^
<DRMacIver> Heh
<DRMacIver> Ok
<DRMacIver> There's not an awful lot in it to be honest. OCaml has a few more features. SML has slightly prettier syntax and is standardised.
<bluestorm> hum
<bluestorm> have you looked about the ocaml revised syntax ?
<DRMacIver> I think I looked at it a little bit. It seems to help.
<stevan> revised syntax?? where can I see this please?
<DRMacIver> (I'm mostly just biased by having learned SML first. :) )
<DRMacIver> Hm. I do still seem to be having trouble getting mlton to work. Looks like the issue is it can't find my 64bit libaries
<stevan> bluestorm: excellent, thank you
* DRMacIver gives up
<DRMacIver> I'm sure this is easy, but I can't be bothered right now.
<DRMacIver> Anyway, Haskell is the language of the future. </troll>
<DRMacIver> (And ghc compiles just fine on amd64 :) )
<bluestorm> hum
<bluestorm> i'm speaking with people worried by ghc compile time
<DRMacIver> Yeah, I've noticed that.
<DRMacIver> It takes its time for even quite trivial things.
<DRMacIver> It doesn't bother me too much.
<DRMacIver> But then I'm used to a ridiculous redeploy time at work. :-/
<DRMacIver> (I don't actually think Haskell is the language of the future, although it is pretty cool)
<stevan> Haskell has some nice parts, but simple mutability can be very practical at times
<stevan> and being able to do basic IO without the complexity overhead of monads is nice too :)
delamarc1e is now known as delamarche
jajs has quit ["Quitte"]
<flux__> smerdyakov, does mlton or smlnj provide "true" threads, which would run simultaneously on multiple cpus?
<Smerdyakov> flux__, I don't think so.
<Smerdyakov> flux__, I certainly wouldn't call that '"true" threads", though. It would be better if you called it "multiprocessing" or something.
<malc_> flux__: SML/NJ no, afaik threads are built atop of call/cc for MLTON yes
<malc_> and there's period missing in the above sentence
<tsuyoshi> hm.. does ocaml have true threads?
rillig has joined #ocaml
ikaros has quit [Remote closed the connection]
<tsuyoshi> I think I remember reading that they didn't want to put it in because of the garbage collector
<love-pingoo> the GC isn't parallel, so the execution of caml-threads is only one-at-once (the C code called from them can be executed in parallel, though)
<Smerdyakov> malc_, how does MLton achieve multi-core execution?
<tsuyoshi> c code called from them can be parallel.. hmm
<Smerdyakov> I thought it couldn't.
<tsuyoshi> love-pingoo: are there any plans to parallelize the gc, then? or is that off the table
<malc_> Smerdyakov: by virtue of utilizing pthreads for CML implementation
<love-pingoo> no idea, the technology exists but there might be some disadvantages
<tsuyoshi> I think if windows had fork(), then I wouldn't worry so much about this
<love-pingoo> for the C code: if you call from caml a long-running C function, it can call caml_leave/enter_blocking_section and do the intensive computation inside them (if it doesn't involve any caml value), the other caml threads will be able to run in parallel
<tsuyoshi> or better yet, if people would quit using windows...
<Smerdyakov> malc_, but that must mean there is a concurrent GC..?
<malc_> Smerdyakov: i wouldn't know
ikaros has joined #ocaml
<Smerdyakov> malc_, I don't think there is, so something must be wrong in the path to your conclusion.
<pango> such things exist... using one minor heap per thread to avoid expensive locking when allocating (but things gets harder when collection(s) happen...)
<Smerdyakov> pango, of course concurrent collectors exist, but it is a huge undertaking to multi-core-ready a language implementation, and I don't believe this has yet been done for any ML.
<pango> I think caml light GC was actually concurrent, but that was dropped with ocaml...
<malc_> blah multi-core shmulti-core.. smp was here forever
<malc_> the arrival of multi-core chips changes absolutely nothing
<malc_> #
<malc_> threads
<malc_> MLton has support for its own threads, upon which either preemptive or non-preemptive multitasking can be implemented. MLton also has support for Concurrent ML (CML).
<malc_> #
<malc_> so there, from the mouth of the developers
<Smerdyakov> malc_, that says nothing about using multiple cores (of which using multiple traditional processors is a special case, and so I use the more general term).
<malc_> oh for christs sake
<Smerdyakov> I think you are confused about the traditional definitions of the terms used in your quote.
<Smerdyakov> Again, the idea of "multithreading" is in no way connected to any hardware concept.
<Smerdyakov> "Multiprocessing" or something like that might express what you meant.
<Smerdyakov> And, just to be clear, you are retracting your original position now, despite the impassioned "oh for christs sake"? :)
<malc_> CML is implemented a top of MLtons thread package ergo one native thread, ergo one CPU will be used
<malc_> i stand corrected
<malc_> yes, i'm retracting my original position.. MLton is just as bad as the rest of the crowd, duh, now i can finally sleep well
<jacobian_> DRMacIver: Like I said, I had to do a dual install, one with 64bit libraries one with 32 bit libraries
<jacobian_> DRMacIver: I use dchroot so that I can host both at the same time
<jacobian_> It's a pain, but it is useful for anything that only runs 32
<Smerdyakov> 64-bit MLton is already available if you're interested. I just don't think they've made an official release yet.
<stevan> I am looking for an ocaml module/library/function which will pretty print any value it is given, similar to show in Haskell, any one know of one?
<Smerdyakov> stevan, obviously impossible to write in OCaml.
<stevan> Smerdyakov: why? not enough RTTI?
<Smerdyakov> stevan, I guess that's one way of saying it.
<Smerdyakov> You should be fair, though. Haskell doesn't have any such feature, either.
<mellum> well, the ocaml toplevel can do it... I think there are some hacks for this
<stevan> Smerdyakov: true, but show is pretty close
<Smerdyakov> Every type that may participate in generic printing must have a Show instance declared explicitly, possibly with help from 'deriving'.
<malc_> stevan: there was work in this area by Oleg Kislyov, Markus Mottl and Daniel de Rauglaudre
<stevan> hmm, what about just simple matching on types like int, string, etc?
<malc_> and you can do some funky stuff to that effect in gcaml and metaocaml.. but i digress
<stevan> :)
<tsuyoshi> in the ocaml book, in the chapter about interfacing with c, they provide an example of a function that prints out anything
<tsuyoshi> but it's limited because there really isn't much type information during runtime
<Roughest> ok lets say i want a function that looks something like "let f = ( *. ) 5.0" but i also want to make sure the result comes back as an int (i.e. apply int_of_float in there somewhere)
<Roughest> where do i put the int_of_float?
<DRMacIver> jacobian_: I do my utmost to avoid things which only have a 32bit version. It's just too annoying.
<Smerdyakov> Roughest, you won't be able to use a points-free notation for that unless you define a custom higher-order function first or some similar "cheat."
<DRMacIver> Smerdyakov: Thanks for the tip. I'll take a look at the 64-bit version some time.
<Roughest> bah
<mellum> Roughest: let f = fun x -> int_of_float (0.5 *. x)
<Smerdyakov> Roughest, function composition would suffice, but I don't think that's in the OCaml standard library.
<Roughest> aright thanks mellum, that works
<Smerdyakov> Roughest, hm, I assumed you knew that way to write it and were just looking for something shorter....
<Roughest> ... still stumbling my way around this...
<Roughest> nope ... big fat newb right here
<tsuyoshi> the shortest I think would be let f x = int_of_float (0.5 *. x)
<Roughest> tsiyoshi yup got it... didn't realize that's what Smerdyakov meant by higher-order function until i actually saw it :)
<Smerdyakov> It isn't.
<Smerdyakov> I meant:
<tsuyoshi> hmm? I think a higher order function would be a function that returns a function
<Smerdyakov> let compose f g x = f g x
<Smerdyakov> Er
<Smerdyakov> let compose f g x = f (g x)
<Roughest> doesn't "fun x -> int_of_float (0.5 *. x)" return a function though?
<Smerdyakov> let f = compose int_of_float ((*.) 0.5)
<mellum> Roughest: Sure it does. Isn't that what you want?
<tsuyoshi> oh you want it to return a function
<Roughest> right but no compose in OCaml?
<tsuyoshi> my mistake
<Roughest> yes, thanks mellum
<Smerdyakov> Roughest, I just wrote the definition of it. Maybe you mean not in the standard libary?
<DRMacIver> There seems to be a semi widespread opinion that excessive use of compose leads to unreadable code. I'm not sure why.
<pango> let f = let comp f g = fun x -> g (f x) in comp (( *. ) 5.0) int_of_float ;;
<Roughest> ... "readable" is a pretty relative term. Russian is not very "readable" to me, but that doesn't make it generally "unreadable"
<DRMacIver> Being relative doesn't mean that there aren't clearcut cases where something is either readable or it's not.
<jacobian_> Yeah
<jacobian_> like unlambda
<DRMacIver> Also life is not free of context, so relative terms are still important. Beauty may be in the eye of the beholder, but if you're butt ugly you're not going to make it as a model. :)
<DRMacIver> jacobian_: I was going to mention exactly that example. :)
<DRMacIver> Anyway, I have no problem with compose.
<Roughest> just keep us poor schleps coming form the imperative world in mind when you start composing left and right
* DRMacIver likes taunting you poor schelps coming from the imperative world, so that sounds like a perfect reason to use it. :)
<Smerdyakov> Roughest, I don't know if that's a serious suggestion, but in general I don't agree with requests to make engineering tools easy to use for people with insufficient training. :P
<Roughest> fair enough :P
<DRMacIver> (To be honest I have more experience with imperative programming than functional. I've just been doing the functional programming for longer.)
<mellum> really? you started with a functional language?
<DRMacIver> Yep
<DRMacIver> SML in fact.
<Smerdyakov> DRMacIver, went to school in Europe?
<mellum> Kinda unusual.
<DRMacIver> Smerdyakov: The UK.
* Smerdyakov guessed Scandanavia. :)
<DRMacIver> The compscis at Cambridge learn SML in one of their first courses, and I hung around with a lot of them.
<DRMacIver> So when it came time to do my computational project I turned my nose up at C and used ML instead. :)
<Smerdyakov> DRMacIver, so you're one of those deprived souls who didn't learn programming until university?
<DRMacIver> (I did maths)
<DRMacIver> Yep. I think I'd made some really half hearted attempts at it before, but it never grabbed my interest before then.
* DRMacIver is catching up at a reasonable pace. :)
trurl_ has joined #ocaml
<Roughest> okay here's another possibly dumb question...
<Roughest> i'm getting this:
<Roughest> The method print_data has type (int, 'a, 'b) Bigarray.Array1.t -> unit where
<Roughest> 'b is unbound
<Roughest> which i assume means it can't figure out the type of the Bigarray.Array1
<Roughest> how do i get around this, so that it know that it should be (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t
<malc_> Roughest: put it into signature let print_data (a : <type>) = ...
<Roughest> aha
<Roughest> thought i saw the ( a : <type> ) syntax before somewhere but couldn't dig it up in the manual
<dark_light> what is the lib that introduce #thread in toplevel?
<trurl_> I remember that in some situation there is a difference between e.g. the type (int * int) and the type int * int, or something like that. any idea what exactly that is?
<dark_light> trurl_, (int * int) is only one value, a tuple. int * int is two values, both integers
<malc_> dark_light: ocaml -I +threads #load "unix.cma" #load "threads.cma";;
<dark_light> malc_, hmm
<malc_> trurl_: when you define a type `type x = A of int * int' is different from `type x = A of (int * int)'
<dark_light> malc_, but i have #thread in my .ocamlinit, i don't know from which lib it comes.. hm
Roughest has quit [Remote closed the connection]
Roughest has joined #ocaml
<trurl_> malc_: can you give me a piece of code that does typecheck with the one type but not with the other?
<malc_> dark_light: there are two threads implementation VM and native, you have to pick one up when starting ocaml (bytecode hence _can_ use vm threads)
<dark_light> malc_, well, if -I +threads works, then fine, thanks
<malc_> np
<malc_> # type x = A of int * int;;
<malc_> type x = A of int * int
<malc_> # let x = A (1, 1) in match x with a -> print_endline "haha";;
<malc_> haha
<malc_> - : unit = ()
<malc_> # let x = A (1, 1) in match x with a, b -> print_endline "haha";;
<malc_> This pattern matches values of type 'a * 'b
<malc_> but is here used to match values of type x
<dark_light> this stuff is very bad :( it confused me early
* dark_light is starting to load by default graphics.cma, unix.cma, str.cma ..
<trurl_> malc_: well, that's because you forgot the constructor, isn't it?
<tsuyoshi> huh.. there's a difference between a, b and
<tsuyoshi> (a, b)?
<malc_> trurl_: no
<tsuyoshi> I didn't think there was
<trurl_> malc_: in the first part, a does match A (1,1), not (1,1)
<malc_> yes i stand corrected, here's working example:
<malc_> # type x = A of int * int;;
<malc_> type x = A of int * int
<malc_> # let x = A (1, 1) in match x with A (a, b) -> ();;
<malc_> - : unit = ()
<malc_> # let x = A (1, 1) in match x with A a -> ();;
<malc_> The constructor A expects 2 argument(s), but is here applied to 1 argument(s)
<dark_light> how can i load event module in toplevel? #load "event.cmx";; ?
<dark_light> there is no event.cma
<trurl_> I guess it's part of the threads package
<trurl_> malc_: thanks
<dark_light> well, fine, but one module per file
<malc_> dark_light: .cmo not .cmx
<malc_> .cmx is native object (so to speak)
buluca has quit ["Leaving."]
<dark_light> Cannot find file event.cmo.
<malc_> malc$ locaml -I +threads
<malc_> Objective Caml version 3.09.0
<malc_> # #load "unix.cma";;
<malc_> # #load "threads.cma";;
<malc_> # module M = Event;;
<malc_> module M :
<malc_> sig
<malc_> ...
<malc_> i.e. no need to load it
<dark_light> wow, M?
<malc_> just a phony name
<dark_light> didn't got why it comes with threads.cma
<malc_> .cma is a library with Mutex/Cond/Event etc stuffed in
<dark_light> but if works, that's fine too :) just another thing to write down in "the oddiest things about ocaml"
mikeX has quit ["leaving"]
<dark_light> malc_, i mean: why not a separated event.cma?
<trurl_> dark_light: btw, you can examine a .cma with ocamlobjinfo
swater has quit ["Quat"]
<malc_> dark_light: event depends on both mutex and condition anyway
<malc_> anyhow
malc_ has quit ["leaving"]
<dark_light> trurl_, it's on standard lib?
<trurl_> ocamlobjinfo? it's a commandline tool
<dark_light> ah
<dark_light> sweet
<dark_light> it uses a hash to check the module..? :o
swater has joined #ocaml
<dark_light> if i want to compile each file separated and then join all, what makes more sense, make them .cma or .cmo?
swater_ has joined #ocaml
Smerdyakov has quit ["reboot"]
Smerdyakov has joined #ocaml
mbishop has quit ["bbl"]
swater has quit [Read error: 110 (Connection timed out)]
dark_light has quit [Read error: 104 (Connection reset by peer)]
dark_light has joined #ocaml
<Roughest> do i have to declare Arrays as mutable or something?
<Smerdyakov> Arrays are mutable by definition.
<Roughest> i have an array of strings... doing String.blit into each string, and there's some weird ass stuff happening
<Smerdyakov> Strings are mutable by definition, too.
<Roughest> i don't have to declare each string in the array mutable do i?
<Smerdyakov> Strings are mutable by definition, too.
<Roughest> bah... ok i have to figure out exactly what's going on here before I can ask an answerable question :)
<Roughest> ooh weird
<Roughest> okay so I have:
<Roughest> let q = Array.make 5 (String.make 10 ' ');;
<Roughest> and let s = "12345"
<Roughest> now when I do
<Smerdyakov> You already screwed up in the first line.
<Roughest> right
<Roughest> why is every element in the array referring to the same string?
<Roughest> String.make returns a reference to a string, and that gets assigned to every element?
<Smerdyakov> Just think it through, keeping in mind that the compiler can't read your mind. :P
<Roughest> well, thinking it through, each element refers to the same string
<Roughest> so i have to actually loop through the array and create a string for each element
<Roughest> or rather use map or something along those lines
<Smerdyakov> Or look again at the signature of Array for something that does what you want more directly.
<Roughest> ah yeah... there it is right in the method signature docs :)
shawn has quit ["This computer has gone to sleep"]
<dark_light> when i try to compile server.ml with ocamlc into server.cmo and have in the same directory a player.cmi, will not the some.cmo instantly recognises the presence of Player module? I am getting this error: Error while linking server.cmo: Reference to undefined global `Player'
fik has joined #ocaml
<dark_light> but player.cmo was built in the same way, referencing to data.cmi, and had no problems..
<Smerdyakov> dark_light, this is just on a command line like "ocamlc server.ml"?
<Smerdyakov> Er
<Smerdyakov> dark_light, this is just on a command line like "ocamlc -c server.ml"?
<dark_light> no, ocamlc -I +threads -o server.cmo lib.cma server.ml
<dark_light> and player.cmo is build with same pattern
<Smerdyakov> Then, no, despite the fact that you are requesting a .cmo file as output, you haven't passed -c, so you are asking it to build a full bytecode executable.
<dark_light> Hmmmmmmm yes, it was odd when i see that +x mode. thanks
<Smerdyakov> Tip of the Day: Just use OCamlMakefile and don't worry about these details. :)
rillig has quit ["exit(EXIT_SUCCESS)"]
<dark_light> Smerdyakov, i don't know how to use, and i found creating makefiles from scratch a very intersting task. but i will try to look for this
<dark_light> my problem is: these makefiles generators seems very.. complex and, well, a bit like a hammer just to kill a insect
<dark_light> (very intersting because generally i can figure out how the files are depending on each other, what is very useful. sometimes i have cyclic dependencies)
<Smerdyakov> OCamlMakefile is very easy to use.
<dark_light> it is included in default installation?
<Smerdyakov> No.
<dark_light> Hmmm.. didn't seem to be included in ubuntu repositories as well
<Smerdyakov> I've never used it through any means but manual download and installation.
<dark_light> it is very intersting when a thing you planned to work just work. i was with *many* compilation problems (like "A and B makes inconsistent assumptions about C"), but when compiled, things just worked. i had never tested the code, just the components at toplevel, and it worked..
<dark_light> it's not very common, at least with me
<Smerdyakov> I didn't understand you.
<dark_light> generally my programs, when first run, has a few obvious bugs. it's not very common for when first compiling, everything runs smoothly, even in a tiny prototyp
<dark_light> e
<tsuyoshi> yeah
<Smerdyakov> OK...
<tsuyoshi> when I write something in ocaml, if I can get it to compile, it just works
<tsuyoshi> in c.. there are usually bugs
_JusSx_ has quit [Client Quit]
<tsuyoshi> and I have to spend more time debugging it than writing it in the first place
<Smerdyakov> That's nothing. Try writing your programs in Coq. :-)
<dark_light> in shell scripting, you know in advance that virtually no program you be free of bugs (but it still has it advantages)
<dark_light> will*
<Smerdyakov> I don't think shell scripting has a place, assuming that folks have taken the time to create the right infrastructure for a "real" programming language.
<dark_light> Smerdyakov, i develop in shell very fast, it's just for the things you will use today and no more (or the things you don't care if there are a hidden obscure bug)
<Smerdyakov> dark_light, you could develop more quickly with the right ML libraries.
<dark_light> but the shell has the pipe! and the sed, and find, and..
shawn has joined #ocaml
<dark_light> one time someone talked about a shell based on scheme that just implements the pipe.. but sh's pipe is just a very convenient one..
<Smerdyakov> All of those are easy to implement in ML.
<dark_light> but not so easy to type. find . -name *.mp3|xargs echo > mp3list.txt, is just very convenient
<Smerdyakov> You can definitely do that with camlp4.
<dark_light> of course i can do this in ML, but in shell it's just a tiny command
<dark_light> Smerdyakov, hmm.
<dark_light> the fact that the shell acts as both command interpreter and scripting language plays a big role too. i could just type this terminal. but, hm, yes, a camlp4 macro to implement pipes in ocaml would be just useful
<mellum> dark_light: but it will break if you have spaces or other funny characters in the file name :)
malc_ has joined #ocaml
<dark_light> mellum, well, i could just remove the xargs, i was only trying to find a example of pipe's brevity,
<tsuyoshi> camlp4 is difficult to understand
<tsuyoshi> it seems like it can do anything.. but it is not as easy as e.g. cl macros
<dark_light> one thing i just can't do is parsing HTML with sed, specially broken ones (gecko's engine does amazing things when rendering broken html), anyone knows a good library to work with "all flavors of html, even the ones that isn't actually html"?
<dark_light> tsuyoshi, well, i don't know both :(
<dark_light> uhmm, i will be away now, brb
johnnowak has joined #ocaml
<love-pingoo> dark_light: I'm sure I stumbled upon such a lib, but it was probably in java or python
<tsuyoshi> html parsing with sed? what
<tsuyoshi> that's... insane
bzzbzz has joined #ocaml
pango has quit ["Leaving"]
love-pingoo has quit ["Connection reset by pear"]
pango has joined #ocaml
<dark_light> tsuyoshi, ahahahaahahaha
<Leonidas> dark_light: I just saw one in python, using some kind of regex-voodoo magic to parse every crap containing things that look like tags ;)
<dark_light> can you paste a link?
<dark_light> i have no problem in learning python (and of course i want learn python)
<dark_light> is there any way to "peek" over a new incoming connection? Like, i want to reject some ips. for now i have to do Unix.accept, then verify the ip, and then do Unix.close for closing the forbidden ones, but i just want to just peek and do not accept, in first place, the connection for forbidden ones..
johnnowak has quit []
mbishop has joined #ocaml