mfp changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.11.2 released | Inscription for OCaml Meeting 2010 is opened http://wiki.cocan.org/events/europe/ocamlmeetingparis2010
Submarine has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
neorab has quit [Quit: Ex-Chat]
avsm has quit [Quit: Leaving.]
jonafan_ has joined #ocaml
jonafan has quit [Ping timeout: 248 seconds]
sepp2k has joined #ocaml
enthymeme has joined #ocaml
pad has joined #ocaml
jakedouglas has quit [Quit: Leaving.]
barismetin has joined #ocaml
pencilk has joined #ocaml
drk-sd has quit [Quit: {'EXIT', drk-sd, "bye"}]
mfp has quit [Read error: Connection reset by peer]
jakedouglas has joined #ocaml
mfp has joined #ocaml
fatalerrorx has joined #ocaml
<fatalerrorx> Hi
<fatalerrorx> i have two problems
<fatalerrorx> where can i get ocaml 3.11.2 for windows?
<fatalerrorx> where can i paste ocaml code?
eb4890 has quit [Remote host closed the connection]
<orbitz> ideone.com
<orbitz> second one was trivially found by looking at the ocaml website
<fatalerrorx> well thats on ocaml 3.11
<fatalerrorx> only*
<orbitz> touche salesman
<orbitz> might need to compiel from source
sepp2k has quit [Quit: Leaving.]
jakedouglas has quit [Read error: Connection reset by peer]
<fatalerrorx> I'm also having trouble compiling something Unbound module Path
<orbitz> do you need a specific .2 feature?
<fatalerrorx> not sure just wandering why its not there
<fatalerrorx> can you tell me why this line gives me an error? open Path (* ocaml/src/typing *)
barismet_ has joined #ocaml
<orbitz> it depend son teh error. Unbound module emans it cannot found the module
barismetin has quit [Ping timeout: 265 seconds]
<fatalerrorx> hmm so how can i tell it the module exists?
<orbitz> does the module exist?
<fatalerrorx> the code compiled on 3.08.s
<orbitz> that doesn't mean anything
<orbitz> Path module does not exist in my 3.10.0
<fatalerrorx> i see
<fatalerrorx> do you know where i can get it?
dark has joined #ocaml
<orbitz> where did you get it?
<orbitz> it's not there either
<fatalerrorx> oh nvm i figured it out :) thank for your help
barismet_ has quit [Ping timeout: 245 seconds]
barismetin has joined #ocaml
enthymeme has quit [Quit: dinner]
peddie_ has quit [Ping timeout: 246 seconds]
peddie has joined #ocaml
bzzbzz has quit [Quit: leaving]
fatalerrorx has quit []
valross has joined #ocaml
ccasin has quit [Quit: Leaving]
barismetin has quit [Quit: Leaving...]
joewilliams is now known as joewilliams_away
enthymeme has joined #ocaml
ulfdoz has joined #ocaml
pad has quit [Remote host closed the connection]
brooksbp has joined #ocaml
pencilk has quit [Remote host closed the connection]
myu2 has joined #ocaml
myu2 has quit [Remote host closed the connection]
myu2 has joined #ocaml
myu2 has quit [Client Quit]
myu2 has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 260 seconds]
ftrvxmtrx has joined #ocaml
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
enthymeme has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
pencilk has joined #ocaml
ulfdoz has quit [Quit: deprecated]
avsm1 has joined #ocaml
myu2 has quit [Remote host closed the connection]
ftrvxmtrx has joined #ocaml
oc13 has joined #ocaml
Submarine has joined #ocaml
avsm1 has quit [Quit: Leaving.]
jsk is now known as jsk-tea
ttamttam has joined #ocaml
avsm has joined #ocaml
ttamttam has quit [Quit: Leaving.]
jsk-tea is now known as jsk
oc13 has quit [Ping timeout: 260 seconds]
avsm has quit [Quit: Leaving.]
oc13 has joined #ocaml
leino has joined #ocaml
drk-sd has joined #ocaml
leino has quit [Read error: No route to host]
leino has joined #ocaml
spearalot has joined #ocaml
ikaros has joined #ocaml
pencilk has quit [Remote host closed the connection]
derdon has joined #ocaml
Lajla has quit [Ping timeout: 240 seconds]
<derdon> thelema: In the batteries module BatArray, the two printing functions print and sprint can be seen twice. how come?
krankkatze has quit [Quit: leaving]
Associat0r has quit [Quit: Associat0r]
sepp2k has joined #ocaml
ttamttam has joined #ocaml
<derdon> I seem to be too silly for using BatArray.print
<derdon> can someone please paste a simple example?
<derdon> I simply wanto to write an array to stdout for debugging reasons
<flux> the duplicity looks lke a bug in the documentation generation
<derdon> flux: nope, it's also in the code itself
<flux> let a = [|3|] let _ = BatArray.print (fun out x -> Printf.fprintf out "%d" x) stdout a
<derdon> thank you
<flux> (actually it's BatPrintf if you don't open Batteries)
<flux> (also stdout is perhaps something like Std.stdout)
<derdon> I thought it could have been possible without using own functions
<derdon> like "BatArray.print stdout my_array"
<derdon> does not work here :(
<flux> well, there is BatStd.dump
<derdon> I have an array of string lists
<derdon> good
<flux> it can be suitable for simple debugging purposes
<derdon> hm, I'm not sure if dump works properly
<derdon> can an array contain both string lists and strings?
<derdon> ah, I think I understand it now
valross has quit [Quit: Ex-Chat]
<derdon> if a string list contains only one element, this element is returned instead of a list containing this element
_unK has joined #ocaml
spearalot has quit [Quit: -arividerchi]
enthymeme has quit [Ping timeout: 246 seconds]
<flux> the answer to your question in nevertheles 'no'
<derdon> flux: I assumed so. dump behaves a bit odd then
<derdon> I don't like this behaviour
<hcarty> derdon: The BatFoo.print functions are for use with the BatPrint.*printf functions.
<hcarty> derdon: If you have the Batteries syntax extensions in use (specifically estring) then you can type "BatPrint.printf p"%{int array}\n" [|1; 2; 3|]" to have nice array printed output.
<hcarty> (BatPrint = Print if you "open Batteries" in your code, of course)
<derdon> hcarty: I don't know whether the Batteries syntax extensions are enabled
<derdon> hcarty: I installed ocaml-batteries with apt-get in ubuntu 10.04
<hcarty> derdon: This part of the estring syntax extension allows you to define your own printers for your own types and use them relatively easily
<hcarty> derdon: How are you using batteries? In the toplevel or from compiled code?
<hcarty> derdon: You need to use camlp4 and the batteries.pa_string.syntax findlib package to enable the extension I think
<hcarty> Or if you use the Batteries-provided toplevel initialization code that should provide you with the syntax extensions as well
jimmyb2187 has quit [Ping timeout: 265 seconds]
<derdon> hcarty: oh yes, the extensions are loaded in the toplevel
<hcarty> derdon: Then you should be able to do "Print.printf p"%{int array}\n" [|1; 2; 3|];;" and get something very similar to "[|1; 2; 3|]" as output
<hcarty> The "p" before the string is what tells the syntax extension to dig in and do its thing
<derdon> ok, I will try it
<hcarty> Most Batteries modules should support this (List, Hashtbl, etc.)
<derdon> hcarty: your example works well
<derdon> hcarty: but I don't know how to specify the type "array (list string)"
<derdon> if I try it like this, a Parse error is printed
<hcarty> derdon: You probably want "string list array" -- the toplevel gets messed up and uses revised syntax
<hcarty> when syntax extensions are loaded
<derdon> why does the toplevel behave different than regular *.ml files?
<hcarty> derdon: Something along the lines of "Print.printf "%{string list array}\n" my_value"
<hcarty> derdon: Not sure - it's a bug in some part of the system, either the toplevel, camlp4, findlib or the method Batteries uses to load the extensions
<derdon> yay, it works now!
<derdon> thanks a lot!
<hcarty> derdon: But only the types reported by the toplevel are affected - not the code you enter
<hcarty> You're very welcome, glad it works!
<derdon> hcarty: do I have to pay attention to anything when I compile the file because of the use of syntax extensions?
<derdon> hm, yes. "unbound value p"
<derdon> where is this value defined?
sepp2k has quit [Quit: Leaving.]
<hcarty> How are you compiling your program?
<hcarty> The syntax extension is defined in the batteries.pa_string.syntax
<hcarty> And camlp4o is needed
<derdon> wait a moment, I will paste the file
<hcarty> derdon: Are you using ocamlbuild?
<derdon> I use currently a simple bashscript which executes some commands
<derdon> no
<derdon> I use no buildsystem at all :D
<hcarty> Ah, ok - if you paste the bash script to a pastebin that should help
<hcarty> :-)
<derdon> so I use ocamlfind for the ml files where the batteries are used
<hcarty> derdon: Strange - that site isn't resolving for me
<hcarty> Nevermind
<derdon> I can use a different paste service
<hcarty> Try adding this to your ocamlfind lines: -package batteries.pa_string.syntax -syntax camlp4o
bzzbzz has joined #ocaml
<hcarty> I think that is what you need
ccasin has joined #ocaml
<derdon> ok
<derdon> ocamlfind says the META variable 'preprocessor' must be set
<derdon> how do I set META variables?
<derdon> does it have something to do with Makefiles?
jimmyb2187 has joined #ocaml
<hcarty> derdon: I'm not sure - I normally do this with ocamlbuild :-)
<hcarty> I thought that the "-syntax camlp4o" would do that part...
<hcarty> This works for a simple test file on my system: "ocamlfind c -syntax camlp4o -thread -package batteries,batteries.pa_string.syntax -linkpkg test.ml"
<hcarty> I suppose the order of arguments may matter
<hcarty> Though it doesn't seem to for this
<hcarty> derdon: Can you pastebin your new compilation script?
<derdon> yes
<derdon> oh, wait
<derdon> do I have to pass the option "package" twice?
<derdon> once for the batteries in general and once for the syntax extensions?
<hcarty> derdon: Yes, or include the packages together as "-package batteries,batteries.pa_string.syntax"
<derdon> I see. I'll the use the comma-seperated version
<derdon> hcarty: the error messages appear after executing the bash script
<flux> derdon, what's there not to like about that behavior?-o
<flux> in any case, Std.dump is strictly for debug tracing purposes
<flux> oh, I misread
<flux> yes, that can be a bit annoying. but in other cases it's nice that it cleans up the output like that.
<flux> well, that's what I imagine anyway. I haven't really used it.
<derdon> flux: I want the function dump to behave like the usual output of the REPL when I enter a value
<derdon> oh, I forgot this line 102 where the error is detected
<derdon> printf p"%{array (list string)}\n" my_array
<derdon> hcarty: ha! you lied! :P
<derdon> hcarty: I have to write "string list array" as the type, even in the ml-file
<derdon> hm, no
<derdon> different error messages
<hcarty> derdon: :-) - No, I meant the type reported by the toplevel gets changed
<derdon> hcarty: oh, nerver mind
<hcarty> If you enter [1;2;3] in the toplevel, it will tell you it's a list int rather than an int list (if you are using a syntax extension)
<derdon> I see
<derdon> and how can I avoid my "new" problem?
<hcarty> derdon: Are you using Print.printf or Printf.printf?
<hcarty> You need to use Print.printf and from the look of the error you are using Printf.printf
<derdon> Printf.printf
<hcarty> That's the error then :-)
<derdon> okay, I am really confused by the huge amount of functions which look that similar
<hcarty> derdon: Yes, there is definitely a lot of overlap
<flux> derdon, well, you're not going to have it, sorry :)
<flux> derdon, toplevel has secret information that's not available for programs
<hcarty> derdon: The easiest way to think about it is that the Print module is a replacement for the Printf module, but rather than using using OCaml's built-in printf-like string interpolation, it uses the pa_string syntax extension to create a more flexible/more easily extensible printing mechanism
<flux> ..that's pretty exact way of looking at it, aswell?
<derdon> now it really works =) thanks again, guys!
<hcarty> flux: Probably so
patronus has quit [Ping timeout: 240 seconds]
<hcarty> derdon: Excellent, glad to hear it
<derdon> flux: are you one the authors of the batteries?
<flux> I guess strictly speaking that is correct, there is some of my code in Batteries..
<derdon> so you're not an official dev of them but a contributor who spent much time for it
barismetin has joined #ocaml
<flux> correct, except not a lot of time :)
rgrig has joined #ocaml
vpalle has joined #ocaml
jakedouglas has joined #ocaml
joewilliams_away is now known as joewilliams
patronus has joined #ocaml
rovar has joined #ocaml
ttamttam has quit [Quit: Leaving.]
itewsh has joined #ocaml
avsm has joined #ocaml
avsm has quit [Client Quit]
avsm has joined #ocaml
jonafan_ is now known as jonafan
jimmyb2187 has left #ocaml []
ftrvxmtrx has quit [Quit: Leaving]
itewsh has quit [Quit: There are only 10 kinds of people: those who understand binary and those who don't]
fraggle_ has quit [Quit: -ENOBRAIN]
rgrig has quit [Quit: Leaving]
leino has quit [Quit: leaving]
fraggle_ has joined #ocaml
fraggle_ has quit [*.net *.split]
fraggle_ has joined #ocaml
vpalle_ has joined #ocaml
dark has quit [Read error: Connection reset by peer]
vpalle has quit [Ping timeout: 260 seconds]
brooksbp_ has joined #ocaml
brooksbp has quit [Ping timeout: 268 seconds]
drk-sd has quit [Quit: {'EXIT', drk-sd, "bye"}]
ftrvxmtrx has joined #ocaml
oriba has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
vpalle__ has joined #ocaml
jimmyb2187 has joined #ocaml
vpalle_ has quit [Ping timeout: 240 seconds]
rovar has quit [Ping timeout: 265 seconds]
avsm has quit [Remote host closed the connection]
sepp2k has joined #ocaml
brooksbp_ has quit [Quit: Leaving...]
itewsh has joined #ocaml
drunK has joined #ocaml
_unK has quit [Ping timeout: 260 seconds]
ikaros has quit [Quit: Leave the magic to Houdini]
thieusoai has joined #ocaml
_unK has joined #ocaml
drunK has quit [Ping timeout: 240 seconds]
alpounet has left #ocaml []
boscop__ has joined #ocaml
boscop_ has quit [Ping timeout: 260 seconds]
segmond has quit [Ping timeout: 265 seconds]
ygrek has joined #ocaml
<derdon> can I set variables global within functions?
<derdon> or is the only possible solution to pass this value on to other functions which need it?
<hcarty> derdon: Passing values is generally the cleaner approach. You can modify a global reference if you really want to though.
<hcarty> Insanity and despair lie down that road though :-)
vpalle_ has joined #ocaml
vpalle__ has quit [Ping timeout: 245 seconds]
<derdon> hcarty: but not when the reference is declared locally in a function
vpalle__ has joined #ocaml
vpalle_ has quit [Ping timeout: 258 seconds]
rovar has joined #ocaml
<flux> derdon, the scope of variables is purely lexical
<flux> so a variable definition cannot escape its scope
<derdon> flux: I see
<derdon> I have to see this as an advantage
<flux> it is. when you are reading the code :)
<derdon> yes
<derdon> and when someone tries to debug it
drk-sd has joined #ocaml
gareth_0 has joined #ocaml
<gareth_0> hi
<adrien> =)
vpalle_ has joined #ocaml
<gareth_0> would be it be an accurate assertion that objects can make ocaml more concise because of not having to type out module names, but that the large infered types are more difficult to debug and type constraints are often needed for polymorphism?
barismetin has quit [Remote host closed the connection]
<gareth_0> this would explain the slight disdain i detect for object, maybe?
<flux> I think the disdain is more due to the mindset of thinking functionally than thinking imperatively - which objects in most cases make you do.
<flux> by sending commands to objects you change their state
<flux> that being said, ocaml does provide nice support for immutable objects
<flux> and otherwise ocaml's object system is quite neat, even though it does need, as you said, some type annotations at times
ygrek has quit [Ping timeout: 245 seconds]
<gareth_0> i see
vpalle__ has quit [Ping timeout: 240 seconds]
<flux> I personally will happily use object system and especially so if it is the nice solution for the problem (for example I need to use inheritance or other form of polymorphism that are nice with objects)
<flux> oh, and it's nice that it does reduce the Foo.Bar.Baz-notation quite a bit aswell
<adrien> my main reluctance with objects is that it makes type-checking somehow weaker and sometimes I have troubles finding the error
<flux> another practical aspect: objects aren't as fast in ocaml as modules are. so that might matter if you do small things that get called a lot (say, lexers and big files)
<flux> I wouldn't say it makes it weaker. you will want to annotate your codes at places to avoid unwieldly error messages though. practice, practice ;)
<adrien> I always end up annotating, but I'm not used to ;-)
<flux> with the new first class modules support in 3.12 it might be that objects have even less use than they used to, though..
<flux> basically what I have had is one module per one bigger class anyway (unless the classes are heavily related)
<gareth_0> do you think polymorphic records would be useful?
<gareth_0> you could pattern match over them, unlike objects
<flux> what kind of records do you mean? like the ones in SML?
<flux> there are some pattern matching syntax extensions for objects..
gareth_000 has joined #ocaml
gareth_0 has quit [Ping timeout: 248 seconds]
ccasin has quit [Quit: Leaving]
<det> objects cant express some useful things that modules can
vpalle__ has joined #ocaml
gareth_000 has quit [Ping timeout: 246 seconds]
barismetin has joined #ocaml
vpalle_ has quit [Ping timeout: 258 seconds]
vpalle__ has quit [Ping timeout: 240 seconds]
Associat0r has joined #ocaml
fschwidom has joined #ocaml
gareth_000 has joined #ocaml
virtuoussin13 has joined #ocaml
oc13 has quit [Ping timeout: 240 seconds]
oriba has quit [Quit: Verlassend]
ReachingFarr has joined #ocaml
segmond has joined #ocaml
<ReachingFarr> So I have some .cmo files in a directory that has a relative path of "../frontend" from where I'm trying to compile a program that uses those objects. I passed "-I ../frontend/" to ocamlc, but I'm still getting a "Reference to undefined global" error. What am I doing wrong?
enthymeme has joined #ocaml
gareth_000 has quit [Ping timeout: 258 seconds]
virtuoussin13 has left #ocaml []
seg_ has joined #ocaml
segmond has quit [Ping timeout: 252 seconds]
<derdon> this script causes the error message "Error: unbound value bar" in line 2: http://bpaste.net/show/6259/
<derdon> can someone explain me why?
<Submarine> that's normal
<Submarine> bar is not defined before being used
<derdon> are the parts right of the arrow of a pattern matching restricted in any way?
* derdon head -> table
<derdon> omg
<derdon> Submarine: it seems that it's not my day today :S
<derdon> ok, I have to use "let foo = ... and bar = ..."
<derdon> no, it's "let rec foo = ... and bar = ..."
Anarchos has joined #ocaml
itewsh has quit [Quit: There are only 10 kinds of people: those who understand binary and those who don't]
Submarine has quit [Quit: Leaving]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
vpalle has joined #ocaml
<ReachingFarr> Can anyone help me compile this stupid file? It needs some objects from another directory and I can't get ocamlc to find them.
<derdon> ReachingFarr: have you already tried an absolute path?
<ReachingFarr> derdon: I would prefer a solution that didn't involve an absolute path. It's not like everyone is going to be compiling this code in the same place.
<derdon> ReachingFarr: answer the question, my friend ;)
<ReachingFarr> I have not used absolute paths, no.
<derdon> ReachingFarr: do you really from where ocamlc starts the search in case of relative paths?
<mfp> ReachingFarr: are the corresponding .cmi also in ../frontend?
<ReachingFarr> Well, I would think it would start from the pwd, and then continue on with the directories passed with the -I option.
<ReachingFarr> mfp: Yes.
<derdon> ReachingFarr is too scared to tries absolute paths :P
<derdon> *to try
barismetin has quit [Remote host closed the connection]
<ReachingFarr> derdon: Sure, scared. Or they wouldn't actually solve my problem.
<mfp> ReachingFarr: what's the exact error message you're getting? My ocamlc (3.11.1) complains with something like Error: Unbound value Foo.a
seg_ is now known as segmond
<ReachingFarr> OK. So I have a file called TangleLexDbg.ml that has the line "open TangleLexer" in it. I'm using this command to compile it: `ocamlc -I ../frontend/ -o tangle-lexdbg TangleLexDbg.ml ../frontend/TangleLexer.cmo ../frontend/TangleParser.cmo` I get this error: "Error: Error while linking TangleLexDbg.cmo: Reference to undefined global `TangleLexer'"
<mfp> try with ocamlc -I ../frontend/ -o tangle-lexdbg ../frontend/TangleLexer.cmo ../frontend/TangleParser.cmo TangleLexDbg.ml
<ReachingFarr> Sigh. OK.
<mfp> or ocamlc -c -I ../frontend TangleLexDbg.ml && ocamlc -I ../frontend/ -o tangle-lexdbg ../frontend/TangleLexer.cmo ../frontend/TangleParser.cmo TangleLexDbg.cmo
<ReachingFarr> Ya, that fixed it. I think I now remember running into this earlier.
<ReachingFarr> Thanks for the help mfp.
<mfp> np
<mfp> the pb was in the linker, which is why I didn't recognize the error msg as coming from the compiler :) (figured it out 1 sec before you pasted your cmdline by grepping the compiler sources :)
<ReachingFarr> Haha, thanks. It seems kinda silly that the object files need to be in a specific order.
<mfp> it's because of the side effects in their initialization
<mfp> since you can have let () = ... in your modules
<mfp> so, while the compiler/linker could infer an ordering that leaves no unresolved symbols, it cannot guess _the_ correct order as far as side effects are concerned
<ReachingFarr> Fair enough. Just something I have to get used to and then remember later.
vpalle_ has joined #ocaml
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
vpalle has quit [Ping timeout: 258 seconds]
<derdon> omg, ocamls way of printing backtraces is useless
fschwidom has quit [Remote host closed the connection]
sepp2k has quit [Quit: Leaving.]
<orbitz> derdon: how so?
<derdon> orbitz: comiled files are simply called "unknown location"...
<derdon> *compiled
<orbitz> ah yess limited to bytcode compiled or somethign
<orbitz> isnt' 3.12 doing somethign about that?
<derdon> dunno
<derdon> I have 3.11
vpalle__ has joined #ocaml
vpalle_ has quit [Ping timeout: 248 seconds]
Amorphous has quit [Ping timeout: 246 seconds]
Amorphous has joined #ocaml