Re: [Caml-list] Name of currently executing function

2008-07-14 Thread Dave Benjamin
blue storm wrote: Here is a little camlp4 code for an ad-hoc solution : http://bluestorm.info/camlp4/Camlp4GenericProfiler.ml This works very well. Thank you very much for the example. On a related note, I was trying to understand how these new syntax filters work, and I am a bit confused by

Re: [Caml-list] Q: Profiling ocaml using gprof

2008-07-14 Thread Arthur Chan
Is gprof better for profiling ocaml than ocaml's own profilers? How would you go about figuring out that that particular function stub is string concat? On Mon, Jul 14, 2008 at 9:09 PM, Jake Donham <[EMAIL PROTECTED]> wrote: > On Mon, Jul 14, 2008 at 6:52 PM, Raj Bandyopadhyay <[EMAIL PROTECTE

Re: [Caml-list] Q: Profiling ocaml using gprof

2008-07-14 Thread Jake Donham
On Mon, Jul 14, 2008 at 6:52 PM, Raj Bandyopadhyay <[EMAIL PROTECTED]> wrote: > 'camlPervasives__$5e_136'. It's the string concatenation function (ASCII 5E is ^). It allocates a new string and blits the two argument strings into it, so you can probably do much better with explicit use of the Buf

[Caml-list] Q: Profiling ocaml using gprof

2008-07-14 Thread Raj Bandyopadhyay
Hi all I am profiling my OCaml program for performance using ocamlprof/ gprof. I keep seeing a particular function which takes up a significant % of time. In the gprof profile it shows up as 'camlPervasives__$5e_136'. Does anyone have an idea which function this might be? Thanks! Raj _

Re: [Caml-list] Troublesome nodes

2008-07-14 Thread Jeremy Yallop
Dario Teixeira wrote: type ('a, 'b) t = private 'a constraint 'a = [< super_node_t ] I don't think this is quite what you want yet, although it's getting close! The first problem is that phantom types must be implemented in terms of abstract (or at least generative) types. A simple exampl

Re: [Caml-list] Troublesome nodes

2008-07-14 Thread Dario Teixeira
Hi, After some trial and error in the top-level, I think I got the hang of the 'constraint' declaration (is there other documentation for it besides the couple of lines in the Reference Manual?). Note that besides the already discussed link/nonlink distinction between nodes, there is now also an

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 reare

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

2008-07-14 Thread Arthur Chan
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 their ugly end on me. It is equivalent to writing non-ortho

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 http://tech.groups.yahoo.com/group/o

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

2008-07-14 Thread Martin Jambon
On Mon, 14 Jul 2008, Andre Nathan wrote: 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? No. The usual

Re: [Caml-list] thousands of CPU cores

2008-07-14 Thread Jon Harrop
On Monday 14 July 2008 18:04:01 Mike Lin wrote: > Incidentally, it occurs to me that when one is optimizing the kind of tight > numerical loops that can really benefit from shared memory, the FIRST step, > before parallelizing, is to do away with any heap allocations in the loop. > The following is

Re: [Caml-list] thousands of CPU cores

2008-07-14 Thread Richard Jones
On Mon, Jul 14, 2008 at 01:08:23PM +0100, Jon Harrop wrote: > I believe you are correct. Moreover, I suspect that adding support for OpenMP > to OCaml would be difficult because the current OCaml implementation is > thread unsafe. OpenMP isn't your typical library. It's a set of wierd preproces

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

2008-07-14 Thread Jon Harrop
On Monday 14 July 2008 17:50:02 Andre Nathan wrote: > 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 recur

Re: [Caml-list] thousands of CPU cores

2008-07-14 Thread Mike Lin
On Mon, Jul 14, 2008 at 8:08 AM, Jon Harrop <[EMAIL PROTECTED]> wrote: > > Perhaps the parallel GC could enable support for things like OpenMP but I > personally would rather see a shift to similar functionality to that of > Microsoft's TPL because (I assume) it is better for parallel tree > opera

[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] Troublesome nodes

2008-07-14 Thread Dario Teixeira
Hi, > I was going to suggest boxing every node in an ordinary variant type with a > single private constructor: > > type 'a t = private Node of 'a constraint 'a = [< Node.super_node_t ] Thanks for the suggestion, Jon. Boxing every node is actually very welcome anyway, because later I would li

Re: [Caml-list] Why can't immediate objects be extended?

2008-07-14 Thread Keiko Nakata
Hello. > I'm wondering if there's a reason why one cannot inherit from > immediate objects? (See description at: > http://caml.inria.fr/pub/docs/manual-ocaml/manual005.html#ss:immediate-objects) > Is it just a syntax problem because the 'inherit' keyword currently > needs to take a class type, or

Re: [Caml-list] Name of currently executing function

2008-07-14 Thread blue storm
Here is a little camlp4 code for an ad-hoc solution : http://bluestorm.info/camlp4/Camlp4GenericProfiler.ml It's based upon the Camlp4Filters/Camlp4Profiler.ml from the camlp4 distribution. The GenericMake functor will traverse your code and apply the parametrized function to the body of each func

Re: [Caml-list] thousands of CPU cores

2008-07-14 Thread Jon Harrop
On Monday 14 July 2008 12:32:53 J C wrote: > On Thu, Jul 10, 2008 at 4:35 AM, Jon Harrop <[EMAIL PROTECTED]> wrote: > > OCaml already has OS native threads (albeit with a global lock), already > > supports OpenMP and can already be used to write parallel programs that > > exploit multiple cores. >

Re: [Caml-list] thousands of CPU cores

2008-07-14 Thread J C
On Thu, Jul 10, 2008 at 4:35 AM, Jon Harrop <[EMAIL PROTECTED]> wrote: > OCaml already has OS native threads (albeit with a global lock), already > supports OpenMP and can already be used to write parallel programs that > exploit multiple cores. > > ... > Incidentally, MP is good for distributed p