Re: [Caml-list] Doubt about function delaration parameter

2010-12-15 Thread Ashish Agarwal
Record field names must start with a lower case letter, so I cannot reproduce the error you mention. Also note you can simplify code like: print_string "foo"; (); to simply print_string "foo" Since print_string "foo" already returns unit, it is unnecessary to explicitly return unit aft

Re: [Caml-list] Define parser and printer consistently

2010-12-08 Thread Ashish Agarwal
Maybe you will find Pickler Combinators useful: http://research.microsoft.com/en-us/um/people/akenn/fun/picklercombinators.pdf On Wed, Dec 8, 2010 at 11:47 PM, Dawid Toton wrote: > I'm going to define a parser and a printer for a simple grammar. > Is there a way to define both of them in a sing

Re: [Caml-list] HELP : with regular expression

2010-12-07 Thread Ashish Agarwal
I know you're asking for a solution with Str. Since I can't help with that, let me give you the Pcre solution instead. Hopefully my explanations will make up for the lack of examples to help you start using it. pmatch is the function you care about. Ignore most of the arguments. All you need to do

Re: [Caml-list] Native toplevel? (was: OCamlJit 2.0)

2010-11-19 Thread Ashish Agarwal
On Fri, Nov 19, 2010 at 1:24 PM, Hezekiah M. Carty wrote: > > ocamlscript is certainly a wonderful tool, for prototyping and > otherwise. It unfortunately doesn't help specifically with the "load > a large file and do something with it" case. Right. Also, I should mention that a high-performan

Re: [Caml-list] Native toplevel? (was: OCamlJit 2.0)

2010-11-18 Thread Ashish Agarwal
On Wed, Nov 17, 2010 at 3:44 AM, Alain Frisch wrote: > Does performance really matter that much for rapid prototyping/development? Rapid prototyping for me often involves a couple of lines of code that read in a very large file and do something with it. I have to keep compiling these small prog

Re: [Caml-list] Re: Unicode, update

2010-10-19 Thread Ashish Agarwal
Have you considered adding these to the Batteries project? It would be good to get general purpose functionality added directly there. Also that way you don't have to feel you've done a lot of things; a single useful function could be added. On Mon, Oct 18, 2010 at 9:59 PM, Paul Steckler wrote:

Re: [Caml-list] How can I set a type parameter of Map.Make(X) ?

2010-09-20 Thread Ashish Agarwal
p >> val fold : (key -> value -> 'a -> 'a) -> map -> 'a -> 'a >> val compare : (value -> value -> int) -> map -> map -> int >> val equal : (value -> value -> bool) -> map -> map -> bool >> >

Re: [Caml-list] How can I set a type parameter of Map.Make(X) ?

2010-09-20 Thread Ashish Agarwal
t; not just the associated type (**this** I knew how to do). > I would like to write something like: > >include module type of Set.Make(String) with 'a= int > > Is this possible? > > Yours, > Jacky Potop > > > > > > On 20/09/2010 16:57, Ashish Agarwal

Re: [Caml-list] How can I set a type parameter of Map.Make(X) ?

2010-09-20 Thread Ashish Agarwal
module M = Map.Make(String) type t = int M.t Type t is the type of maps from string's to int's. Or alternatively write a function that assumes 'a is some specific type: # let f m = M.fold (fun _ x y -> x + y) m 0;; val f : int M.t -> int = On Mon, Sep 20, 2010 at 10:35 AM, Dumitru Potop-Butuc

Re: [Caml-list] Create a constraint between variant type and data list

2010-09-03 Thread Ashish Agarwal
See the Enum section of deriving: http://code.google.com/p/deriving/wiki/Introduction I haven't used it myself so cannot comment on how well it works. On Fri, Sep 3, 2010 at 2:51 PM, Martin Jambon wrote: > Sylvain Le Gall wrote: > > Hello all, > > > > I would like to somehow enforce that a vari

Re: [Caml-list] Smart ways to implement worker threads

2010-07-15 Thread Ashish Agarwal
The link given to Reppy's book leads to either: a direct download option which does not work, or a sponsored option which goes to sites that seem unreliable and require us to register. Is the download available more easily elsewhere? I didn't get anywhere with google. Thanks. On Thu, Jul 15, 2010

