Banana changed the topic of #ocaml to: OCaml 3.08.1 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
<htp123> could anyone please tell me what does 'in' stands for?
<Smerdyakov> 'in' is part of the syntax of 'let' expressions.
<htp123> right, but what does it actually stand for?
<Smerdyakov> What does ';' stand for in C?
<Smerdyakov> What does '(' stand for in C?
<htp123> i thought it was an abreviation maybe
<htp123> 'inline' or something
<Smerdyakov> No, it is not an abbreviation.
<htp123> thanks
<malc_> let foo stand for bar in(side) this block of code
<htp123> oh ok. so another name for local basically?
<malc_> probably
<htp123> thanks
<Smerdyakov> htp123, you understand that 'let' expressions can't be used apart from 'in', right? 'in' provides no extra information by its presence.
mpc has quit []
<htp123> yah. i'm just trying to understand it a bit better
<htp123> i thought it makes an expression inlineable at first
<Smerdyakov> You will understand it better by understanding it as meaningless.
<htp123> it just makes the name local to the current let definition?
<Smerdyakov> It has NO meaning. I am saying this literally.
<Smerdyakov> 'let' expressions introduce local definitions.
<Smerdyakov> 'in' is purely a syntactic separator, to make parsing unambiguous.
<htp123> oh ok
mrsolo_ has joined #ocaml
mrsolo has quit [Read error: 232 (Connection reset by peer)]
monochrom has joined #ocaml
kinners has joined #ocaml
gl is now known as gld
gl has joined #ocaml
dxlvi has joined #ocaml
<dxlvi> hm ok sorry, how can i match integer ranges?
<Smerdyakov> You can always use 'if' expressions.
<dxlvi> ?
<Smerdyakov> Have you ever used 'if' in OCaml?
<dxlvi> as a pattern?
<Smerdyakov> No, as an expression. I am not suggesting something that is particular to 'match'. I am suggesting how to achieve the same goal otherwise.
<dxlvi> oh
<Smerdyakov> I really don't think you would expect much benefit from support for integer ranges in 'match'.
<dxlvi> well, i just tought if there are character ranges there must be integer ranges too :)
avlondono has joined #ocaml
<dxlvi> tons of ifs now look like an airplane's wing :D
<monochrom> heh
dxlvi has quit ["cool! :D"]
malc_ has quit ["leaving"]
cjohnson has quit [Read error: 232 (Connection reset by peer)]
cjohnson has joined #ocaml
pango has quit ["Client exiting"]
kinners has quit [Read error: 110 (Connection timed out)]
mpc has joined #ocaml
segphault has joined #ocaml
<segphault> I'm getting very frustrated with ocaml's immensely retarded inclusion system. Is there a tutorial out there that explains exactly what you have to do to get included modules to work in different contexts?
<Smerdyakov> What is an "inclusion system"?
<segphault> I have a file with some misc functions that i've written. its called 'extensions.ml'. I have a file that I want to use it in: its called 'tabproc.ml'. I am using extlib in extensions.ml. I can get extensions.ml to run in the interpreter by using #directory and #load directives. I cant, however, use the #load directive to load extensions.ml into tabproc ml, because it seems that I have to be able to compile extensions.ml into
<Smerdyakov> Don't use the interactive environment for anything serious.
<Smerdyakov> Use the command-line compilation tools.
<segphault> my guess is that if I want to run tabproc.ml in an interpreter, I have to make a custom toplevel that has extensions.ml built into it.
<segphault> ok, interactive environment aside, how do I get extensions.ml to statically compile using extlib?
<Smerdyakov> I don't know what extlib is.
<segphault> extlib is an extra library. it exists inside of a folder in the ocaml libraries directory, which seems to be why i'm having trouble using any of its modules.
<segphault> theoretically, I should be able to comple extensions.ml this way: ocamlopt extensions.ml -I +extlib
<segphault> for reasons beyond my comprehension, it doesnt appear to work.
<Smerdyakov> I thought -I only shows where to find interfaces and does nothing to link in new executable code.
<segphault> you are probably right, because regardless of wether or not the '-I +extlib' thing is in the command, it gives me the same error, which is: "Unbound module ExtLib"
pango has joined #ocaml
<segphault> which my brain translates as: "you should have used pascal"
kinners has joined #ocaml
<segphault> thanks for your help by the way. I do appreciate it.
<segphault> I'll probably have to spend more time with the documentation.
<segphault> this is one of those situations were gross pragmatism is probably necessary. I'll write a script that concatenates all the files and pipes it into the compiler.
<avlondono> I imagine you could build a library (-a) and pass the option to the linker to link statically
<segphault> what do people usually do when they want to separate ocaml functionality into multiple files?
<Smerdyakov> segphault, there is no serious problem here.
<Smerdyakov> segphault, you just need to use the analogue of the -l flag you pass to gcc. You shouldn't expect that it would work otherwise.
<segphault> in pascal, I just compile the base file, and the compiler finds everything else. I'm not used to having to manually tell a compiler where to find what and what to link.
<Smerdyakov> Why are you using OCaml and not SML?
<segphault> they look essentially the same.
<Smerdyakov> (By the way, all you have to do is include the name of the library file before your "base file" on the ocamlopt command line.)
<Smerdyakov> SML/NJ has the Compilation Manager, which makes multi-file projects much easier to manage.
<kinners> segphault: put '#use "topfind"' into the toplevel, then you can just do '#require "extlib"', and #use 'mymodulethatusesextlib.ml" or #load "mod.cma"
<kinners> you can also use an .ocamlinit file to put directives for the toplevel in
<Smerdyakov> kinners, even when compiling with ocamlopt?
<kinners> obviously not, as that is all for the toplevel
<segphault> kinners: does the .ocamlinit file go in my ~ directory, or the directory I execute the ocaml files from?
<kinners> segphault: you can have both afaik
<segphault> kinners: thx.
<Smerdyakov> I maintain that, when you have a multi-file project, you should always build it with command-line tools.
rhaaw has joined #ocaml
<segphault> kinners: it didnt seem to help.
<Smerdyakov> Perhaps you can load the result in the repl for interactive experimentation, but OCaml just seems to have poor support for compiling from within the repl.
<kinners> for compilation ocamlfind can do essentially the same stuff
<Smerdyakov> kinners, I'd prefer not to have any #-directives in my source files. Is that required with what you are suggesting?
<kinners> no
<Smerdyakov> Does it require doing more than listing the files that should be considered part of the project?
<kinners> segphault: still getting complaints about a missing module?
<segphault> kinners: yeah.
<Smerdyakov> segphault, I told you how to do it with ocamlopt. Have you tried?
<segphault> yeah
<Smerdyakov> segphault, it didn't work?
<segphault> same error: "unbound module extlib"
<Smerdyakov> segphault, with what command line?
<segphault> eh?
<kinners> segphault: the .ocamlinit support might have improved with 3.08?
<Smerdyakov> segphault, how did you invoke ocamlopt?
<segphault> ocamlopt extensions.ml
<segphault> and I also tried: ocamlopt extensions.ml -I +extlib
<segphault> which didnt work either
<Smerdyakov> segphault, I told you to specify the library filename before the base filename....
<segphault> 'ocamlopt extlib.cma extensions.ml' gives me the ocamlopt usage description.
<kinners> segphault: ocaml needs two things, the path to find a library, and the library name to come before any module that uses it
<monochrom> extlib.cmxa ?
<Smerdyakov> segphault, 'cmxa' is the extension for native libraries.
<segphault> "ocamlopt extlib.cmxa extensions.ml" gives me the unbound module error.
<monochrom> Do you have the file extlib.cmxa ?
<kinners> its called extLib.cmxa just to be annoying too :)
<monochrom> Really!
<segphault> yeah
<segphault> its in '/usr/lib/ocaml/3.08/extlib'
<dan2> segphault: add -I +extlib
<segphault> tried that before.
<Smerdyakov> It's kind of odd taht it doesn't complain about not being able to find 'extlib.cmxa'....
<segphault> "ocamlopt extlib.cmxa extensions.ml -I +extlib" gives me the same unbound module error
<dan2> segphault: put -I +extlib just right after ocamlopt
* segphault blinks.
<segphault> that appears to have worked. =}
<dan2> segphault: next time read the manpage
<segphault> believe me, i've read it. four or five times now.
<kinners> it's actually quite simple, but can be confusing if you don't know the paths and names of the lib
<Smerdyakov> That command line corresponds pretty much exactly with a gcc command line for an analogous task in C>
<Smerdyakov> It's no wonder that the OCaml manual would assume familiarity with gcc.
<segphault> I havent used gcc in years, and when I did, I never did anything even remotely complicated with it. Never used external libs or anything like that.
<segphault> this is very odd. ocamldep.opt doesnt list any dependencies for exensions.ml, even though it needs extLib.cma.
<segphault> thx, to all who helped me. =} I'm going to write a set of build tools now.
<beschmi_> just for the record, using ocamlfind, that would have been: ocamlfind ocamlopt -package extlib -linkpkg extensions.ml
beschmi_ is now known as beschmi
<Smerdyakov> Using the SML/NJ Compilation Manager, it would have been something like: ml-build myproject.cm Main.main myproject
<Smerdyakov> ;P
<avlondono> this isn't really painful, it's just imperative to _know_ what you're doing ... as in anything.
rhw has quit [Connection timed out]
<segphault> I dont understand why the compiler wasnt designed to deal with dependancies automatically. Is there some benefit to having to explicitly specify which files to use at the command line, even though you have already essentially done that in code?
<Smerdyakov> There is no canonical mapping from module names to source files.
<Smerdyakov> The module source could be in any one of a number of directories.
<Smerdyakov> Different users could independently come up with the same module names and want them to be thought of as coming from different source files.
<Smerdyakov> Trying to make a centralized module database gets complicated in such situations.
<segphault> good points. thanks.
<Smerdyakov> SML/NJ gets about as close as it gets by only requiring you to specify a list of source files, not even in dependency order.
<segphault> now that I think about it, the automation in pascal compilation did have some unfortunate side affects, particularly in the realm of module/file name conflicts.
<segphault> can anybody explain to me the difference between a .cma and a .cmxa?
<kinners> segphault: .cma = bytecode, .cmxa is for native code
mpc has quit []
<segphault> k. thx. thats what I thought.
_fab has quit [Read error: 110 (Connection timed out)]
_fab has joined #ocaml
<cjohnson> What does like "let _ = ..." mean ?
<cjohnson> I mean, I know what let is, but what's w/the underscore?
<htp123> arbitrary name?
<cjohnson> ?
<htp123> i don't know, but i'm guessing it's just a placeholder
<htp123> for an arbitrary name
<cjohnson> no...
<cjohnson> let _ =
<cjohnson> let n =
<cjohnson> try int_of_string Sys.argv.(1)
<cjohnson> Is some code I was looking at
<cjohnson> I've not seen let _ = before
<htp123> right. my guess would be it's like an anonymous label
<htp123> if you don't need to call it you don't need to pollute the namespace
<Smerdyakov> _ matches introduce new bindings.
<Smerdyakov> It's the same as using a "fresh" name and then not referring to it in the body.
<Smerdyakov> Er, that should have been "no bindings," not "new bindings."
segphault has quit [Read error: 238 (Connection timed out)]
mpc has joined #ocaml
monochrom has quit ["Don't talk to those who talk to themselves."]
mpc has quit []
rhw has joined #ocaml
mpc has joined #ocaml
mpc has quit []
rhaaw has quit [Read error: 110 (Connection timed out)]
kinners has quit [Read error: 60 (Operation timed out)]
mpc has joined #ocaml
pango has quit [sendak.freenode.net irc.freenode.net]
cjohnson has quit [sendak.freenode.net irc.freenode.net]
_fab has quit [sendak.freenode.net irc.freenode.net]
slashvar[lri] has quit [sendak.freenode.net irc.freenode.net]
srv has quit [sendak.freenode.net irc.freenode.net]
avn has quit [sendak.freenode.net irc.freenode.net]
Hipo has quit [sendak.freenode.net irc.freenode.net]
zigong has quit [sendak.freenode.net irc.freenode.net]
z|away has quit [sendak.freenode.net irc.freenode.net]
pattern has quit [sendak.freenode.net irc.freenode.net]
shawn has quit [sendak.freenode.net irc.freenode.net]
jameson has quit [sendak.freenode.net irc.freenode.net]
bacam has quit [sendak.freenode.net irc.freenode.net]
vincenz has quit [sendak.freenode.net irc.freenode.net]
mflux has quit [sendak.freenode.net irc.freenode.net]
vegai has quit [sendak.freenode.net irc.freenode.net]
palomer has quit [sendak.freenode.net irc.freenode.net]
mpc has quit [sendak.freenode.net irc.freenode.net]
avlondono has quit [sendak.freenode.net irc.freenode.net]
gl has quit [sendak.freenode.net irc.freenode.net]
mrsolo_ has quit [sendak.freenode.net irc.freenode.net]
Lemmih_ has quit [sendak.freenode.net irc.freenode.net]
htp123 has quit [sendak.freenode.net irc.freenode.net]
mattam has quit [sendak.freenode.net irc.freenode.net]
TNKS has quit [sendak.freenode.net irc.freenode.net]
Lemmih has quit [sendak.freenode.net irc.freenode.net]
Robert has quit [sendak.freenode.net irc.freenode.net]
jrosdahl has quit [sendak.freenode.net irc.freenode.net]
Hadaka has quit [sendak.freenode.net irc.freenode.net]
oracle1 has quit [sendak.freenode.net irc.freenode.net]
mellum has quit [sendak.freenode.net irc.freenode.net]
Excedrin has quit [sendak.freenode.net irc.freenode.net]
Nutssh has quit [sendak.freenode.net irc.freenode.net]
CLxyz has quit [sendak.freenode.net irc.freenode.net]
beschmi has quit [sendak.freenode.net irc.freenode.net]
tewk__ has quit [sendak.freenode.net irc.freenode.net]
ericc_ has quit [sendak.freenode.net irc.freenode.net]
Banana has quit [sendak.freenode.net irc.freenode.net]
det has quit [sendak.freenode.net irc.freenode.net]
gld has quit [sendak.freenode.net irc.freenode.net]
cmeme has quit [sendak.freenode.net irc.freenode.net]
mellum has joined #ocaml
oracle1 has joined #ocaml
Hadaka has joined #ocaml
jrosdahl has joined #ocaml
Robert has joined #ocaml
Lemmih has joined #ocaml
TNKS has joined #ocaml
mattam has joined #ocaml
Lemmih_ has joined #ocaml
mrsolo_ has joined #ocaml
gl has joined #ocaml
avlondono has joined #ocaml
Banana has joined #ocaml
det has joined #ocaml
Excedrin has joined #ocaml
Nutssh has joined #ocaml
tewk__ has joined #ocaml
CLxyz has joined #ocaml
beschmi has joined #ocaml
ericc_ has joined #ocaml
gld has joined #ocaml
cmeme has joined #ocaml
srv has joined #ocaml
avn has joined #ocaml
Hipo has joined #ocaml
jameson has joined #ocaml
zigong has joined #ocaml
z|away has joined #ocaml
pattern has joined #ocaml
shawn has joined #ocaml
bacam has joined #ocaml
vincenz has joined #ocaml
vegai has joined #ocaml
mflux has joined #ocaml
avlondono has quit [sendak.freenode.net irc.freenode.net]
gl has quit [sendak.freenode.net irc.freenode.net]
oracle1 has quit [sendak.freenode.net irc.freenode.net]
Lemmih_ has quit [sendak.freenode.net irc.freenode.net]
mattam has quit [sendak.freenode.net irc.freenode.net]
TNKS has quit [sendak.freenode.net irc.freenode.net]
jrosdahl has quit [sendak.freenode.net irc.freenode.net]
mellum has quit [sendak.freenode.net irc.freenode.net]
mrsolo_ has quit [sendak.freenode.net irc.freenode.net]
Hadaka has quit [sendak.freenode.net irc.freenode.net]
Robert has quit [sendak.freenode.net irc.freenode.net]
Lemmih has quit [sendak.freenode.net irc.freenode.net]
pango has joined #ocaml
cjohnson has joined #ocaml
palomer has joined #ocaml
avlondono has joined #ocaml
gl has joined #ocaml
mrsolo_ has joined #ocaml
Lemmih_ has joined #ocaml
mattam has joined #ocaml
TNKS has joined #ocaml
Lemmih has joined #ocaml
Robert has joined #ocaml
jrosdahl has joined #ocaml
Hadaka has joined #ocaml
oracle1 has joined #ocaml
mellum has joined #ocaml
_fab has joined #ocaml
slashvar[lri] has joined #ocaml
Nutssh has left #ocaml []
zardon has joined #ocaml
zardon has quit [Read error: 60 (Operation timed out)]
zardon has joined #ocaml
gpciceri has joined #ocaml
oracle1 has quit [Remote closed the connection]
budjet has joined #ocaml
Herrchen has joined #ocaml
budjet has quit [Remote closed the connection]
maihem has joined #ocaml
gpciceri has quit [Read error: 110 (Connection timed out)]
srv_ has joined #ocaml
srv has quit [Read error: 232 (Connection reset by peer)]
budjet has joined #ocaml
Herrchen has quit [Read error: 104 (Connection reset by peer)]
Herrchen has joined #ocaml
budjet has quit [Read error: 232 (Connection reset by peer)]
mrsolo_ has quit [Read error: 113 (No route to host)]
Herrchen has quit [Read error: 54 (Connection reset by peer)]
Herrchen has joined #ocaml
Herrchen has quit ["brb"]
buggs has joined #ocaml
Herrchen has joined #ocaml
kuribas has joined #ocaml
monochrom has joined #ocaml
gpciceri has joined #ocaml
gpciceri has quit ["Leaving"]
koa has joined #ocaml
gl has left #ocaml []
gl has joined #ocaml
TNKS2 has joined #ocaml
MercyW has joined #ocaml
MercyW is now known as mrsolo
mrsolo has quit ["Leaving"]
mrsolo has joined #ocaml
vezenchio has joined #ocaml
pango has quit [Nick collision from services.]
pango_ has joined #ocaml
rhw has quit ["http://cppcorner.3x.ro"]
luciver has joined #ocaml
<luciver> hi; suppose i want to use big_int's.. then I do 'open Big_int' at the beginning, and just use its functions? but then i run it through the compiler and i get 'Error while linking rndhash.cmo: Reference to undefined global `Big_int''.. what did i miss?
<mattam> you have to link to the nums library, as explained in the relevant manual chapter
<luciver> its pretty hard to find the info i want in the standard manual.. but i'll look deeper..
<mattam> it's at the beginning of the chapter
<Smerdyakov> Enough people ask about this that it should be covered more obviously, I'd say.
<Herrchen> luciver: you have to give the cma/cmxa file to the ocaml-linker - something like "ocamlc -o foo nums.cma bar.cmo" or "ocamlopt -o foo nums.cmxa bar.cmx"
<mattam> well it's pretty obvious: http://caml.inria.fr/ocaml/htmlman/manual036.html
<luciver> ah; i looked at the language info etc for more info about 'open' hoping it would be covered there somehow :) but i found it thnx :)
srv has joined #ocaml
srv_ has quit [Read error: 232 (Connection reset by peer)]
<Smerdyakov> mattam, I don't think so. The fact that the toplevel provides such a different way of loading libraries leads people to believe that the same way should work for compilation.
<luciver> yes; the compilation process isnt totally transparent.. the man page about ocamlc etc is there, but thats not a tutorial how to use it..
<mattam> well, you have to understand the difference between byte-code interpretation, compilation and native compilation, this is covered in Part III of the manual.
<luciver> Part III dumps man-pages and zillion options at you
<mattam> indeed, it's the same text
<Smerdyakov> A tutorial covering only the most commonly used compilation features would be a big win for our time here. :)
<Smerdyakov> Even better would be a big pointer that says "use SML instead." ;)
<luciver> haha
<mattam> maybe ocaml-beginners have resources of this kind
koa has left #ocaml []
palomer has quit [Remote closed the connection]
luciver has left #ocaml []
buggs^z has joined #ocaml
TNKS2 has quit ["using sirc version 2.211+KSIRC/1.3.10"]
buggs has quit [Read error: 238 (Connection timed out)]
maihem has quit ["Read error: 54 (Connection reset by chocolate)"]
gpciceri has joined #ocaml
gpciceri has quit ["Leaving"]
kuribas has quit ["Leaving"]
Herrchen has quit ["bye"]
kinners has joined #ocaml
buggs^z is now known as buggs
kinners has quit ["leaving"]