Re: [Caml-list] Strange performance bug

2009-04-29 Thread Brighten Godfrey
On Apr 28, 2009, at 11:18 PM, Alain Frisch wrote: Brighten Godfrey wrote: (Changing to the precompiled regexp does make this bug go away -- but so do many other small changes, like commenting out the last line of the code, *after* the parsing is complete.) This last line (List.length

Re: [Caml-list] Strange performance bug

2009-04-29 Thread Brighten Godfrey
On Apr 28, 2009, at 11:37 PM, Alain Frisch wrote: Brighten Godfrey wrote: That occurred to me too, but there is no swapping. The process uses less than 40 MB of memory. Also, this wouldn't explain why it suddenly becomes slow exactly when it starts parsing the file the second time

Re: [Caml-list] Strange performance bug

2009-04-29 Thread Brighten Godfrey
On Apr 29, 2009, at 9:03 AM, Markus Mottl wrote: On Wed, Apr 29, 2009 at 10:48, Damien Doligez damien.doli...@inria.fr wrote: Markus, you put your finger right on the problem. That program doesn't suddenly start to get slow, it gets steadily slower as it runs. The heap also gets steadily

[Caml-list] Strange performance bug

2009-04-28 Thread Brighten Godfrey
Hi, I've encountered a very odd performance problem which I suspect is not a bug in my code. Could it be the compiler, or maybe PCRE? Here's the story. I'm parsing a file (using the PCRE library in one step). It goes quickly. When I parse the same file a second time, it goes an order

Re: [Caml-list] Strange performance bug

2009-04-28 Thread Brighten Godfrey
On Apr 28, 2009, at 8:37 PM, Markus Mottl wrote: On Tue, Apr 28, 2009 at 22:43, Brighten Godfrey p...@cs.berkeley.edu wrote: I've encountered a very odd performance problem which I suspect is not a bug in my code. Could it be the compiler, or maybe PCRE? I'm not sure it solves your

Re: [Caml-list] Teaching ocaml programming

2008-09-27 Thread Brighten Godfrey
, but certainly there may be other text editors that do. such as nedit -- see script below. On Sep 26, 2008, at 3:09 PM, Nathaniel Gray wrote: On Fri, Sep 26, 2008 at 5:10 AM, Brighten Godfrey [EMAIL PROTECTED] wrote: I use, on a daily basis, a small script which acts as a front-end to `make

Re: [Caml-list] Record field label locality

2008-08-14 Thread Brighten Godfrey
On Aug 13, 2008, at 5:48 AM, Edgar Friendly wrote: Brighten Godfrey wrote: Two things come to mind: (1) The type of get_f1 is handled analogously to the way it is handled for objects, something like this: val get_f1 : x : 'a; .. - 'a = fun I'm guessing that if you did this, you

Re: [Caml-list] Value shadowing

2008-08-13 Thread Brighten Godfrey
On Aug 13, 2008, at 1:54 AM, David Allsopp wrote: [ There's been at least one recent(ish) discussion on this - [1] ] Suppose I have this piece of code: let foo xs = match xs with x::xs - if x then xs (* Return the tail of the list *) else xs (* Return the

Re: [Caml-list] Value shadowing (tangent)

2008-08-13 Thread Brighten Godfrey
Going off on a tangent here... On Aug 13, 2008, at 2:56 AM, David Allsopp wrote: let lst = [5; 4; 3; 2; 1; 0; -1; -2; -3; -4; -5] in let filter = List.filter (fun x - x 0) in let double = List.map (fun x - -2 * x) in let sort = List.sort compare in (sort $$

Re: [Caml-list] Record field label locality

2008-08-12 Thread Brighten Godfrey
On Aug 10, 2008, at 12:38 PM, Jon Harrop wrote: On Sunday 10 August 2008 11:04:37 Brighten Godfrey wrote: Hi, Here's something that I've wondered about for years; maybe someone here can enlighten me. One of the few major annoyances in OCaml code style is that if I define a record in one

Re: [Caml-list] Record field label locality

2008-08-12 Thread Brighten Godfrey
On Aug 12, 2008, at 5:12 PM, Edgar Friendly wrote: Brighten Godfrey wrote: Actually, what I want seems to be the way OCaml treats methods in objects: given an object, you can name the method directly without mentioning its module. I can write a function let f x = x#some_method argument

[Caml-list] Record field label locality

2008-08-10 Thread Brighten Godfrey
' is a `Graph.t'? For example if I write something like let g : Graph.t = make_graph () in g.nodes it seems to me that on the second line, the type of `g' and hence the meaning of `g.nodes' is unambiguous. Thanks! ~Brighten Godfrey ___ Caml

[Caml-list] Getting an element of a hashtable: simple ... or is it?

2008-08-05 Thread Brighten Godfrey
; ) with Done - ()); match !el with None - raise Not_found | Some x - x But this seems clumsy. Any better ideas? Thanks, Brighten Godfrey ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman

Re: [Caml-list] Getting an element of a hashtable: simple ... or is it?

2008-08-05 Thread Brighten Godfrey
On Aug 5, 2008, at 5:16 AM, Richard Jones wrote: On Tue, Aug 05, 2008 at 05:05:46AM -0700, Brighten Godfrey wrote: Suppose you are given a data structure, and you want to retrive one element -- any one element. Sounds simple... and it is, if you have a list (List.hd list) or an array (arr.(0