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 d...@wp.pl 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 single construct using some
 existing OCaml tool?

 For example, I have a keyword function. The usual parser would contain a
 mapping like:
 function - `Function
 and the straightforward printer would do:
 `Function - function

 What is the best way to combine these definitions, so that duplication
 would be minimized?
 To be precise, avoiding duplication is not exactly what I need. I'm looking
 for something that would prevent making inconsistent changes to the parser
 and the printer.

 Dawid

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 is pass the regular expression and the string to match against.
The regular expression can be given in either the ~rex or ~pat named
arguments (not both). Use ~pat for hacking, and be sure to compile to ~rex
if you're doing lots of matches. Notice that almost every function has the
same arguments, so once you learn this one the others will make sense too.

extract is the second useful function. pmatch just returns true or false if
the regexp matches or not. extract will give you all the matching
substrings, which is useful to see what your regexp is actually doing (and
of course if you need the matched string for later use).

After you use these two functions you can start looking at the numerous
other ones that let you do more detailed things.

The regular expression I came up with for what you want is (a+|(aba)+)$.
Let's test it:

$ ocaml
Objective Caml version 3.12.0

# #require pcre;;
# open Pcre;;

# pmatch ~pat:(a+|(aba)+)$ abaaba;;
- : bool = true

# extract ~pat:(a+|(aba)+)$ abaaba;;
- : string array = [|abaaba; abaaba; aba|]

Note that extract gives as its first result the full match at index 0 and
then all the substrings that match. I'm actually not sure what the use of
this is, and I always set full_match to false to avoid the duplication.

# pmatch ~pat:(a+|(aba)+)$ abaa;;
- : bool = true

# extract ~full_match:false ~pat:(a+|(aba)+)$ abaa;;
- : string array = [|aa; |]

# pmatch ~pat:(a+|(aba)+)$ abb;;
- : bool = false

# extract ~full_match:false ~pat:(a+|(aba)+)$ abb;;
Exception: Not_found.

Hope that helps.


On Mon, Dec 6, 2010 at 6:29 PM, zaid khalid zaidbe...@yahoo.com wrote:

 Hi folks

 Thank you for all your replies. I think I am still struggling to find a
 solution to my issue using Str.regexp, and using Pcre-ocaml needs some
 time to be familiar with as there is no enough examples and discussion on
 it.

 Ill put my issue again as if someone can help me to find a solution to it
 with the Str .

 I want to define regular expression and after that I want to check if
 particular string is a prefix of the given regular expression.

 Example: a* | (aba)* so when you test abaaba the result will be true
 (complete match) and when we check abaa the result is true as well but
 when we check abb the result is false.

 I look forward to your suggestions.

 Cheers,
 Zaid


 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 hca...@atmos.umd.eduwrote:


 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-performance toplevel, combined with new
libraries like OCaml-R, would essentially make OCaml a competitor to Matlab
and R. This would really expand OCaml's scope to an important area.
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 al...@frisch.fr 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 programs to native code because the performance of the toplevel
is too slow. Then, I have to recompile and re-read the whole file for every
little additional thing I want to compute. A high-performance toplevel would
help in this kind of work.
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 st...@stecksoft.com wrote:

 Sylvain Le Gall sylv...@le-gall.net wrote:
  Would it be possible to publish them as an external library?

 What I did isn't really complete enough to constitute a library, I'd say.

 Here's what I did:

 From Pervasives:

  open_out_win32
  open_out_bin_win32
  open_out_gen_win32
  open_in_win32
  open_in_bin_win32
  open_in_gen_win32

 From Sys:

  file_exists_win32
  getcwd_win32
  chdir_win32
  missing: is_directory_win32, readdir_win32

 I did not code up Win32/UTF8 equivalents of anything in the Unix
 module.  A complete
 library of Win32/UTF8 file functions would include a number of items
 from that module.

 If anyone's interested in finishing off what I've done, I could send along
 what I have.

 -- Paul

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 = fun


On Mon, Sep 20, 2010 at 10:35 AM, Dumitru Potop-Butucaru 
dumitru.potop_butuc...@inria.fr wrote:


 Hello,

 I'm certain most users here will consider the question trivially simple,
 but I browsed the documentation without finding a solution.

 The question is quite general: Given a polymorphic definition like
 Map.Make(X), where
 X is some module, how can I specialize its 'a type parameter, e.g. by
 setting it to Y, so that
 I have maps from X to Y ?

 Yours,
 Jacky Potop

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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

2010-09-20 Thread Ashish Agarwal
Why do you want to do this? What benefit does it bring that cannot be
achieved by leaving the polymorphic type?

