wormphlegm has quit [Read error: Connection reset by peer]
sebz has joined #ocaml
wormphlegm has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
everyonemines has quit [Quit: Leaving.]
sebz has quit [Quit: Computer has gone to sleep.]
ulfdoz has joined #ocaml
sebz has joined #ocaml
ankit9 has quit [*.net *.split]
asmanur_ has quit [*.net *.split]
chambart has quit [*.net *.split]
olasd has quit [*.net *.split]
noj has quit [*.net *.split]
caligula has quit [*.net *.split]
mehdid has quit [*.net *.split]
gildor has quit [*.net *.split]
sebz has quit [Client Quit]
caligula has joined #ocaml
noj has joined #ocaml
ankit9 has joined #ocaml
asmanur_ has joined #ocaml
chambart has joined #ocaml
olasd has joined #ocaml
mehdid has joined #ocaml
gildor has joined #ocaml
sebz has joined #ocaml
jonafan has quit [Ping timeout: 260 seconds]
jonafan has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
ulfdoz has quit [Read error: Operation timed out]
flx_ has joined #ocaml
flux has quit [Read error: No route to host]
flx_ is now known as flux
flux is now known as fluxx
fluxx is now known as flux
sebz has joined #ocaml
thomasga has joined #ocaml
dnolen has quit [Quit: dnolen]
<ohwow>
What is the way to generate a list in OCaml? Like [1..10] in haskell or (iota) in Scheme?
sebz has quit [Quit: Computer has gone to sleep.]
<ohwow>
Also, is there something like Hoogle for OCaml?
junsuijin has quit [Quit: Leaving.]
qnix_ has joined #ocaml
alkoma has joined #ocaml
<ohwow>
Dammit, why is OCamlWin crashing on me?
qnix_ has left #ocaml []
alkoma has left #ocaml []
<flux>
ohwow, ocaml doesn't have ranges. batteries has ranges, but they are enumerations, for example: List.of_enum (1 -- 10)
sebz has joined #ocaml
ikaros has joined #ocaml
kizzx2 has joined #ocaml
<kizzx2>
hey guys
<kizzx2>
is ocamllex suitable for parsing binary files?
<flux>
hmm, good question. no idea :)
<flux>
kizzx2, maybe ocaml-bitstring is what you're looking for
<flux>
or maybe not, if your data is always byte-aligned
<kizzx2>
umm just wanted to know if there are any "defacto" "modern techinque" way to parse some standard binary formats
<kizzx2>
umm
<kizzx2>
standard as in things like Pcap where you have a header that tells you "there are n bytes to come, data A is in offset n1", etc. kindof thing
alkoma has joined #ocaml
<flux>
kizzx2, then maybe you should indeed take a look at ocaml-bitstring
<flux>
unfortunately it's not an online parser, which for me is a big deal
<flux>
but maybe one day, someone will update it..
<kizzx2>
what is an online parser?
<flux>
online parser doesn't need to have all the data up-front when you start to parse
<flux>
so, for example, you can parse network streams with online parsers
<kizzx2>
flux: oic
<flux>
with offline parsers you need to have a chunk you want to parse
<flux>
in principle I don't think ocaml-bitstring would be difficult to modify to be an online-parser, but I guess right people haven't needed the feature :)
<kizzx2>
the google page's "Activity" is unfortunately Low :P
<kizzx2>
the example shows parsing GIF file, so I think it's designed for the right purpose
<kizzx2>
*for my purpose, rather
alkoma has quit [Client Quit]
<flux>
kizzx2, a good thing with the module is that if you find problems, you can bug rwmjones directly here ;-)
<ohwow>
damn, I bet there is a package for Debian for that
<ohwow>
but on Windows I have to install in manually :(
Kakadu has joined #ocaml
eikke has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
edwin has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
ankit9 has quit [Quit: Leaving]
alkoma has joined #ocaml
everyonemines has joined #ocaml
larhat has joined #ocaml
alkoma has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
alkoma has joined #ocaml
ankit9 has joined #ocaml
alkoma has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
sebz has quit [Quit: Computer has gone to sleep.]
avsm has joined #ocaml
everyonemines has quit [Quit: Leaving.]
avsm has quit [Quit: Leaving.]
alang has quit [Ping timeout: 255 seconds]
sebz has joined #ocaml
avsm has joined #ocaml
ttamttam has joined #ocaml
lopex has joined #ocaml
emmanuelux has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
thomasga has quit [Quit: Leaving.]
thomasga has joined #ocaml
thomasga has quit [Client Quit]
_andre has joined #ocaml
ankit9 has quit [Ping timeout: 248 seconds]
philed has joined #ocaml
ankit9 has joined #ocaml
hto has quit [Ping timeout: 276 seconds]
hto has joined #ocaml
philed has quit [Remote host closed the connection]
philed has joined #ocaml
oriba has joined #ocaml
dnolen has joined #ocaml
oriba has quit [*.net *.split]
emmanuelux has quit [*.net *.split]
edwin has quit [*.net *.split]
noj has quit [*.net *.split]
dcolish has quit [*.net *.split]
Lor has quit [*.net *.split]
bitbckt has quit [*.net *.split]
fraggle_ has quit [*.net *.split]
fabjan has quit [*.net *.split]
sgnb has quit [*.net *.split]
Tobu has quit [*.net *.split]
jlouis has quit [*.net *.split]
rossberg has quit [*.net *.split]
flx_ has joined #ocaml
hnrgrgr has quit [Read error: Operation timed out]
ztfw has joined #ocaml
oriba has joined #ocaml
emmanuelux has joined #ocaml
edwin has joined #ocaml
noj has joined #ocaml
dcolish has joined #ocaml
Lor has joined #ocaml
bitbckt has joined #ocaml
fraggle_ has joined #ocaml
fabjan has joined #ocaml
sgnb has joined #ocaml
Tobu has joined #ocaml
jlouis has joined #ocaml
rossberg has joined #ocaml
hnrgrgr has joined #ocaml
flux has quit [Read error: Connection reset by peer]
dnolen has quit [Quit: dnolen]
flx_ is now known as flux
thomasga has joined #ocaml
<thelema>
ohwow: let me know if you have any problems with batteries under windows
emmanuelux has quit [Ping timeout: 244 seconds]
<kizzx2>
thelema: what's the latest method to use batteries with ocamlfind and ocamlbuild?
<kizzx2>
i installed Batteries using GODI
<kizzx2>
`ocamlfind batteries/ocamlbuild` -> Cannot find command and indeed it isn't there
<kizzx2>
so i have _tags like this <*.ml> or "main.byte": package(batteries) which gets it recognized but fails at link time "Erference to undefined global `Batteries'
<kizzx2>
with ocamlc i would do `ocamlfind ocamlc -linkpkg -package batteries -c`
<thelema>
kizzx2: you figured out that you need a command line argument for ocamlfind to recognize package(foo) tags?
<thelema>
hmm, are you sure -cflags -linkpkg is needed?
<kizzx2>
yeah
<kizzx2>
without -linkpkg :
<thelema>
blah. I've not had to deal with plain ocamlbuild - I always just use the same myocamlbuild that enables findlib compat properly
<kizzx2>
Solver failed:
<kizzx2>
Ocamlbuild knows of no rules that apply to a target named batteries. This can happen if you ask Ocamlbuild to build a target with the wrong extension (e.g. .opt instead of .native) or if the source files live in directories that have not been specified as include directories.
<kizzx2>
Backtrace:
<kizzx2>
- Failed to build the target batteries
<kizzx2>
- Building batteries
<kizzx2>
o
<kizzx2>
ooo
<kizzx2>
well i guess it's not required
<kizzx2>
silly me
<kizzx2>
so just `ocamlbuild -use-ocamlfind -libs batteries main.byte` is ok
<kizzx2>
i was doing `ocamlbuild -use-ocamlfind -cflags -libs batteries main.byte` which was wrong :P
<thelema>
and if you have a _tags file with the right tag, you shouldn't need -libs batteries
joewilliams_away is now known as joewilliams
<kizzx2>
GODI doesn't seem to have given me myocamlbuild.ml
<thelema>
you shouldn't need it under 3.12.
<thelema>
it just enables the same stuff that -use-ocamlfind does
<kizzx2>
i wonder what the correct _tags setting is
<thelema>
try `true: package(batteries)`
<kizzx2>
ok for some bizzare reason this exact same thing worked after you told me to retry :P
<thelema>
I do sometimes have a magical effect on computers
* kizzx2
is trying hard to cover his noobness
<thelema>
but usually I have to be near them for this to work. :)
<kizzx2>
thelema: yeah i just verified it it works
<kizzx2>
thelema: i'm on 3.12.1 from godi
<thelema>
kizzx2: thanks
<flux>
thelema, pretty cool!
lopex has joined #ocaml
<flux>
thelema, although a general fix indeed would be even better :)
<flux>
while at it, a forward apply-version should exist as well :/
<flux>
and "flip" and and..
<thelema>
flux: I agree - historically OCaml seems to have had the policy of only applying general fixes, which is why there's not too much hackiness in the compiler
<thelema>
I guess maybe because the request came from Jane St. that this was special
<flux>
indeed
<flux>
in practice, though, a decent set of builtin combinators would go a long way
<flux>
flip, apply, revapply, what else?
<thelema>
quite agreed. This is a good start.
<thelema>
compose
<kizzx2>
flux: Data.Function from haskell, namely fix and on
<kizzx2>
thelema: however if i change `open Batteries_uni` to `open Batteries` i get Error: Error while linking euler001.cmo:
<kizzx2>
Reference to undefined global `Batteries'
<kizzx2>
it is rather bewildering how to proceed from here "nothing thread related is in the error message"
<thelema>
kizzx2: I was worried about that. I'll just put the threads requirement into the recipe
<flux>
well, 'id' and 'const' are decent as well, but I think they are most often used with other higher order functions already, and maybe optimizing them would not in general bring much more performance
<thelema>
kizzx2: how about the current instructions? (added 'predicate(mt)' to _tags)
<flux>
also I don't think adding the few combinators would complicate maintenance, the patch seemed relatively simple (although it touched something like 5 places)
<kizzx2>
thelema: <*>: thread, package(batteries) worked for me
<thelema>
I can copy the docs for the list comprehensions from the old documentation; I don't use estring, and I don't think it's as well documented
<thelema>
can anyone help?
Smerdyakov has joined #ocaml
Smerdyakov has left #ocaml []
Kakadu has quit [Quit: Page closed]
joewilliams is now known as joewilliams_away
lopex has quit []
philed has quit [Remote host closed the connection]
Snark_ has joined #ocaml
oriba_ has joined #ocaml
Snark_ is now known as Snark
oriba has quit [Ping timeout: 244 seconds]
oriba_ is now known as oriba
Cyanure has quit [Ping timeout: 240 seconds]
Cyanure has joined #ocaml
yezariaely has joined #ocaml
lopex has joined #ocaml
yezariaely has quit [Quit: Leaving.]
ankit9 has quit [Quit: Leaving]
larhat has quit [Quit: Leaving.]
ulfdoz has joined #ocaml
avsm has quit [Quit: Leaving.]
oriba has quit [Quit: oriba]
eikke has quit [Ping timeout: 256 seconds]
avsm has joined #ocaml
lopex has quit [Ping timeout: 256 seconds]
lopex has joined #ocaml
Associat0r has joined #ocaml
Associat0r has quit [Changing host]
Associat0r has joined #ocaml
Associat0r has quit [Client Quit]
junsuijin has joined #ocaml
ankit9 has joined #ocaml
avsm has quit [Ping timeout: 252 seconds]
Anarchos has joined #ocaml
thomasga has quit [Quit: Leaving.]
Cyanure has quit [Ping timeout: 245 seconds]
ulfdoz_ has joined #ocaml
kizzx2 has quit [Remote host closed the connection]
ulfdoz has quit [Ping timeout: 244 seconds]
ulfdoz_ is now known as ulfdoz
lpereira has joined #ocaml
tac-tics has joined #ocaml
bobry has quit [Quit: Leaving.]
bobry has joined #ocaml
hcarty has joined #ocaml
<ohwow>
Hm, I noticed this about the "fun" keyword: There is a more compact way of writing function expressions with several parameters. It is a legacy of former versions of the Caml language. Its form is as follows:
<ohwow>
that's kinda puzzling, because all code snippets i've see used fun, but not function
<hcarty>
ohwow: fun and function do two different things
<adrien>
you linked to the whole chapter btw; which line did you have in mind?
<hcarty>
"function" is kind of like "match"; "fun" is useful when creating anonymous functions
<hcarty>
ohwow: "let f = function Some x -> true | None -> false" is like writing "let f x = match x with Some x -> true | None -> false"
<thelema>
ohwow: fun doesn't allow multi-case pattern matching, but allows multiple parameters
<thelema>
ohwow: function allows multi-case pattern matching (like match), but only one argument
<hcarty>
thelema: I stopped trying to use estring and extensions derived from it after running into too many edge cases and unexpected incompatibilities.
<thelema>
hcarty: good to know. I wonder who will complain if the next batteries has no camlp4
<ohwow>
Ah I see, thank you
<ohwow>
Is it true that List.map is not tail recursive?
<thelema>
yes.
<flux>
Batteries' List.map is, though?
<thelema>
batteries provides a tail recursive replacement that is automatically used after [open Batteries]
<ohwow>
I don't mean to be offensive, but isn't it kinda silly? What's the point of the standart library, if you have to use additional stuff?
<thelema>
the standard library doesn't include the kitchen sink because doing so would require its maintainers at INRIA to spend more work maintaining such.
<thelema>
You don't have to use additional libraries - the builtin List.map is sufficient for 99% of cases
<thelema>
and is faster than tail-recursive versions.
<ohwow>
why it's faster?
<thelema>
immutable lists can't be built from head to tail, they have to be built from tail to head.
<thelema>
List.map uses the system stack to store elements already produced
<flux>
hmm, I thought Batteries' List.map used dirty tricks to do it?
<thelema>
This is more efficient than building the list in reverse and then reversing it or even cheating the type system and using mutation to build the list from head to tail (as batteries does)
<flux>
(nevermind ;))
<hcarty>
thelema: Removing the syntax extensions, or at least moving them to a separate project seems like a reasonable step in 2.0 or 3.0.
<thelema>
but there's a GC cost to mutation - something about global roots
<thelema>
There's a third way, but its code is more complex.
<thelema>
So the performance curve of List.map beats Core.List.map and BatList.map all the way up to where it runs out of stack space.
<thelema>
and if your lists are large enough to run out of stack space, you probably shouldn't be using lists.
<hcarty>
ohwow: The OCaml standard library isn't meant to cover every possible use case - it's meant to be enough to get by, with the intent that more general functions/libraries will be developed externally
<flux>
didn't someone actually implement an superior performance List.map?
<flux>
something that special-cased short lists and used the mutation trick at some point?
<flux>
("superior" might be stretching it a bit)
<hcarty>
flux: I think there is a Jane St blog post or two on that topic
<thelema>
flux: bluestorm came up with the third way I was talking about
<thelema>
There's no mutation, it's based on dividing the list into segments and mapping each of them
<thelema>
and for lists smaller than a given size, the non-tail-recursive map is used
ttamttam has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
bobry has quit [Quit: Leaving.]
Snark has quit [Quit: Quitte]
bobry has joined #ocaml
fraggle_ has quit [Ping timeout: 244 seconds]
alkoma has joined #ocaml
fraggle_ has joined #ocaml
bitbckt has quit [Ping timeout: 244 seconds]
bobry has quit [Ping timeout: 244 seconds]
<metasyntax|work>
Hmm... if I write a bunch of data to an output channel without using flush, is there a danger of the output getting "messed up?"
<thelema>
if you write to stdout and stderr without flushing, the result can be an interesting mix of the two
<thelema>
but that's just because the two go to the same place
<metasyntax|work>
For example, in my program I write a very large file, but I never called flush. There are a couple instances of duplicated lines which disappear when I use flush periodically.
<thelema>
I can't explain that.
bitbckt has joined #ocaml
<metasyntax|work>
Yeah, I thought it was very strange.
<metasyntax|work>
And I guess "very large" is somewhat hyperbolic; it's only 2.8 MB.
ztfw has quit [Remote host closed the connection]
<thelema>
how are you writing to the output channel?
<metasyntax|work>
output_string and output_char
<thelema>
threads?
<metasyntax|work>
And the channel is just a file opened with open_out.
<metasyntax|work>
nope
<thelema>
got me
<flux>
metasyntax|work, can you produce a test case? (although I'm very close to going sleep, ircing from the bed :))
bitbckt has quit [Ping timeout: 240 seconds]
bitbckt has joined #ocaml
<metasyntax|work>
flux: I'll have to see if I can put something together... the problem occurs in the same place in the file every time, so that's encouraging at least.
Tianon has quit [Ping timeout: 240 seconds]
bitbckt has quit [Ping timeout: 244 seconds]
bitbckt has joined #ocaml
<mfp>
metasyntax|work: does your program ever fork?
<mfp>
if you fork without flushing all open out_channels, both the child and the parent will end up writing the contents of the internal buffer at the time of the fork
bitbckt has quit [Ping timeout: 240 seconds]
* thelema
wonders why fork doesn't do that itself
<metasyntax|work>
mfp: No forking.
ulfdoz has quit [Ping timeout: 260 seconds]
<metasyntax|work>
What I do is read a bunch of XML data and parse it into objects, and put those objects into a hash table. Then I iterate through the hash table and print out the fields in each object.
<metasyntax|work>
I found the problem because the output is tab-separated text, and I had a line with too many columns. Turns out there was data from another line, such that this too-large long contained the first two fields that it was supposed to have, plus all 26 fields from another line.
<metasyntax|work>
When I looked some more, I realised that some lines were completely duplicated, although not in any noticable pattern (e.g. not a block of several sequential lines).
<metasyntax|work>
Unfortunately I can't share the data since it's private, and the program is too big to serve as a useful test.
<metasyntax|work>
(This is all native compiled by the way; linking in Batteries, PXP, and json-wheel.)
<thelema>
metasyntax|work: I guess it's possible batteries' IO layer has a bug - can you use Legacy.Pervasives.* for your IO?
<thelema>
maybe [open Legacy.Pervasives] will accomplish this
alkoma has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
bitbckt has joined #ocaml
avsm has joined #ocaml
alkoma has joined #ocaml
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
<metasyntax|work>
Hmm... using pkg_batteries in my _tags file, I get that module Legacy is undefined; using Batteries 1.4.1
<thelema>
oops, Batteries.Legacy doesn't define Pervasives, it includes it.
<thelema>
are you doing [open Batteries]?
<metasyntax|work>
Oh, sorry - I have been tending to use individual modules. Using open Batteries works.
<thelema>
if you're not opening batteries, then you're using stdlib operations for IO.
<thelema>
so I don't see it being a problem in batteries causing your IO problem
<thelema>
in which case this problem is even more confusing, as stdlib output is *well* tested
funktronic has quit [Quit: Page closed]
<metasyntax|work>
Nuts, now I get "No implementations provided for the following modules: Batteries referenced from bb_plt.cmx" which is the module pack that wraps the module that does the IO. Sorry, there are some things I don't understand real well about OCaml yet.
<thelema>
sounds like a linking problem
<thelema>
how are you compiling?
<metasyntax|work>
ocamlbuild
<thelema>
-use-ocamlfind?
<thelema>
or myocamlbuild.ml?
<metasyntax|work>
myocamlbuild.ml
<metasyntax|work>
Using -use-ocamlfind fails the same way.
<metasyntax|work>
I'll clean up the code and post some skeletons.
<thelema>
well, -use-ocamlfind requires different tags
<thelema>
-use-ocamlfind uses package(foo), while most myocamlbuild.ml use pkg_foo
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
_andre has quit [Quit: leaving]
<metasyntax|work>
Oh, I had to enable threads.
<thelema>
oh yeah, stupid findlib
* thelema
is happy to have that fixed in v2
<metasyntax|work>
Yeah, the problem is still there when I use Legacy.{open_out,output_string,output_char}
<metasyntax|work>
I'll keep trying to repro and ask the mailing list if I can cook something up.
<thelema>
metasyntax|work: if you're not doing [open batteries] then you were already using Legacy.*
<metasyntax|work>
thelema: Sure, I understand.
<metasyntax|work>
And thanks for the ideas trying to track this down, folks.
edwin has quit [Remote host closed the connection]
eikke has joined #ocaml
zorun has quit [Ping timeout: 276 seconds]
hcarty has quit [Quit: leaving]
Cyanure has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
ankit9 has quit [Quit: Leaving]
sebz has joined #ocaml
lpereira has quit [Quit: Leaving.]
Amorphous has quit [Read error: Operation timed out]
avsm has quit [Quit: Leaving.]
Amorphous has joined #ocaml
preyalone has joined #ocaml
<preyalone>
How can I emulate Python's if __name__=="__main__": main() in OCaml?
<_habnabit>
What would it mean?
<preyalone>
It would allow the creation of a main function which is only executed when you run something.ml directly, but not when you import the code in something.ml from something_else.ml.
<preyalone>
Imagine you want to write a library of functions, and also a command line interface for those functions, all in the same .ML file.
<_habnabit>
What do you mean by "run [it] directly?"
<preyalone>
it = some_script.ml
<_habnabit>
Yes, I get that.
<preyalone>
Run directly: ./some_script.ml
<preyalone>
Run indirectly: ./another_script.ml, which imports the code from some_script.ml
<preyalone>
Haskell has it easy: implement a main function and it will have this behavior.
<_habnabit>
It's kind of an antipattern in python anyway. Not familiar enough with anything else to judge.
<preyalone>
It's _not_ an antipattern in Python. It's very useful for scripts that double as command line programs and APIs for other programs.
<_habnabit>
I can't think of a single case in python I've actually seen that
<_habnabit>
Especially since binaries and libraries go in separate places
hnrgrgr has quit [*.net *.split]
<_habnabit>
And double especially since you can't directly run modules inside a package
hnrgrgr has joined #ocaml
<preyalone>
_habnabit: It, and Perl's unless(caller) { main; } and Ruby's if __FILE__ == $0 then main end are fairly common.
<_habnabit>
I'm not denying that it's /common/. It's just almost always the wrong thing to fo
<_habnabit>
Do
<_habnabit>
php is common too.
<preyalone>
In any case...
<preyalone>
If I did let rec main = print_endline "Hello World!" in hello.ml and imported the code in welcome.ml, would welcome.ml print the Hello World message?
<_habnabit>
No, but it also wouldn't be executed when you run your .ml file
<preyalone>
_habnabit: Actually, it is. Try it.
<_habnabit>
Oh, you didn't define a function
<_habnabit>
Ocaml isn't lazy; you just did 'let main = ()' but with a side effect
<bitbckt>
preyalone: if !Sys.interactive then () else main ();;
<bitbckt>
all defined let _ = will be run, if the containing module is referenced.
Cyanure has quit [Read error: Operation timed out]
<bitbckt>
I wouldn't rely too heavily on execution order, though... I prefer to separate bin from lib code.
<_habnabit>
It's the most sensible thing, yes
<_habnabit>
In python too
<bitbckt>
probably anywhere.
<bitbckt>
I can't really think of a time I wanted something else...
preyalone has quit [Ping timeout: 252 seconds]
preyalone has joined #ocaml
<preyalone>
ocaml life.ml works fine, but ocaml death.ml reports "Error: Unbound module Life"
<preyalone>
And after running ocamlc life.ml, ocaml death.ml reports "Error: Reference to undefined global `Life'"
dnolen has joined #ocaml
<preyalone>
Ditto for ocamlopt life.ml, ocaml death.ml
preyalone has quit [Client Quit]
<bitbckt>
that was intended for the ocaml toplevel.
<bitbckt>
that's the only way that'll work.
preyalone has joined #ocaml
Modius has quit [Read error: Connection reset by peer]
<preyalone>
bitckt: When I run "ocaml death.ml", I either get "Error: Unbound module Life" or "Error: Reference to undefined global `Life'", depending on whether I first ran "ocamlc/ocamlopt life.ml".
<bitbckt>
preyalone: that isn't meant to be run that way; there's normally a linking phase with those tools.
<bitbckt>
if you compile both with ocamlc -c, you can use them with #load at the toplevel.
<preyalone>
bitckt: Okey dokey. How do I properly compile and run death.ml?
<bitbckt>
#load "life.cmo";; #load "death.cmo";;
<bitbckt>
it's not like a scripting language like that.
<bitbckt>
(I'm having trouble expressing that.)
<preyalone>
Then shouldn't death.ml include a preprocessor directive, #load "life.cmo"?
<bitbckt>
those only work at the toplevel.
<bitbckt>
if you _did_ link them together with ocamlc -linkall life.ml death.ml, both will run.
<preyalone>
ocamlc would create a binary for death.ml?
<preyalone>
Or separate binaries for life and death?
<bitbckt>
cmo are object files. if you -linkall them, you'll get a single binary, a.out.
<bitbckt>
(unless you pass -o lifeordeath, say)
<bitbckt>
like a C compiler.
<preyalone>
Ah, ocamlc -linkall file1 file2 file3... borks if you get the order wrong.
<bitbckt>
right. there's a tool called ocamldep with lists dependencies of a module.
<preyalone>
It works! :) :) :)
<bitbckt>
s/with/which/
<preyalone>
One more thing. How can you inform ocamlscript that death.ml depends on life.ml?
<preyalone>
When I add "#!/usr/bin/env ocamlscript -o death" to the beginning of death.ml, I get the same module error I did before.
<bitbckt>
I don't know much about ocamlscript. I don't use it.
<bitbckt>
I assume it has a help?
<preyalone>
Yes, it has a .man file. But it doesn't really say how to do this.
<preyalone>
Somehow, even the example line Ocaml.packs := [ "netclient" ] fails, because ocaml and ocamlscript can't find the Ocaml module.