Re: [Caml-list] Private modules in packages

2010-05-21 Thread Ashish Agarwal
> write a script to generate the P.mli file Why do you need Bar.mli and Foo.mli at all? Just write the P.mli only. On Fri, May 21, 2010 at 5:51 AM, Hans Ole Rafaelsen wrote: > Thanks Michael and Julien, > > That did the trick. I manually inserted the content of the Bar.mli and > Foo.mli into th

Re: [Caml-list] Inspect libary

2010-04-15 Thread Ashish Agarwal
Regarding LGPL 2.1 versus 3.0, I recently tried finding the linking exception for 3.0 but concluded that no one has written it yet (from postings to the OCaml list, beginners list, and contacting the FSF). So if you're going to include the linking exception, which most LGPL'd ocaml libraries do, an

Re: [Caml-list] Ocaml-Pcre Documentation?

2010-04-08 Thread Ashish Agarwal
What do you need to know? Documentation for the underlying pcre library might be your best option. On Thu, Apr 8, 2010 at 3:06 PM, Oliver Bandel wrote: > Hello, > > > where can I find the documenatation to pcre-ocaml? > > Some pages seem to be out dated. > > Where can I find the docs? > > > Ciao

[Caml-list] LGPLv3 linking exception

2010-03-31 Thread Ashish Agarwal
>From older posts, I get the impression that OCaml's lack of support for dynamic linking affects the choice of including a linking exception in libraries released under GPL or LGPL. Can someone summarize the issue? Is there an OCaml library using an LGPLv3 + linking exception license? I've not bee

Re: [Caml-list] [newbie] miscellaneous on installation and web site

2010-03-02 Thread Ashish Agarwal
> Why? > How to install GODI? GODI is a very nice package management system for OCaml, making it trivial to install both OCaml and most OCaml libraries that are in common use. It automatically downloads and installs libraries, and checks for dependencies. I would recommend using it, unless perhaps

Re: [Caml-list] Re: The need to specify 'rec' in a recursive function defintion

2010-02-16 Thread Ashish Agarwal
It may be worth recalling the OCaml koans at http://eigenclass.org/hiki/fp-ocaml-koans. The first one is: let rec One day, a disciple of another sect came to Xavier Leroy and said mockingly: "The OCaml compiler seems very limited: why do you have to indicate when a function is recursive, cannot t

Re: [Caml-list] camlp4

2010-02-07 Thread Ashish Agarwal
> - the source folder tree is deep, and thus harder to grep I use find. $ find ./ -exec grep "foo" {} \; On Sun, Feb 7, 2010 at 12:19 PM, Martin DeMello wrote: > On Sat, Feb 6, 2010 at 5:44 PM, Tiphaine Turpin > wrote: > > - the source folder tree is deep, and thus harder to grep > > tangent

Re: [Caml-list] Module abbreviation

2009-12-15 Thread Ashish Agarwal
mes with modules so it works out. On Tue, Dec 15, 2009 at 6:28 PM, David Allsopp wrote: > Ashish Agarwal wrote: > > If you only have a file ast.mli, you should not be able to write Ast.Sig > because you do not have a module named Ast. > > This isn't true - the include statem

Re: [Caml-list] Module abbreviation

2009-12-15 Thread Ashish Agarwal
If you only have a file ast.mli, you should not be able to write Ast.Sig because you do not have a module named Ast. Please double check your example. It cannot be working as you describe. On Tue, Dec 15, 2009 at 11:39 AM, Romain Bardou wrote: > Hello, dear Caml-list, > > I have a file ast.mli.

Re: [Caml-list] ocamlbuild documentation

2009-10-21 Thread Ashish Agarwal
> Any ideas about where to host them? Why not at the first link given? It is a wiki. http://brion.inria.fr/gallium/index.php/Ocamlbuild Personally I think what's most needed is a description of the concepts, although examples of course would help too. On Wed, Oct 21, 2009 at 9:36 AM, Erick Mats

Re: [Caml-list] Ocamldoc and multiple packages