On Mon, Sep 20, 2010 at 1:25 PM, Dumitru Potop-Butucaru 
dumitru.potop_butuc...@inria.fr wrote:


 Actually, I was looking for a way to specialize a whole module,
 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 wrote:

 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 =fun


 On Mon, Sep 20, 2010 at 10:35 AM, Dumitru Potop-Butucaru
 dumitru.potop_butuc...@inria.fr  wrote:

  Hello,

 I'm certain most users here will consider the question trivially simple,
 but I browsed the documentation without finding a solution.

 The question is quite general: Given a polymorphic definition like
 Map.Make(X), where
 X is some module, how can I specialize its 'a type parameter, e.g. by
 setting it to Y, so that
 I have maps from X to Y ?

 Yours,
 Jacky Potop

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs




 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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

2010-09-20 Thread Ashish Agarwal
How about this:

--- a.mli ---
type map

val fold : (string - int - 'a - 'a) - map - 'a - 'a
val iter : (string - int - unit) - map - unit

--- a.ml ---
module M = Map.Make(String)
type map = int M.t
include M

You avoid boilerplate in the implementation, but I don't know how to avoid
writing out the restricted types in the signature.




On Mon, Sep 20, 2010 at 3:02 PM, Dumitru Potop-Butucaru 
dumitru.potop_butuc...@inria.fr wrote:


 Yes, but this involves duplicating code, and I really hate to duplicate
 code, even in interfaces.

 To also answer Ashish: I want to define an interface to modules where I use
 a very specific kind of map. Of course, I could leave Map.Make polymorphic,
 but that is a different module type than the one I want to use to represent
 my theory.

 Yours,
 Jacky



 On 20/09/2010 19:58, Martin Jambon wrote:

 Dumitru Potop-Butucaru wrote:

 Actually, I was looking for a way to specialize a whole module,
 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?

 I don't know about such a shortcut, but the following works and the
 interface
 is easier to use for a human:

 (* foo.mli *)
 type key = string
 type value = string
 type map
 val empty : map
 val is_empty : map -  bool
 val add : key -  value -  map -  map
 val find : key -  map -  value
 val remove : key -  map -  map
 val mem : key -  map -  bool
 val iter : (key -  value -  unit) -  map -  unit
 val map : (value -  value) -  map -  map
 val mapi : (key -  value -  value) -  map -  map
 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


 (* foo.ml *)
 module M = Map.Make (String)
 include M
 type value = string
 type map = string M.t



 Martin


  Yours,
 Jacky Potop




 On 20/09/2010 16:57, Ashish Agarwal wrote:

 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 =fun


 On Mon, Sep 20, 2010 at 10:35 AM, Dumitru Potop-Butucaru
 dumitru.potop_butuc...@inria.fr   wrote:

  Hello,

 I'm certain most users here will consider the question trivially
 simple,
 but I browsed the documentation without finding a solution.

 The question is quite general: Given a polymorphic definition like
 Map.Make(X), where
 X is some module, how can I specialize its 'a type parameter, e.g. by
 setting it to Y, so that
 I have maps from X to Y ?

 Yours,
 Jacky Potop

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs


  ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs




 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 martin.jam...@ens-lyon.orgwrote:

 Sylvain Le Gall wrote:
  Hello all,
 
  I would like to somehow enforce that a variant type is associated with
  an entry in a data list.
 
  For example,
 
  I would like to define:
 
  type license = GPL | LGPL
 
  and
 
  let data = [ GPL, GNU Public license;
   LGPL, GNU Lesser General Public license ]
 
 
  I would like to enforce that all variants of license are in the
  association list.
 
  I have tried to use polymorphic variants, but don't see how to enforce
  this constraint.
 
  The point, is that if I add a new variant to license (e.g. BSD3), the
  compiler output an error because this new variant is not in data list.
 
  Any ideas ? If you need to use another type expression rather than
  variant, please do so, as long as I am able to link the license type
  and data list.

 I don't see a solution other than meta-programming or runtime checks.

 Here is a simple code generator that would do the job:

 (* license_gen.ml *)
 open Printf

 let print_licenses l =
  printf type license =;
  List.iter (fun (k, v) - printf  | %s k) l;
  printf \n;
  printf let licences = [\n;
  List.iter (fun (k, v) - printf   %s, %S;\n k v) l;
  printf ]\n

 let () =
  print_licenses [
GPL, GNU Public license;
LGPL, GNU Lesser General Public license;
  ]

 (* end *)

 $ ocaml license_gen.ml  license.ml



 Martin

 --
 http://mjambon.com/

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 at 11:58 AM, Rich Neswold rich.nesw...@gmail.comwrote:

 On Wed, Jul 14, 2010 at 11:09 AM, Goswin von Brederlow 
 goswin-...@web.dewrote:

 4) Do some magic with Event.t?

 Problem: never used this and I could use a small example how to use
 this.


 Event.t (and its associated library) *is* magical in that it provides an
 absolutely beautiful concurrent programming model. Forget about select() and
 mutexes and other ugly threading concepts. Event.t and friends is how it
 should be done.

 John H. Reppy's Concurrent Programming in 
 MLhttp://sharingcentre.net/87081-concurrent-programming-ml.html
 provides a thorough understanding of how to use this module effectively.
 This book presents the material in a very understandable
 way: deficiencies in current threading models are discussed as well as how
 CML solves the limitations and constraints. The book can be purchased or
 downloaded free online.

 The few applications I've written that use CML, I found it was more than
 sufficient (speed-wise). Whether your application is more demanding, I can't
 tell.

 Hopefully someone on the list with more experience can comment whether
 there are caveats (performance-related or others) in OCaml's support of CML.
 If there are, there should be an effort in fixing the problems (I would help
 in any way I could.) I'd also recommend incorporating Satoshi Ogasawara's 
 Concurrent
 Cell http://caml.inria.fr/cgi-bin/hump.en.cgi?contrib=654 project into
 the standard library. (This project adds IVars and MVars and other
 constructs described in John H. Reppy's book, but not available in the OCaml
 standard library.)

 Hope this helps!

 --
 Rich

 Google Reader: https://www.google.com/reader/shared/rich.neswold
 Jabber ID: r...@neswold.homeunix.net

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 hrafael...@gmail.comwrote:

 Thanks Michael and Julien,

 That did the trick. I manually inserted the content of the Bar.mli and
 Foo.mli into the P.mli file. Guess unless it is some way to include this
 automatically the best will be to write a script to generate the P.mli file
 automatically based on current version of Bar.mli and Foo.mli as part of the
 build process.

 --
 Hans Ole


 On Fri, May 21, 2010 at 10:53 AM, Julien Signoles 
 julien.signo...@gmail.com wrote:

 Hello,

 2010/5/21 Hans Ole Rafaelsen hrafael...@gmail.com

 When packing a set of modules into a top module using -pack, is there a
 way to have some of the modules private to the package?

 If I have the modules Helper, Foo and Bar. Helper provides helper
 functions used by Foo and Bar. When I'm packing them into a top mudule P, I
 do not want to expose the functions of Helper to users of P.

 Is there some way to achieve this?  If not, do anyone know of other ways
 for packing libraries and keeping some of the modules private to the
 library?


 Just write yourself a file p.mli without your private modules:
 === p.mli ===
 module Foo : ...
 module Bar : ...
 ==
 Of course, you can not refer to signatures of modules Foo and Bar in
 p.mli. Thus you have to duplicate them or, better, to write them somewhere
 outside the package.

 From a compilation point of view, be sure to generate p.cmi by using p.mli
 before generating the pack files p.cm[ox].

 We use such a trick in the Frama-C tool (http://frama-c.com) for
 providing (usually empty) interfaces of its plug-ins. But I do not recommend
 you to read the Frama-C Makefiles for looking at the corresponding
 compilation lines (except if you are **very** motivated).

 Hope this helps,
 Julien



 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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, and you don't want to write the linking exception yourself,
then your only choice is 2.1.


On Thu, Apr 15, 2010 at 6:42 AM, Kaspar Rohrer kaspar.roh...@gmail.comwrote:

 Hi everybody

 Thanks for all the feedback and suggestions regarding hosting and licensing
 of my little library. I think I will host the code on github, because I
 really like the clean and shiny UI.
 As for the license, I'm strongly favoring the LGPL license ATM, but I am
 unsure whether I should go with version 2.1 or 3.0. And whether or not I
 need to add a linking exception. Any opinions on that?

 I'm currently documenting the source code and should be ready to release
 this evening.

 Thanks
 Kaspar Rohrer

 PS: Does somebody know why all of my browsers (Firefox, Safari, Camino on
 OS X 10.6) do not recognize the Forge.ocamlcore.org server certificate?

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 oli...@first.in-berlin.dewrote:

 Hello,


 where can I find the documenatation to pcre-ocaml?

 Some pages seem to be out dated.

 Where can I find the docs?


 Ciao,
   Oliver



 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[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 been able to find the necessary wording for the linking exception. I
find several using LGPLv2.1 but the sections have moved around in version 3
so I don't think the linking exception wording carries over.
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 if you are on one
of the previously mentioned OS's that already have good support for OCaml in
their native package management systems. Follow the link below, download
RocketBoost on the right, and follow the instructions. You can post to the
Beginner's List if you run into any trouble.

http://godi.camlcity.org/



On Tue, Mar 2, 2010 at 1:04 AM, Mihamina Rakotomandimby miham...@gulfsat.mg
 wrote:

  Peng Zang peng.z...@gmail.com :
  The best way to compile and install OCaml (in my opinion) is via GODI.

 Why?
 How to install GODI?

 --
   Architecte Informatique chez Blueline/Gulfsat:
Administration Systeme, Recherche  Developpement
+261 34 29 155 34 / +261 33 11 207 36

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 the compiler infer it?

Xavier paused for a second, and replied patiently with the following story:

One day, a disciple of another sect came to Xavier Leroy and said
mockingly...



On Tue, Feb 16, 2010 at 9:42 AM, Stefan Monnier monn...@iro.umontreal.cawrote:

  It sure does, tho not with fun but only with var definitions.
   ^^^
  val

Stefan blush!

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 martindeme...@gmail.comwrote:

 On Sat, Feb 6, 2010 at 5:44 PM, Tiphaine Turpin
 tiphaine.tur...@irisa.fr wrote:
  - the source folder tree is deep, and thus harder to grep

 tangentially, i've found that a great way to deal with that is to
 import the whole thing into a local git repository and then use git
 grep. works like a charm, and is *fast*.

 martin

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 rom...@bardou.fr wrote:

 Hello, dear Caml-list,

 I have a file ast.mli. It has no .ml implementation as it contains only
 type definitions.

 I have a file toto.ml, which contains simply:

 module A = Ast

 So I only use it as an abbreviation, to write A.t instead of Ast.t for
 instance.

 However, at link-time, the following error occurs:

 File _none_, line 1, characters 0-1:
 Error: Error while linking toto.cmo:
 Reference to undefined global `Ast'

 I found a workaround, which is to change ast.mli to put all type
 definitions in a signature, such as:

 module type Sig =
 sig
  type t = ...
  ...
 end

 And then, in toto.ml:

 module type A =
 sig
  include Ast.Sig
 end

 Is there any better way to write such a module abbreviation, without
 changing ast.mli? And, of course, without copying or renaming ast.mli
 into ast.ml.

 By the way, this is yet another evidence for the need of a construction
 sig of which would take a module (with or without implementation) and
 return its signature.

 Thanks,

 --
 Romain Bardou

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] Module abbreviation

2009-12-15 Thread Ashish Agarwal
 the example given compiles

Surprising! I see your point about the types working out, but this also
requires the additional assumption that the module type defined by ast.mli
will be ascribed specifically to a module named Ast. I suppose this is
consistent with how ocaml associates file names with modules so it works
out.


On Tue, Dec 15, 2009 at 6:28 PM, David Allsopp dra-n...@metastack.comwrote:

 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 statement works at a type system level
 (because you're dealing with a signature) and therefore only a .cmi file is
 required. It does not generate any work for the linker so a module called
 Ast is not actually needed when linking.

  Please double check your example. It cannot be working as you describe.

 I'm afraid you should have checked - the example given compiles (try ocamlc
 -o foo ast.mli toto.ml with suitable substitutions for the ...s)

 Romain Bardou wrote:

  I have a file ast.mli. It has no .ml implementation as it contains only
  type definitions.

 This is fine

  I have a file toto.ml, which contains simply:
 
  module A = Ast

 But as this involves a linker instruction you need an actual module - hence
 the error you're seeing. I guess you could argue that the module statement
 could check to see if Ast only contains type definitions and relax the need
 for an actual module but in the general case Ast could contain values and
 so
 you need a module to link against.

  I found a workaround, which is to change ast.mli to put all type
  definitions in a signature, such as:

 This workaround works because you take the whole thing back to the type
 system so module implementations are not required by the linker.


 David


___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 Matsen emat...@gmail.com wrote:

 Hi--


 This is such a common theme on this list, I wonder if it would be
 worth setting up a repository of well-commented Ocamlbuild examples.
 That would go a long way towards helping beginners (like myself) out.

 Would people be interested in contributing such examples? Any ideas
 about where to host them?


 Thanks,

 Erick

 On Wed, Oct 21, 2009 at 1:47 AM, Romain Bardou romain.bar...@lri.fr
 wrote:
  Sam Steingold a écrit :
  Hi,
 
  What documentation for ocamlbuild is available in in addition to
  http://brion.inria.fr/gallium/index.php/Ocamlbuild 
  http://nicolaspouillard.fr/ocamlbuild/ocamlbuild-user-guide.html?
 
  Hello,
 
  As far as I know there is none.
 
  --
  Romain Bardou
 
  ___
  Caml-list mailing list. Subscription management:
  http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
  Archives: http://caml.inria.fr
  Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
  Bug reports: http://caml.inria.fr/bin/caml-bugs
 

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 mrche...@gmail.comwrote:

 Dear list,

 I am trying to build ocamldoc documentation for an ocaml project that
 contains multiple packages (collections of modules built using
 -for-pack and -pack). My current setup generates documentation for
 each package but it won't generate hyperlinks to modules in other
 packages (module not found errors). I tried using the -load and -dump
 commands to allow ocamldoc see the ocamldoc-results of the referred to
 package, but I still get problems. I suspect that the problem arises
 because ocamldoc does not have a -pack option, so it always sees
 modules in a flat way. So if you have package Pack1 with module A, and
 module B in Pack2 which refers to Pack1.A.t, ocamldoc cannot solve
 this reference because it does not know that module A is inside
 another module called Pack1.

 The solutions I see right now seem to involve more effort than I am
 willing to spend. So, before I embark on a task that might take too
 long I would like to ask for tips on this. How do you perform ocamldoc
 generation for projects with multiple packages? Thanks!

 Cheers,

 Alexey

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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-book.pdf
[2] http://caml.inria.fr/pub/docs/manual-ocaml
[3] http://godi.camlcity.org


On Thu, Sep 3, 2009 at 5:36 PM, vernade vern...@free.fr wrote:


 Hello,
 I just downloaded ocaml (and caml-light) . I am looking for documentation
 on pdf
 or any format that I can easily download , read and print. I need basic
 information. All I found was on line and the help didn't come with the
 file I
 downloaded to install ocaml and caml-light.

 Didier

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 language features are altered. For example, the Batteries way is to
use input's instead of in_channel's. Documentation explaining such changes
would help. The API documentation is excellent, but what is missing is a
book on An Introduction to OCaml with Batteries. Perhaps a well planned
wiki would help get this started.

- Some assurance that Batteries really will become the de facto standard
would also help.

Having said that, I'm switching to Batteries soon. Thanks for all the hard
work!


On Thu, Sep 3, 2009 at 9:05 AM, Edgar Friendly thelema...@gmail.com wrote:

 It seems like batteries' adoption isn't quite as thorough as expected.
 We in the batteries devel team would love to know why you don't use
 batteries.  Here's some of our guesses:

 1) I *do* use batteries
 2) It's not 1.0 yet, I'll try it then
 3) It makes my executables too big
 4) It's too hard to install (dependencies, godi failures)
 5) It's difficult to compile against
 6) It doesn't work on my platform
 7) It uses camlp4
 8) Other (please explain)

 Respond in public if appropriate, respond directly to me if you want.
 Now's a good time to think about where batteries is going and how it's
 getting there.

 E

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 a...@mestan.fr wrote:

 On Thu, Sep 3, 2009 at 5:00 PM, Ashish Agarwal agarwal1...@gmail.comwrote:

 - Core language features are altered. For example, the Batteries way is to
 use input's instead of in_channel's. Documentation explaining such changes
 would help. The API documentation is excellent, but what is missing is a
 book on An Introduction to OCaml with Batteries. Perhaps a well planned
 wiki would help get this started.


 There's a French version : http://fr.wikibooks.org/wiki/Objective_Caml
 for which a translation had been started :
 http://en.wikibooks.org/wiki/Objective_Caml but it isn't up-to-date at
 all, nor finished.

 Still, the missing thing is time...


 --
 Alp Mestan
 http://blog.mestan.fr/
 http://alp.developpez.com/

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 like to achieve the following:

 # let x = 0;;
 val x : int = 0
 # let x = 1;;
 # x;;
 - : int = 0

 The following code is supposed to replace all toplevel phrases by
 ();; during parsing (just as an experiment, it renders the toplevel
 useless of course).

 let original = !Toploop.parse_toplevel_phrase;;

 Toploop.parse_toplevel_phrase :=
  fun _ - original (Lexing.from_string (();;));;

 After executing this, a non-terminating sequence is shown:
 - : unit = ()
 - : unit = ()
 - : unit = ()
 ...

 I'm probably not using the right hook. Any insight would be appreciated.

 Best,

 Roland

 --
 http://roland.zumkeller.googlepages.com/

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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=gstq=agarwal#af3cd471a808c8d9


On Wed, Jun 3, 2009 at 1:04 PM, Sébastien Hinderer 
sebastien.hinde...@ens-lyon.org wrote:

 Dear all,

 I'd like to add my vote to this issue:
 http://caml.inria.fr/mantis/view.php?id=3013
 I'm doing it here rather than on the bug tracking system because:

 1. There is an anti-spam protection which is image-based thus not
 blind-friendly, so that I can't sign up for an account on the BTS.

 2. This looks to me as a good opportunity to raise the issue here and
 see what people think about it.

 Regards,
 Sébastien.

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 hawki...@cs.stanford.eduwrote:

 Hi...

 I have a quick question. I want to extend the List module with various
 functions that I want that aren't present in the standard library,
 much as the Batteries ExtList library does.

 I might write the following code in mylibrary.ml:
 module MyList = struct
  include List
  let foo x = ... code here
  let bar y = ... code here
 end

 That's ok so far, but now suppose I want to write a mylibrary.mli
 interface file corresponding to mylibrary.ml. Ideally I'd write
 something like this in mylibrary.mli:
 module MyList : sig
  include List  (* unknown module type List *)
  val foo : ...
  val bar : ...
 end

 Unfortunately I can't include List here since it is a structure, not
 a signature. I don't think there is a way to say include the
 signature associated with List.

 I can think of three solutions:
 a) Copy the complete signature of List into MyList. This is a bad idea
 since the List module might change in the future. This is what the
 Batteries ExtList module does.
 b) Alter the List module to define a signature, say List.S, in
 addition to its other contents. I can't easily do this since I didn't
 write the List module.
 c) Don't write a .mli file at all.

 Are there any other alternatives?

 Cheers,
 Peter

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 j...@ffconsultancy.com 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 what people's thoughts are about mutable
 vs immutable strings?

 I had never thought about it until I started porting my OCaml code to F#
 where
 strings are immutable and I found immutable strings to be a PITA. Immutable
 array-based strings seem pointless to me but I'd still appreciate an
 immutable rope-based string...

 --
 Dr Jon Harrop, Flying Frog Consultancy Ltd.
 http://www.ffconsultancy.com/?e

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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
such file or directory, although I verified that _build/ocamlc does exist.
This seems like a different error than yours.

On Thu, Mar 5, 2009 at 10:39 AM, Joel Reymont joe...@gmail.com wrote:


 On Mar 5, 2009, at 3:10 PM, David Allsopp wrote:

  Have you tried building the normal way (./configure -cc gcc -m64  make
 world bootstrap opt opt.opt install)? fastbuild.sh is experimental IFAIK



 Makes no difference.

 make libraryopt
 cd stdlib; make allopt
 ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g `./Compflags
 pervasives.cmx` -c pervasives.ml
 /var/folders/pc/pcNEaYn32RW2i++8ZQvErU+++TM/-Tmp-/camlasm1dfba1.s:602:junk
 `...@plt' after expression
 /var/folders/pc/pcNEaYn32RW2i++8ZQvErU+++TM/-Tmp-/camlasm1dfba1.s:633:junk
 `...@plt' after expression
 ...
 File pervasives.ml, line 1, characters 0-1:
 Error: Assembler error, input left in file
 /var/folders/pc/pcNEaYn32RW2i++8ZQvErU+++TM/-Tmp-/camlasm1dfba1.s
 make[2]: *** [pervasives.cmx] Error 2
 make[1]: *** [libraryopt] Error 2
 make: *** [opt] Error 2

 ---
 http://tinyco.de
 Mac, C++, OCaml




 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 same
dependency information generated to compile an interface file. The same
libraries are needed to compile an interface file to a cmi file or to
documentation.


On Tue, Dec 23, 2008 at 5:32 AM, Nicolas Pouillard 
nicolas.pouill...@gmail.com wrote:

 Excerpts from Ashish Agarwal's message of Tue Dec 23 03:01:38 +0100 2008:
  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 get the
 documentation
  to work. The command that ocamlbuild executes is [1], which gives error
  [2]. Module M is declared in an external library. I get no errors if I
  manually type [3], where ~/mylibs contains the appropriate library.
  [1] ocamlfind ocamldoc -dump a.odoc a.mli
  [2] Unbound module M
  [3] ocamlfind ocamldoc -dump a.odoc -I ~/mylibs/ a.mli

 You should give the same flags for building and generating the
 documentation,
 for instance if you have:

   flag [ocaml, compile] (S[A-I; A.../mylibs])

 Then you need:

   flag [ocaml, doc] (S[A-I; A.../mylibs])

 HTH,

 --
 Nicolas Pouillard aka Ertai

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 j...@ffconsultancy.com wrote:

 On Tuesday 23 December 2008 06:07:37 Jon Harrop wrote:
  Yes. I'll do a bit more work on it and then tidy it up and document it
  before uploading it, unless there is any great interest from people now.

 Incidentally, I would like to know what performance issues (good and bad)
 people have with the current OCaml implementation?

 AFAICT, OCaml evolved from a family of languages that were only optimized
 for
 symbolic processing. Some of OCaml's relatives, like PolyML, were able to
 provide even faster symbolic processing than naive C but their numerical
 performance is 100x worse. These heavily-skewed performance characteristics
 rendered many ML implementations domain specific.

 I believe OCaml was the first ML to put an unusual amount of effort into
 optimizing other aspects, most notably high performance floating-point
 arithmetic and float arrays (where OCaml still thrashes SML/NJ and MLton).
 Moreover, I think OCaml became the world's favourite ML precisely because
 of
 this diversity.

 I am just looking at the simplest possible GC implementations, like shadow
 stack, and trying to envisage an ML implementation that puts a lot more
 effort into numerics and string processing and a lot less effort into
 symbolics. I am guessing the performance of allocation will be degraded
 10-100x but many allocations can be removed. This leaves me wondering how
 much slowdown is acceptable without deterring a lot of users?

 Anyway, I'll try to implement a simple GC and get some concrete performance
 results first...

 --
 Dr Jon Harrop, Flying Frog Consultancy Ltd.
 http://www.ffconsultancy.com/?e

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[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 get the documentation
to work. The command that ocamlbuild executes is [1], which gives error
[2]. Module M is declared in an external library. I get no errors if I
manually type [3], where ~/mylibs contains the appropriate library.
[1] ocamlfind ocamldoc -dump a.odoc a.mli
[2] Unbound module M
[3] ocamlfind ocamldoc -dump a.odoc -I ~/mylibs/ a.mli

Thank you.
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 the import command you propose requires an external
configuration. Would that be any easier than using include to define a new
module? Or is there supposed to be some other benefit I'm missing?
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 opened. There is no confusion about
private names in this case. If I am using Batteries, it will be clear which
module List refers to. The bureaucracy of writing open statements at the
top of every file would get cumbersome, but that can be avoided by the
proposed short-circuiting.


On Thu, Nov 20, 2008 at 6:29 AM, David Allsopp [EMAIL PROTECTED]wrote:

 On 20 November 2008 10:49, Stefano Zacchiroli wrote:
  On Thu, Nov 20, 2008 at 10:33:03AM +, Richard Jones wrote:
   Encouraging developers to open modules is also usually a bad idea,
   except in very limited circumstances (hello Printf).
 
  Why? You and others failed me to convince of this. Or, better, I'm
  sure there are problems with that, but they just show deficiencies
  inherited from other parts of the language.

 Consider

 open Array;;
 open List;;

 (* Hundreds of lines of code *)

 length [];;

 The code is now is brittle in terms of the order of the open statements at
 the top of the file and will fail to compile if they're swapped. Of course,
 if you don't care about that kind of subtle refactoring error then open is
 completely fine. Personally, I find that kind of brittleness irritating -
 and it also has the potential to waste a huge amount of time if you have to
 refactor the code.

 Whether you find code less readable with or without module names is of
 course a matter taste and IIRC, OCaml 3.11 .annot files contain the
 necessary information to expand them so there could be a nice editor plugin
 to expand or remove module paths...

 The most straightforward solution to this problem to me looks like
 providing a syntax equivalent like from Module import foo, bar
 which selectively imports only some identifiers from a given module.

 Which, for values only, is of course a trivial camlp4 extension... and
 could
 be generalised to include type declarations and so on with only a little
 more work. The .NET languages have a syntax for selectively importing
 classes from a namespace rather than the entire namespace (and it's
 different from Java's in that you can rename the class while you do it).


 David

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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

2008-10-22 Thread Ashish Agarwal
Thank you for the replies. In type_class.ml and type_class.mli, I
replaced (*pp cpp $ARCH_FLAGS *) with (*pp gcc -E $ARCH_FLAGS *). The
compilation gets further but now fails with:...
ocamlfind ocamlc -package type-conv -c -I +camlp4 -for-pack Bin_prot
binable.ml
File binable.ml, 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 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
   ...
   Line 93 of type_class.mli is:
   MK_BASE(unit)
 
  It's possible that the C-preprocessor works differently on Mac OS X.
  I haven't investigated this yet, but would be grateful if anybody who
  has set up Godi on a Mac could try to find a patch.

 There is something about the preprocessors on Mac OS X which causes cpp to
 behave differently from gcc -E; I've hit this before but can't remember the
 full explanation offhand.  You can see the difference, for example, if you
 try to use the ## operator.  Does everything work if you get everything
 to use gcc -E for preprocessing?

 Mark

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 -E $ARCH_FLAGS *).


 Another option is to use /usr/bin/cpp-4.2 instead of /usr/bin/cpp.

 After making symbolic link  ~/bin/cpp to /usr/bin/cpp-4.2 (and put `~/bin'
 in PATH),  I succeed to build bin-proto without source code modification.

 -- nobuyuki

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[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
...

Line 93 of type_class.mli is:
MK_BASE(unit)


On a Red Hat Enterprise Linux system, bin-prot successfully installs.
However, janestreet-core fails:

...
 ocamlfind ocamlc -package res,sexplib,bin_prot,threads -c -thread -dtypes
-for-pack Core -dtypes -I +camlp4 -I . binable.ml
 File binable.ml, line 12, characters 21-47:
 Unbound type constructor Map_to_safe.sw_arg
...

Line 12 of binable.ml is
val bin_sw_arg_t : binable Map_to_safe.sw_arg
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 certain platforms, e.g. all
 Linuxes I've ever used, the following works in a plain OCaml toplevel:

  #load nums.cma;;

 On other platforms, notably Cygwin, it doesn't. (At least, for OCaml
 3.10 on my version of Cygwin, which is not very old.)

  # #load nums.cma;;
  Cannot load required shared library dllnums.
  Reason: dllnums.so: dynamic loading not supported on this platform.

 I was sure that Mac OS X was among the platforms where this *doesn't*
 work, based on experiments a year or two ago. However I recently found
 that apparently it *does* after all work on my Mac. Since the original
 experiments I've upgraded the Mac to Leopard, and maybe I've even
 changed my OCaml version, though I don't remember for sure. Am I just
 plain wrong, or has this really only started to work recently?

 John.

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 an mli file mySig.mli? This would be very convenient.



On Thu, Sep 25, 2008 at 8:19 AM, Christian Sternagel 
[EMAIL PROTECTED] wrote:

 Hi there,

 when I have a file m.ml I can use

 include M

 in other *.ml files to include the content of m.ml. However, the same
 functionality for module types seems not to exist. I have an interface file
 m.mli and want to use

 include M

 within another *.mli file (so that I only have to write the documentation
 for module M once, namely in m.mli). But there is no
 module type M. Does anyone have the same problem and/or have a solution?

 cheers

 christian sternagel

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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 x

 a.mli:

  type t
  val f : t - unit

 b.ml:

  let f x = print_int 42

 b.mli:

  val f : A.t - unit


 Which results in This expression has type t but is here used with type
 A.t in a.ml, even though t and A.t are the same type. Is there a
 general solution for this kind of situation?

 Thanks,
 Andre

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


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=gstq=R#b92a26b04ce70c5d



On Thu, Jul 3, 2008 at 11:21 AM, Peng Zhang [EMAIL PROTECTED] wrote:

 Is it at all possible?

 Following the manual, I know I can call ocaml when C is the main
 program. I want to compile C file to Dynamic-link library, and call it
 from R.

 Can somebody help to answer it?

 Thanks,
 Peng

 On Tue, Jun 24, 2008 at 10:17 PM, Peng Zhang [EMAIL PROTECTED] wrote:
  Hi folks,
 
  I need some help from you. What I want to do is that my main program
  is in R and I want to implement part of it with ocaml.
 
  The following is an example.
 
  /* mysin.R */
  dyn.load(mysin.so)
  mysin - function(x)
   .C(mysin, as.double(x), r = double(1))$r
 
  /* mycode.ml */
  let sin_ml x = sin x
  let _ = Callback.register sin_ml sin_ml
 
  I want to use sin defined in mycode.ml in mysin.R
 
  Then I write the following stub code
 
  /* mysin.c */
  #include caml/mlvalues.h
  #include caml/memory.h
  #include caml/alloc.h
  #include caml/custom.h
  #include caml/callback.h
 
  void mysin(double * x, double * r){
   value * closure_f;
   caml_startup(NULL);
   closure_f = caml_named_value(sin_ml);
   *r = Double_val(caml_callback(*closure_f, caml_copy_double(*x)));
  }
 
  It isn't working right now. What I am not sure about is what to put in
  caml_startup.
 
  Can somebody help with me this? Thank you very much!
 
  Best,
  Peng
 

 ___
 Caml-list mailing list. Subscription management:
 http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
 Archives: http://caml.inria.fr
 Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
 Bug reports: http://caml.inria.fr/bin/caml-bugs

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs