...
00:03:54  <Smerdyakov> everyonemines, I wouldn't expect it can be done very naturally with static typing.
11:10:24  <joelr> good day
11:10:39  <joelr> does anybody know what this refers to? happens when a camlp4 syntax tag is added to _tags
11:10:39  <joelr> ocamlfind: When using -syntax, the META variable 'preprocessor' must be set
11:10:58  <joelr> e.g. after <src/doc_upload/*.ml>: syntax_camlp4o
11:11:00  <joelr> gildor: ^
11:13:15  <joelr> ah, this is because a package is missing
12:30:47  <flux> one of the most annoying misfeatures of ocamlbuild
12:31:01  <flux> missing packages result in obscure errors
12:34:39  <adrien> that one was from ocamlfind actually, it's not very clear but it can't be worse than ocamlbuild silently skipping non-existing packages
16:06:06  <NaCl> how could I go about making mutually recursive modules and get ocamlbuild to be happy about them?
16:08:03  <hcarty> NaCl: I haven't used recursive modules before, but I think they need to be defined in a single .ml file
16:08:26  <NaCl> It's more like I have two files that reference each other
16:08:49  <hcarty> I don't think that it is possible to compile that, but I may be wrong.
16:08:58  <hcarty> NaCl: http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#toc75
16:09:33  <NaCl> tricky
16:09:56  * NaCl is relatively new to ocaml and was hoping not to get down into the guts like this
16:11:57  <thelema> NaCl: you can have mutually recursive modules within one file, but separate compilation + mutual recursion = error
16:12:11  <thelema> try to change your design so the two files don't reference each other.
16:12:52  <NaCl> hmmmm
16:13:00  <NaCl> I'm going to have to think on this
16:13:23  <NaCl> I know how I could do it, but it wouldn't make too much sense
16:13:30  <NaCl> or...
16:13:41  <thelema> what are you trying to do?
16:14:19  <NaCl> Well, the first problem I had I think I could fix by moving some type declarations to a separate file.
16:14:40  <thelema> yes, usually you should put the common type declarations in its own file
16:15:20  <NaCl> Actually, that may solve the problem.
16:15:26  * NaCl is translating C into ocam
16:15:28  <NaCl> l
16:17:18  <NaCl> thelema: yeah, I think the solution is spreading some stuff out.  Let's see if that works
16:31:20  <NaCl> Just when I'm about to complain about a difficulty I'm having, I find a solution for it
16:31:57  <thelema> the task of trying to explain your problem to complain about it helps a lot in terms of realizing what the solution to the problem is.
16:32:05  <NaCl> indeed
16:33:37  <NaCl> the problem is: I am making a Ray Tracer.  Scene specifications contain Lights.  Lights need to call the scene "intersect with the primitive list" routine
16:33:53  <NaCl> both are in two files, and call each other.
16:34:26  <thelema> put the types for both in one file, and have lights depend on scene.
16:34:27  <NaCl> and looking at my C++ implementation of this thing, that list is supposed to be a tree, and not even called from this file.
16:34:58  <thelema> or realize that the "lights calling the scene" code can be in the scene file
16:35:24  <NaCl> yeah, it can
16:35:53  <NaCl> I haven't gotten to shadows yet, but they're going to pop up eventually
16:36:03  <thelema> you're thinking OO, where code that works on lights *must* be in the lights class
16:36:17  <NaCl> yeah
16:36:43  <NaCl> I'm trying to learn functional programming.  Unfortunately, I may not be able to use it much.
18:21:29  <joelr> folks, how do i get ocamlopt to show me the assembly code?
18:21:40  <thelema> -S
18:23:41  <joelr> thelema: this is after all optimizations are applied, right? by ocamlopt
18:23:57  <thelema> yes, it's the final assembly
18:24:08  <joelr> thelema: thanks
18:24:17  <joelr> thelema: trying to optimize math here
18:24:27  <thelema> there's no intermediate assembly generated, all optimizations are done to a different representation
18:24:42  <adrien> "after all optimizations are applied": yeah, after all 3 of them :P
18:24:47  <joelr> hehe
18:25:02  <joelr> thelema: is there unsafe array access?
18:25:15  <thelema> Array.unsafe_get arr idx
18:25:41  <thelema> you can turn all array access unsafe with -unsafe
18:25:49  <joelr> aha!
18:25:51  <thelema>   -unsafe  No bounds checking on array and string access
18:26:11  <joelr> awesome, thanks
18:26:33  <joelr> trying to optimize this http://pastie.org/1922909
18:26:42  <joelr> by looking at the output from ocamlopt -dcmm
18:26:48  <joelr> haven't looked at the assembly yet
18:27:05  <thelema>     acc := +. d1 +. d2
18:27:13  <thelema> does this even compile?
18:27:25  <joelr> err
18:27:36  <joelr> it does :D
18:27:50  <thelema> I thought the patches to add unary + were just added to the devel branch
18:28:36  <joelr> it drops that first plus, though
18:29:28  <joelr> the truly interesting part is that the second version i have does not allocate on every loop iteration
18:29:51  <joelr> thelema: check it out
18:29:55  <joelr> same pastie, just edited
18:30:24  <thelema> try comparing your function with [let rec js_div1 v1 v2 acc i = if i >= Array.length v1 then ((L4-L8)) in js_div1 v1 v2 (acc +. d1 +. d2) (i+1) else acc]
18:30:40  <thelema> err, i < Array.length v1
18:31:41  <thelema> yes, there's some wierd rules on float boxing, maybe if you change L11 to (!acc + 0.) it'll avoid allocation in the first implementation
18:32:53  <joelr> thelema: loops are faster than recursive functions, e.g. there's no boxing
18:38:44  <joelr> thelema: is there an unsafe length function?
18:39:35  <thelema> huh?
18:39:41  <thelema> what would that do differently?
18:39:45  <joelr> :D
18:39:50  <joelr> never mind, my bad
18:49:40  <thelema> http://pastie.org/1923017
18:51:34  <flux> maybe it could unsafely work on any data type.. ;)
18:55:46  <thelema> with an array size of 500K instead of 500, the differences between 1a, 2 and 3 disappear
19:09:56  <joelr> thelema: looking
19:10:25  <joelr> thelema: we use arrays of 150 elements
19:12:37  <joelr> thelema: i didn't know about the benchmark package, thanks a lot!
19:19:04  <joelr> thelema: this gives me some fine ideas for benchmarking, actually
19:19:34  <joelr> thelema: because in the code that uses this the arrays v2 are stored in a record in a hash table so memory access should be all over the place
19:20:46  <joelr> i would like to try to stick the floats into a memory-mapped float file instead, and get hold of them via Bigarray.Array1.map_file + unsafe_get
...