Re: [Caml-list] AGI research using ocaml

2010-03-13 Thread Andre Nathan
Eray, You could consider using the Toploop module to interpret an ocaml program; for example, Toploop.use_silently Format.std_formatter foo.ml. This is what I do in OSpec to run the specification files. I haven't measured the overhead of using this module but at least you don't need to fork a

Re: [Caml-list] AGI research using ocaml

2010-03-13 Thread Andre Nathan
On Sat, 2010-03-13 at 17:39 +0200, Eray Ozkural wrote: Thanks for the suggestion. Perhaps it is possible to use the toplevel on a string based file? Then, there wouldn't be the I/O overhead at least, just buffering overhead. For some reason I can't find the documentation for this. It's weird.

[Caml-list] Toplevel.print_value

2009-09-10 Thread Andre Nathan
Hello Is it possible to use Toplevel's print_value function in a program linked against toplevellib.cma? The function has the following signature: val print_value: Env.t - Obj.t - formatter - Types.type_expr - unit I can't find out how to get a value of type Types.type_expr... Is there any way

Re: [Caml-list] Camlp4 help

2009-04-13 Thread Andre Nathan
On Sun, 2009-04-12 at 21:05 -0300, Andre Nathan wrote: If I simplify the rule above to forall; (; gen = expr; ); var = ipatt; .; e1 = expr; impl = OPT =; e2 = OPT expr - then everything after the dot is bound to e1, even when there's a =. For the archives, this happens because

[Caml-list] [ANN] OSpec 0.1.0 - BDD for OCaml

2009-04-02 Thread Andre Nathan
Hello I'm happy to announce the first public release of OSpec, an RSpec-inspired Behavior-Driven Development library for OCaml using a Camlp4 syntax extension. You can download this release from the ocamlcore forge at http://forge.ocamlcore.org/projects/ospec/ or directly clone the repository

[Caml-list] Toplevel with camlp4

2009-03-26 Thread Andre Nathan
Hello I have the simple program below: let () = Sys.interactive := false; Toploop.initialize_toplevel_env (); for i = 1 to (Array.length Sys.argv) - 1 do ignore (Toploop.use_file Format.std_formatter Sys.argv.(0)) done which works fine when compiled with $ ocamlc -o a

Re: [Caml-list] Toplevel with camlp4

2009-03-26 Thread Andre Nathan
On Thu, 2009-03-26 at 22:15 -0400, Peng Zang wrote: Are you using OCaml 3.10? I recall there's a bug that doesn't let you #use more than once due to bad file descriptors. It's been fixed in 3.11 That was it. Thanks! Andre ___ Caml-list mailing

[Caml-list] Revised syntax scope (3.10 vs. 3.11)

2009-03-26 Thread Andre Nathan
Hello I've found the following difference of behavior between OCaml 3.10 and 3.11. The code below :expr do { let a = foo in print_endline a; print_endline a } when run through camlp4o becomes, in 3.10, let a = foo in (print_endline a; print_endline a) while in

[Caml-list] Camlp4 help

2009-03-20 Thread Andre Nathan
Hello I'm just beginning with camlp4 here, and I'm stuck with what I think is a precedence issue. I have the following syntax extension: open Camlp4.PreCast open Syntax let sum = Gram.Entry.mk sum EXTEND Gram expr: LEVEL top [ [ sum; do; seq = LIST1 sum; done - :expr do {

Re: [Caml-list] [ANN] camlish: a simple module for shell scripting in OCaml

2008-10-27 Thread Andre Nathan
On Mon, 2008-10-27 at 14:11 +0100, Mikkel Fahnøe Jørgensen wrote: I'm currently adding a simple file globber. FWIW, http://github.com/andrenth/ocaml-glob/ Andre ___ Caml-list mailing list. Subscription management:

[Caml-list] Another question about modules

2008-07-15 Thread Andre Nathan
Hello I'm having an issue that is similar to the one reproduced in the code below: a.ml: module SubA : sig type t val f : t - unit val id : t - int end = struct type t = { id: int } let f = B.f let id x = x.id end a.mli: module SubA : sig type t val f

Re: [Caml-list] Another question about modules

2008-07-15 Thread Andre Nathan
dependency. How are you compiling? That should be the first error you get. On Tue, Jul 15, 2008 at 6:51 PM, Andre Nathan [EMAIL PROTECTED] wrote: I think this is similar to this simpler problem: a.ml: type t = { id: int } let f x

[Caml-list] Mutually recursive types in different modules

2008-07-14 Thread Andre Nathan
Hello Say I have the following type definition: type a = { x: int; foo: b } and b = { y: int; bar: a } Is it possible to define types a and b in their own files (thus in modules A and B) and still allow them to be mutually recursive? Thanks in advance, Andre

Re: [Caml-list] Mutually recursive types in different modules

2008-07-14 Thread Andre Nathan
On Mon, 2008-07-14 at 18:04 +0100, Jon Harrop wrote: Yes. See the OCaml Journal article Tricks with recursion: knots, modules and polymorphism or Google for the phrase untying the recursive knot. Thanks for the pointer. I've found the discussion at

Re: [Caml-list] Mutually recursive types in different modules

2008-07-14 Thread Andre Nathan
On Mon, 2008-07-14 at 10:57 -0700, Arthur Chan wrote: As Jon demonstrates it is possible, but I do not think it truly achieves what you are trying to do. What is your use case? I do not recommend trying to make types recursive across modules. Even recursively defined modules have reared