mbishop 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!)
r0bby has joined #ocaml
donny has quit [Read error: 110 (Connection timed out)]
TheLittlePrince has quit [Client Quit]
LordMetroid has quit ["Leaving"]
<palomer> someone remind me of the different ways to traverse a tree
<palomer> (the names)
<palomer> righto! depth first and breadth first
<jlouis> pre-order, post-order, in-order
<palomer> right!
<palomer> hmm, this is an n-ary tree
<palomer> inorder doesn't make much sense
bluestorm has quit ["Konversation terminated!"]
evn_ has quit []
evn has quit []
jonafan_ has joined #ocaml
<palomer> what's the best way to find out if a string can be parsed as an integer or as a float?
<palomer> try and catch an exception from of_string?
schme has joined #ocaml
jonafan has quit [Read error: 110 (Connection timed out)]
jonafan has joined #ocaml
jonafan_ has quit [Connection timed out]
thelema has joined #ocaml
<palomer> welcome back thelema
<thelema> been away for a while - busy lately
<thelema> (sadly not on ocaml)
<thelema> has anything interesting happened while I was away?
schme has quit [Remote closed the connection]
shortcircuit has quit ["Probably rebooting."]
shortcircuit has joined #ocaml
sniper4210 has left #ocaml []
<orbitz> hrm, the ocaml port for freebsd doesn't seem to compile a native compiler
<thelema> orbitz: what CPU?
<orbitz> athlon
<thelema> and you did 'make opt'?
<orbitz> i just used the port so I did make install clean
<orbitz> an ocamlc.opt was generated, but it does not seem to be native compiler
<thelema> huh. ocamlc.opt is the bytecode compiler as compiled into native code.
<thelema> so the native code compiler has to exist
<orbitz> well i'm compiling my app via ocamlc.opt -c foo.ml
<orbitz> and i'm only getting cmo files
<orbitz> and once i compile those to an actual program
<orbitz> it seems to run via ocamlrun
<orbitz> this is a sign that it is not the native version right?
<thelema> yup.
<orbitz> i will try it by hand to determine if the port is messed up
<thelema> is there an ocamlopt command?
<thelema> (or even ocamlopt.opt?)
<orbitz> i have both
<thelema> use ocamlopt to compile to native code.
<thelema> ocamlc <compiler source> => ocamlc
<thelema> err, bytecode compiler source.
<orbitz> what does ocamlc.opt mean then?
<thelema> ocamlopt <bytecode compiler source> => ocamlc.opt
<thelema> ocamlc <native compiler source> => ocamlopt
<thelema> ocamlopt <native compiler source> => ocamlopt.opt
<orbitz> oh ok, thank you, my mistake
<thelema> two versions (native/bytecode) of two compilers.
<orbitz> mmm so much faster
<orbitz> is there any interest at INRIA to give full stack traces on natively compiled applications?
<thelema> already implemented.
<thelema> (well, maybe not on all architectures, but x86 - yes)
<orbitz> oh excellent
<orbitz> in the current stable version?
<thelema> compile with -g and use export OCAMLRUNPARAM="b1"
<thelema> yes, in 3.10.2
<thelema> I think in 3.10 even
<orbitz> rockin!
<orbitz> i've asked this before but quite honesty i forgot the answer. If I want a functional-style map object, is there any implementation that is polymorphic so I could, for instance, write a generic key_list function to give me a list of keys in the map?
<thelema> the stdlib doesn't have that.
<thelema> (that = polymorphic map)
<thelema> you could pretty easily take the stdlib implementation and make one that uses Pervasives.(<) for compare
<thelema> err, Pervasives.compare even
<thelema> it shouldn't be difficult for your key_list function to take as parameters the/any needed function(s) from Map that it needs to use.
<thelema> anyway, time to go. Good night all.
<orbitz> night
thelema is now known as thelema|away
|Catch22| has quit ["To the best of my knowledge, I guess that I'm fresh"]
olleolleolle has joined #ocaml
olegfink has joined #ocaml
<olegfink> hi
<orbitz> hi
<olegfink> while playing with ocaml's C interface accroding to the manual:
<olegfink> $ ocamlc -custom -o test unix.cma test.ml lib.o
<olegfink> lib.c:(.text+0x14): undefined reference to `CAMLparam2'
<olegfink> etc.
<olegfink> where are those things implemented and why doesn't ocaml pick them up automagically?
<orbitz> i do not know
<olegfink> that's what I am following
<orbitz> did youg enerate teh cma?
evn has joined #ocaml
<olegfink> why do I need a cma?
<orbitz> the example son that page show the generation of a cma and linking against it
<olegfink> that's for dynamic linking, isn't it?
<orbitz> no
<orbitz> ocamlc -a -o mylib.cma -custom a.cmo b.cmo -cclib -lmylib
<orbitz> users of the library can simply link with mylib.cma:
<orbitz> ocamlc -o myprog mylib.cma ...
<orbitz> and the system will automatically add the -custom and -cclib -lmylib options, achieving the same effect as
<orbitz> ocamlc -o myprog -custom a.cmo b.cmo ... -cclib -lmylib
<olegfink> but "a complete example" section doesn't mention a need in a cma
<olegfink> I just need an executable linked with C code, what has cma to do with that?
<orbitz> your comamnd does no tmach it either
<orbitz> you ar eforgetting -cclib
<olegfink> I'm not using any external C libraries
<orbitz> ok
<orbitz> i don't know
bluestorm has joined #ocaml
olleolleolle has left #ocaml []
ikaros has joined #ocaml
mwc_ has joined #ocaml
oc13 has joined #ocaml
z[x] has joined #ocaml
olleolleolle has joined #ocaml
olleolleolle has left #ocaml []
love-pingoo has joined #ocaml
bluestorm has quit ["Konversation terminated!"]
filp has joined #ocaml
ygr has joined #ocaml
ygrek has joined #ocaml
z[x] has quit [Remote closed the connection]
LordMetroid has joined #ocaml
Linktim has joined #ocaml
Snark_ has joined #ocaml
ygrek has quit [Remote closed the connection]
Linktim_ has joined #ocaml
det has quit [Remote closed the connection]
Yoric[DT] has joined #ocaml
Linktim- has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
Linktim_ has quit [Read error: 110 (Connection timed out)]
mwc_ has quit ["leaving"]
yangsx has quit [Read error: 110 (Connection timed out)]
hkBst has joined #ocaml
Linktim- has quit [Read error: 110 (Connection timed out)]
Linktim- has joined #ocaml
magthe has joined #ocaml
Linktim- has quit [Remote closed the connection]
love-pingoo has quit [Read error: 110 (Connection timed out)]
RobertFischer has joined #ocaml
szell has quit [Remote closed the connection]
RobertFischer has left #ocaml []
RobertFischer has joined #ocaml
ygr has quit [Remote closed the connection]
love-pingoo has joined #ocaml
ygr has joined #ocaml
oc13 has quit [Read error: 110 (Connection timed out)]
Linktim has joined #ocaml
coucou747 has joined #ocaml
LordMetroid has quit ["Leaving"]
grom358 has joined #ocaml
ygr has quit [Remote closed the connection]
ygr has joined #ocaml
<Yoric[DT]> Is anyone familiar with Featherweight Java ?
<grom358> never heard of it
<thelema|away> Yoric[DT]: this featherweight java? http://citeseer.ist.psu.edu/igarashi99featherweight.html
thelema|away is now known as thelema
<Yoric[DT]> Yep.
<Yoric[DT]> I'm just wondering if it's close to something I already know: lambda-calculus, Abadi&Cardelli's Calculus of Objects, etc.
<thelema> I'm suspicious about a claim in any useful system of proofs that are "not only possible but easy"...
<Yoric[DT]> I need to give an appreciation to an application as lecturer, by someone who worked using Featherweight Java.
<Yoric[DT]> Since I'm not really familiar with the calculus, I was wondering if anything could be summed up in less than 5 lines.
<thelema> "There are three basic computation rules: one for field access, one for method invocation and one for casts" sounds like a ground-up design, specific to java.
<RobertFischer> Uh, I'm assuming those aren't the only computation rules.
<RobertFischer> I'd really like there to be some kind of branching structure.
* RobertFischer hasn't checked out the webpage...just confused by the quote.
<thelema> RobertFischer: does lambda calculus have a branching structure?
<RobertFischer> I have no idea.
<RobertFischer> Does it?
<RobertFischer> Looks like it does.
<thelema> It looks like lambda calculus does branching through piecewise function definition - like OCaml's function p1 -> e1 | p2 -> e2
<RobertFischer> What's the "casts" thing all about, though? How does that map onto lambda calculus?
<RobertFischer> Is that substitution?
<thelema> but I think it's able to handle even boolean logic without piecewise functions.
<thelema> no, I don't think their model maps to LC in a natural fashion.
<Yoric[DT]> IIRC, un lambda-calculus, branching is done by defining booleans.
Linktim_ has joined #ocaml
<Yoric[DT]> IIRC, true = ^x.^y.x, false = ^x.^y.y .
<RobertFischer> That's how Wikipedia reports it.
<Yoric[DT]> if e then p else q => e p q
<Yoric[DT]> and matching is more complex
Linktim_ has quit [Remote closed the connection]
oc13 has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
<Yoric[DT]> iirc, if you want to define branching piecewise, you need something like Amb
<Yoric[DT]> which is not standard lambda-calculus
szell has joined #ocaml
jdev has quit [Read error: 104 (Connection reset by peer)]
jdev has joined #ocaml
schme has joined #ocaml
thelema is now known as thelema|away
Morphous_ has joined #ocaml
grom358 has quit ["Leaving"]
det has joined #ocaml
OChameau has joined #ocaml
det has quit [Client Quit]
det has joined #ocaml
Morphous has quit [Read error: 110 (Connection timed out)]
Linktim has joined #ocaml
evn has quit [Read error: 104 (Connection reset by peer)]
Axioplase has joined #ocaml
<mfp> Yoric[DT]: TAPL says about Featherweight Java > "a contender for a minimal core calculus for modeling Java's type system. The design of FJ favors compactness over completeness almost obsessively, having just five forms of term: object creation, method invocation, field access, casting, and variables. Its syntax, typing rules, and operational semantics fit comfortably on a single (letter-sized) page. (...) FJ is only a little larger than the
<mfp> lambda-calculus or Abadi and Cardelli's object calculus, and is significantly smaller than other formal models of class-based languages like Java (...) FJ's main application is modeling extensions of Java (...) because the proof of type safety for pure FJ is very simple, a rigorous safety proof for even a significant extension may remain manageable."
<Yoric[DT]> thanks
<RobertFischer> Interesting assertion re: the correlation between simplicity and manageability.
<RobertFischer> (Not saying it's wrong. Just saying it's an interesting assertion.)
<Yoric[DT]> It's often true.
<Yoric[DT]> Not always, though.
<Yoric[DT]> I'd say Mobile Ambients are simple but essentially unmanageable.
det has quit [Remote closed the connection]
pango_- has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_- is now known as pango_
det has joined #ocaml
oc13 has quit [Read error: 110 (Connection timed out)]
|Catch22| has joined #ocaml
<RobertFischer> Yoric[DT]: I'd say that list processing is pretty simple, but LISP gets unmanageable pretty fast. And RISC assembly programming has a similar problem. On the other hand, the complexity of Rails is one of the things that makes web-apps on Rails get unmanageable pretty fast.
<RobertFischer> Hence, the interesting part of the interesting assertion.
schme has quit [Remote closed the connection]
bluestorm has joined #ocaml
schme has joined #ocaml
<Smerdyakov> Simplicity of language definitions does tend to correlate with manageability of proofs about those languages.
<Yoric[DT]> My remark was that Mobile Ambients are extremely simple but in this case, the simplicity of definition often gets in the way of provability.
<Smerdyakov> Which theorems are hard to prove?
<Yoric[DT]> It's not exactly that theorems are hard to prove. It's more that theorems are usually false, because the language is so very permissive, so finding out which subset of the language to use is hard.
<RobertFischer> Smerdyakov: Good point. We're talking about "proofs about those languages", not the use of the language per se.
<RobertFischer> Smerdyakov: I'd wandered off into a more general case.
Axioplase has quit ["bbl"]
pango_ has quit [Remote closed the connection]
<hcarty> Any suggestions on where to look when a program leaks memory that is not freed after the program exits?
<hcarty> The programs in question are written in OCaml, but use several C libaries. There is a memory leak somewhere, but to make matters worse the memory is not freed when the program exits.
<hcarty> I have never had this problem before in any language, so I'm not sure where to start
<petchema> you can use tools like valgrind to detect leaks on C side
<hcarty> petchema: I'm trying that now. It's taking a while due to the large amount of stuff shuffling around in ram.
pango_ has joined #ocaml
<hcarty> It also corrupts a ramdisk, which seems disturbing to me. But perhaps ramdisk ram isn't protected.
<petchema> tmpfs ?
<hcarty> /dev/ram allocated with ~550Mbytes and formatted to ext3
<petchema> unless you access /dev/ram directory, it's allocated in kernel space so non-root processes shouldn't be able to corrupt it
<petchema> s/directory/directly/
<petchema> btw, why use a journaled fs with a ramdisk?
<hcarty> Nope, all access is through the appropriate mount point.
<hcarty> I'm not the admin on the system, but I would guess habit
<petchema> that's silly
<hcarty> At this point, I just want to know how it is being corrupted. It seems very strange.
<hcarty> And the program which seems to do the corruption is running as a non-root user
ygr has quit [Remote closed the connection]
<hcarty> It may be an journal-on-ramdisk issue though. I've requested that it be changed to ext2 as a test.
Morphous has joined #ocaml
RobertFischer has quit []
RobertFischer has joined #ocaml
RobertFischer has left #ocaml []
RobertFischer has joined #ocaml
<RobertFischer> mn
Morphous_ has quit [Read error: 110 (Connection timed out)]
munga has quit ["Leaving"]
<orbitz> nm
RobertFischer has quit ["Taking off -- check out http://smokejumperit.com and http://enfranchisedmind.com/blog/"]
OChameau has quit ["Leaving"]
magthe has quit ["Ex-Chat"]
filp has quit ["Bye"]
oc13 has joined #ocaml
LordMetroid has joined #ocaml
Linktim_ has joined #ocaml
<olegfink> hi
Demitar has quit [Read error: 110 (Connection timed out)]
<olegfink> any pointer to a C binding /without/ ocamlmklib?
<Yoric[DT]> hi
<olegfink> I need an example (turned out I'm too dump to figure out what to do myself from the manual) of making a binding to C
* Yoric[DT] never tried, I'm afraid.
<olegfink> err, s/dump/dumb/
<olegfink> I've tried to literally follow the manual, and seems ocamlc doesn't provide something with CAMLreturn/CAMLparam/etc. stuff, so the C linker is unhappy
<det> You mean, how to compile it?
<olegfink> yep
<olegfink> or any working example
<olegfink> ocamlmklib is nice, but lacks mingw support
<det> ocamlmklib exists for mingw in 3.10, I thought
RobertFischer has joined #ocaml
<olegfink> hmm, the manual says it doesn't
<det> I could be wrong.
Demitar has joined #ocaml
<olegfink> no, it doesn't (at least for me 3.10 mingw setup)
<olegfink> *for my
Linktim has quit [Read error: 110 (Connection timed out)]
RobertFischer has left #ocaml []
RobertFischer has joined #ocaml
RobertFischer_ has joined #ocaml
RobertFischer has quit [Read error: 104 (Connection reset by peer)]
RobertFischer_ has quit []
musically_ut has joined #ocaml
vfdfdfvd has joined #ocaml
schme has quit [Read error: 110 (Connection timed out)]
smimou has quit ["bli"]
smimou has joined #ocaml
rwmjones_ has joined #ocaml
Snark_ has quit ["Ex-Chat"]
Chile` has joined #ocaml
<Chile`> are there any good resources around for design of large ocaml programs?
<bluestorm> Chile`: i think there has been some things about the ML module system
<bluestorm> to what i understood, SML and OCaml module system share a lot
<Chile`> so the OO features aren't used so much for high-level design?
<bluestorm> you can use OO features (with modules or not) but in my experience, the program is often structured around modules interfaces
<orbitz> it might take some time to get used to if you aren't an MLer, the type system is generally described as being far above most other languages
<orbitz> err modules system i mean
<bluestorm> Chile`: in the beginning of "Modern compiler implementation in ML" (Appel, iirc) there is a discussion about the modular structure
<bluestorm> it's done in SML but easily reproductible in OCaml
<Chile`> good deal, I'll check that out.
<bluestorm> Okasaki (Functional data structures) does design his datastructures through module interfaces too, but it's not really "large scale"
<bluestorm> there is some discussion about "huge programs" in Cardelli's "typeful programming" too, but it's not really about ML
<bluestorm> however, a good part of his ideas can be translated into the ocaml module system
<bluestorm> (and the subtyping parts may be interesting to object-oriented programmers too)
rwmjones_ has quit ["Closed connection"]
smimou has quit [Read error: 110 (Connection timed out)]
smimram has joined #ocaml
delamarche has joined #ocaml
<delamarche> Uh, stupid question. Is there a way to treat an input channel as a stream or list, such that I could map a function over every line?
<delamarche> This might be blasphemy, but I'm thinking about how I'd map a lambda over an open file generator in python.
<pango_> Stream.of_channel
<delamarche> brilliant, thanks pango_ !
<delamarche> I should have found that myself, I apologize.
<pango_> np
donny_ has quit [Remote closed the connection]
ecc has quit [Remote closed the connection]
delamarche has quit []
delamarche has joined #ocaml
delamarche has quit [Remote closed the connection]
smimram has quit ["bli"]
smimou has joined #ocaml
oc13 has quit ["Leaving."]
pango_ has quit [Remote closed the connection]
filp has joined #ocaml
pango_ has joined #ocaml
hkBst has quit ["Konversation terminated!"]
Jedai has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
pango_ has quit [Connection reset by peer]
bluestorm has quit ["Konversation terminated!"]
pango_ has joined #ocaml
pango_ has quit [Remote closed the connection]
Linktim_ has quit [Remote closed the connection]
vfdfdfvd has quit [Remote closed the connection]
pango_ has joined #ocaml
lordmetroid_ has joined #ocaml
lordmetroid_ has quit [Read error: 104 (Connection reset by peer)]
lordmetroid_ has joined #ocaml
filp has quit ["Bye"]
LordMetroid has quit [Connection timed out]
ikaros has quit ["segfault"]
coucou747 has quit ["bye ca veut dire tchao en anglais"]
evn has joined #ocaml
yangsx has joined #ocaml