... I'm not quite sure where your pain point is, but if I'm understanding this you want to hide the _symbols? As you said, avoid classes. Instead, use...
... No, I now have let dawg = let fd = Unix.openfile "csw.dwg" [ Unix.O_RDONLY ] 0 in Array1.map_file fd int32 c_layout false (-1);; which is a global array...
... Yes: take "dawg" out of the "main" file and put it in its own file that everything using it can depend upon. This is typically done for the definition of...
... How does that work with code that has side effects? Would appreciate a pointer to the relevant section of the docs - I didn't know where to look. martin...
... Hmmm, still not entirely clear to me. There is only one 'dawg'? It must be initialized once when the program starts up? If so, just make it a global...
... You might also like to try: let dawg = lazy (Array. ...) and accessing it with "Lazy.force dawg". The code is then evaluated only the first time it is...
... Hash: SHA1 ... Just would like to point out there's nothing wrong with using classes. One of the best points of OCaml in my opinion is the ability to...
Peng Zang
peng.zang@...
Feb 4, 2008 1:48 pm
9319
I would propose a functor-based code which does pretty much the same :) like Jon has suggested in http://tech.groups.yahoo.com/group/ocaml_beginners/ ...
Hi ! I began to read about camlp4 and moved back. Will try to study again. Please have you got an example of preprocessor code to generate something like this...
... Hash: SHA1 Eta expansion: module MapPlus( Map : Map.S ) = struct include Map let of_list l = List.fold_left (fun m (x, y) -> add x y m) empty l end Peng ...
Peng Zang
peng.zang@...
Feb 10, 2008 4:22 am
9323
On Sat, 9 Feb 2008 23:21:57 -0500 ... Thanks a lot Peng for your efficient answer ! I didn't thought to have these 2 mistakes : you corrected them and all...
... Hash: SHA1 There's nothing wrong with using Map.add and Map.empty. I just used "add" and "empty" because it was shorter (I can do this because we already...
Peng Zang
peng.zang@...
Feb 10, 2008 3:44 pm
9325
Thanks for the detailed explanations ! On Sun, 10 Feb 2008 10:44:33 -0500 ... Another mistake I did, seeing unexistent errors ! ... Thanks, I've been able to...
I'm trying to translate some code to OCaml, but my OCaml is a little rusty. I ran into an interesting case though, and I can't seem to figure out how to...
Hello, ... [...] You have to provide the module type B, but you provide the module B. If you declare that there must be a module type B, then you have to...
Oliver Bandel
oliver@...
Feb 12, 2008 6:00 pm
9328
Hello, or better like this, because you need module B, not only the type... ================================ module type Bob = sig type t val read : t ->...
Oliver Bandel
oliver@...
Feb 12, 2008 6:03 pm
9329
...possibly functors make sense here. depends on what you want to have at the end (and how you want to use it). Ciao, oliver...
Oliver Bandel
oliver@...
Feb 12, 2008 6:07 pm
9330
Ah yes, I understand now, thanks. I only tried this unnatural nesting because entering the signatures separately produces an "unbound type constructor". For...
... You made the classical "module type contain another module type" error. You meant: module type Bob = sig type t val read : t -> string module B = sig type...
... Do you really need module type ? You don't seem to be using functor, so why don't you let the compiler find the module type by itself ? Or better, you...
... I believe I tried that. It produces a syntax error: Characters 18-21: sig ^^^ Syntax error: 'end' expected, the highlighted 'sig' might be unmatched ... I...
... I'll describe my abstract goals, so perhaps it's clearer what I'm trying to achieve. I want to define a pair of signatures that must both be provided ...
... Arg, my mistake. It is of course : module type Bob = sig type t val read : t -> string module B : sig type bt val compile : bt -> string -> t -> unit end ...
... a version that will do it: module type O = sig type t val read : t -> string end;; module type B = sig type bt type ot val compile : bt -> string -> ot ->...
... Excellent, thanks. This seems much more natural, and the point I'm trying to make is intact. ... Hmm, what's the reason for that? I would like to be able...