2009-09-11 Thread Ashish Agarwal
I don't know the answer but you might try using ocamlbuild's mlpack and odocl features, and see how it does it. On Fri, Sep 11, 2009 at 11:47 AM, Alexey Rodriguez wrote: > Dear list, > > I am trying to build ocamldoc documentation for an ocaml project that > contains multiple packages (collection

Re: [Caml-list] [ANN] ocaml-fileutils v0.4.0

2009-09-10 Thread Ashish Agarwal
Is there any plan to incorporate this into Batteries? On Wed, Sep 9, 2009 at 8:54 PM, Sylvain Le Gall wrote: > > Hello, > > Ocaml fileutils is aimed to be a platform independent library to perform > operation on file like: > - mv > - cp > - rm > - mkdir > - touch > - which... > > Comes also with

Re: [Caml-list] Documentation to start

2009-09-04 Thread Ashish Agarwal
I would recommend Jason Hickey's excellent book [1]. You can also look at the OCaml manual [2], but in my opinion this is better as reference. The easiest way to install OCaml depends on the OS you are using, but GODI [3] is a good choice for most systems. [1] http://files.metaprl.org/doc/ocaml-bo

Re: [Caml-list] Why don't you use batteries?

2009-09-03 Thread Ashish Agarwal
Great! I did not know this book was going to employ Batteries. That is a great step towards making Batteries the standard library. On Thu, Sep 3, 2009 at 2:24 PM, Alp Mestan wrote: > On Thu, Sep 3, 2009 at 5:00 PM, Ashish Agarwal wrote: > >> - Core language features are altered.

Re: [Caml-list] Why don't you use batteries?

2009-09-03 Thread Ashish Agarwal
I have been planning to start using Batteries for several months, but here are some reasons I have not yet: - It did not compile under godi, but I haven't tried in a while. - The migration will require changes across our code base. It's hard to set aside the time for such an undertaking. - Core

Re: [Caml-list] ignoring toplevel phrases?

2009-06-26 Thread Ashish Agarwal
Just curious, why do you want this? On Fri, Jun 26, 2009 at 12:22 AM, Roland Zumkeller < roland.zumkel...@gmail.com> wrote: > Hi, > > Is it possible to modify the toplevel's behavior such that it silently > ignores any re-definitions of already bound identifiers (without > recompiling)? I would l

Re: [Caml-list] Extending existing modules

2009-06-03 Thread Ashish Agarwal
A related request is that mli files result in named module types, which has been previously discussed: http://groups.google.com/group/fa.caml/browse_frm/thread/6485036bc24f262f/af3cd471a808c8d9?lnk=gst&q=agarwal#af3cd471a808c8d9 On Wed, Jun 3, 2009 at 1:04 PM, Sébastien Hinderer < sebastien.hinde

Re: [Caml-list] Extending modules and signatures

2009-04-21 Thread Ashish Agarwal
wever, it is not a good solution for libraries distributed to others. On Sun, Apr 19, 2009 at 8:06 PM, Martin Jambon wrote: > Ashish Agarwal wrote: > >> The module type exists, it's just that it doesn't have a name. > > > > Right, thanks for the clarification. &g

Re: [Caml-list] Extending modules and signatures

2009-04-19 Thread Ashish Agarwal
e any disadvantages. On Sat, Apr 18, 2009 at 10:20 AM, Martin Jambon wrote: > Ashish Agarwal wrote: > > This is a commonly requested feature. > > Ah. > > > One issue is that a file a.ml > > <http://a.ml> creates a module A. However, a file a.mli does not create

Re: [Caml-list] Extending modules and signatures

2009-04-17 Thread Ashish Agarwal
This is a commonly requested feature. One issue is that a file a.ml creates a module A. However, a file a.mli does not create a module type A. I'm not sure why this is the case. Does anyone know if there is a specific reason? On Fri, Apr 17, 2009 at 4:51 PM, Peter Hawkins wrote: > Hi... > > I hav

Re: [Caml-list] pattern matching and records vs tuples

2009-04-14 Thread Ashish Agarwal
> let { foo; bar } = x > bind the variable foo to the x.foo, and bind bar to x.bar > I'd prefer to have to annotate non-exhaustive records:>let { foo = foo; bar = bar } = x > should only match { foo; bar }, but >let { foo = foo; bar = bar; .. } = x, > can match records with more labels. B

Re: [Caml-list] Strings

2009-04-03 Thread Ashish Agarwal
> I found immutable strings to be a PITAin what way? On Fri, Apr 3, 2009 at 7:56 AM, Jon Harrop wrote: > > I read that batteries included provides first-class rope-based strings and > I > was just reading up on some horror stories about immutable strings on > StackOverflow. This made me wonder

Re: [Caml-list] building 64bit ocaml from cvs on mac osx leopard

2009-03-05 Thread Ashish Agarwal
I just did a fresh install and it is working fine for me when I use the normal method. The ocamlbuild method seems to compile fine, but make install gives some error. I checked ocamlbuild's log file and the last line says "Compilation successful", but when I do make install it says "cp: ocamlc: No

Re: [Caml-list] More Caml

2008-12-23 Thread Ashish Agarwal
> a lot more effort into numerics and string processing and a lot less effort into symbolics Is there any fundamental reason these two goals must be at odds? Why can't a compiler be good at numeric and symbolic computation? On Tue, Dec 23, 2008 at 4:59 AM, Jon Harrop wrote: > On Tuesday 23 Dece

Re: [Caml-list] ocamlbuild + ocamldoc + external library problems

2008-12-23 Thread Ashish Agarwal
Thank you. That does it. However, it seems not analogous to code compilation, for which what I did was add ocaml_lib ~extern:true ~dir:"~/mylibs" "mylib2"; to myocamlbuild.ml and then use the _tags file to specify which files require mylib2. I wonder why the call to ocamldoc cannot use the s

[Caml-list] ocamlbuild + ocamldoc + external library problems

2008-12-22 Thread Ashish Agarwal
How can I get ocamlbuild to include paths to external libraries when building documentation? Ocamlbuild gives me errors when building documentation, when my interface files contain references to an external library. I have set up my plugin and _tags file to correctly compile the code, but cannot ge

Re: [Caml-list] About namespaces

2008-11-22 Thread Ashish Agarwal
> Among other things, this means that if I write an extension MyList to > List and someone else writes and extension HisList to List, there is no > automated way to merge these, I need to write yet another module > LatestList to be able to use both extensions at the same time. Merging these with

Re: [Caml-list] open Module (not?) considered harmful

2008-11-20 Thread Ashish Agarwal
> Consider > > open Array;; > open List;; I doubt anyone is recommending this. The module design dictates, to some extent, whether the module should be opened. Array and List clearly should not since they have commonly used function names. However, the proposed Data.Containers certainly should be

Fwd: [Caml-list] problem installing janestreet core through godi

2008-10-22 Thread Ashish Agarwal
I only had cpp-4.0 and tried your suggestion with that; bin-prot compiles completely. On Wed, Oct 22, 2008 at 1:57 PM, Nobuyuki TOMIZAWA < [EMAIL PROTECTED]> wrote: > Hi, list, > > Thank you for the replies. In type_class.ml and type_class.mli, I > replaced (*pp cpp $ARCH_FLAGS *) with (*pp gcc

Re: [Caml-list] problem installing janestreet core through godi

2008-10-22 Thread Ashish Agarwal
;, line 36, characters 21-46: Unbound type constructor Type_class.writer On Wed, Oct 22, 2008 at 4:16 AM, Mark Shinwell <[EMAIL PROTECTED]>wrote: > On Tue, Oct 21, 2008 at 04:22:09PM -0400, Markus Mottl wrote: > > 2008/10/21 Ashish Agarwal <[EMAIL PROTECTED]>: > > > I am hav

[Caml-list] problem installing janestreet core through godi

2008-10-21 Thread Ashish Agarwal
I am having trouble installing JaneStreet's Core library through godi. On Mac OS X, it fails while installing the prerequisite bin-prot: ... > ocamlfind ocamlc -package type-conv -c -pp "cpp $ARCH_FLAGS " -I +camlp4 type_class.mli > File "type_class.mli", line 93, characters 15-16: > Syntax error

Re: [Caml-list] Dynamic loading on Mac OS X

2008-10-16 Thread Ashish Agarwal
See this post on beginner's list: http://tech.groups.yahoo.com/group/ocaml_beginners/message/6905 On Wed, Oct 15, 2008 at 4:14 PM, Harrison, John R <[EMAIL PROTECTED] > wrote: > This discussion of dynamic loading in 3.11 reminded me of a more basic > question I meant to ask, but never did. On ce

[Caml-list] ocamlbuild not including dependencies with mlpack

2008-10-06 Thread Ashish Agarwal
Ocamlbuild seems to not include dependent modules when building a library, when that library is defined by an mlpack file. However, it works fine if I manually pack, i.e. define an ml file instead of an mlpack file. Here's a summary: --- mylib.mlpack --- A B $ ocamlbuild mylib.cma $ cat _build/_l

Re: [Caml-list] Default module type?

2008-09-25 Thread Ashish Agarwal
That is correct. You have to define a module type within an ml file, and then include that. See the following thread on the beginner's list. http://tech.groups.yahoo.com/group/ocaml_beginners/message/8992 However, I never did find out why. Why does the compiler not create a module type MySig from

Re: [Caml-list] Re: how do you compile

2008-08-06 Thread Ashish Agarwal
Use ocamlbuild. You can simply type "ocamlbuild lazy_lists.native" or "ocamlbuild lazy_lists.byte" to produce native or byte code respectively. All compiled files get put in a separate directory called _build. On Wed, Aug 6, 2008 at 10:39 AM, Ben Aurel <[EMAIL PROTECTED]> wrote: > > then, the 'fi

Re: [Caml-list] how to print (or cast) an integer

2008-08-06 Thread Ashish Agarwal
Also note you do not need "and". That is only required when the variables being defined are mutually recursive. It would be better style to write: let x = 1;; let y = 2;; On Wed, Aug 6, 2008 at 10:08 AM, Ben Aurel <[EMAIL PROTECTED]> wrote: > hi > > again a noob question > > -- > 1 let x = 1 an

Re: [Caml-list] Another question about modules

2008-07-15 Thread Ashish Agarwal
meter to many functions, since the call to what was > B.f here is somewhat deep in the call stack, so maybe there is a better > solution. > > Thanks, > Andre > > On Tue, 2008-07-15 at 20:18 -0400, Ashish Agarwal wrote: > > Firstly, you have a circular dependency. How are you

Re: [Caml-list] Another question about modules

2008-07-15 Thread Ashish Agarwal
Firstly, you have a circular 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 = print_int x.id; B.f

Re: [Caml-list] Re: call ocaml from R

2008-07-03 Thread Ashish Agarwal
There was some discussion about this on the main list, but there was no clear answer. http://groups.google.com/group/fa.caml/browse_thread/thread/46ad55d2102c1898/b92a26b04ce70c5d?lnk=gst&q=R#b92a26b04ce70c5d On Thu, Jul 3, 2008 at 11:21 AM, Peng Zhang <[EMAIL PROTECTED]> wrote: > Is it at all

[Caml-list] ocamlbuild fails to link dependent module

2008-06-30 Thread Ashish Agarwal
I cannot get ocamlbuild to link properly under a very specific situation that involves nested and packed modules. The following is a minimal example that reproduces the problem. $ cat a2.mli val f : unit -> unit $ cat a2.ml let f _ = () $ cat lib.ml module A = A2 $ cat b.ml let g = Lib.A.f $ ca

Re: [Caml-list] Core has landed

2008-05-06 Thread Ashish Agarwal
tl <[EMAIL PROTECTED]> wrote: > 2008/5/3 Ashish Agarwal <[EMAIL PROTECTED]>: > > When doing "make", I get the error below. I think I have sexplib > installed > > correctly (through godi), and have tried on both Mac OS and Linux. > Anyone > > else get this

Re: [Caml-list] Core has landed

2008-05-03 Thread Ashish Agarwal
When doing "make", I get the error below. I think I have sexplib installed correctly (through godi), and have tried on both Mac OS and Linux. Anyone else get this error? File "core_sexp.mli", line 2, characters 8-27: Unbound module type Sexplib.Sexp_intf.S 2008/5/3 Yaron Minsky <[EMAIL PROTECTED

Re: [Caml-list] Invoking the standard library ?

2008-04-29 Thread Ashish Agarwal
After various attempts at this problem a couple months ago, I settled for the following (not ideal) solution. I suffix all modules I am extending with a 2. Then I package them up in a module named Lib2, which is defined such that doing "open Lib2" serves as a drop-in replacement for the Standard Li