Re: [Caml-list] about OcamIL

2010-05-11 Thread Peng Zang
the bytecode bytecode interpreter == vm hence ocaml has a vm On Tue, May 11, 2010 at 6:39 PM, Peng Zang peng.z...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday 11 May 2010 07:22:56 am ben kuin wrote: I think this 3 point are REASONABLE but the combination of those 3

Re: [Caml-list] about OcamIL

2010-05-06 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 06 May 2010 06:43:21 am Dmitry Bely wrote: Ironically it's also not entirely true. F# works well under Mono/Unix. - Dmitry Bely A little off topic, but how is Mono/Unix these days? Last I checked (2 years ago) it implemented the

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

2010-03-01 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 The best way to compile and install OCaml (in my opinion) is via GODI. The GODI installation instructions are clear and allow you to specify where the install should go. Once installed, it's also easy to get all the other libraries you might want

Re: [Caml-list] Cartesian product

2009-07-30 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Not that I know of. But you can use this general implementation. It assumes you have Enum (from Batteries, and ExtLib before). The (~~) prefix operator is Obj.magic. Peng (* makes the cross product of the given array of enumerations *)

Re: [Caml-list] Batteries and portability

2009-06-13 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Has anyone pushed this patch upstream to the camomile author(s)? It seems like a good change that should be made in the original sources to make it more portable... Peng On Friday 12 June 2009 09:08:47 am Tiphaine Turpin wrote: The following

Re: [Caml-list] Width subtyping

2009-06-01 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Monday 01 June 2009 10:21:36 am David Allsopp wrote: Dario Teixeira wrote: Thanks -- that is also an interesting solution. I'm guessing it will be faster, though it might consume more memory in cases where only one field is actually used.

Re: [Caml-list] Shared types: circular dependency in modules with polymorphic type

2009-05-14 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I think this is because UI.t is abstract and is in fact, never created. You need to tell the old caml that UI.t is actuall an int VI.t. Then it should work. module Make_P (VI : VB) (UI : U with type t = int VI.t) (RI :

Re: [Caml-list] Shared types: circular dependency in modules with polymorphic type

2009-05-14 Thread Peng Zang
the feedback. Peng Zang wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I think this is because UI.t is abstract and is in fact, never created. You need to tell the old caml that UI.t is actuall an int VI.t. Then it should work. True. However in the real case I am not dealing

Re: [Caml-list] Subtyping

2009-04-07 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday 07 April 2009 03:41:32 am David MENTRE wrote: Hello, On Tue, Apr 7, 2009 at 07:48, Goswin von Brederlow goswin-...@web.de wrote: In the last 2 weeks I've been playing around with lots of different ways to do the same thing to get a

Re: [Caml-list] Bug? Constraints get ignored in methods

2009-03-31 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Here's an example of how constraints are specified for polymorphic methods. In this example I define a list type which can compare to anything that is foldable. class type ['a] foldable = object method foldl : 'z. ('z - 'a - 'z) - 'z -

Re: [Caml-list] class constraints

2009-03-27 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Perhaps you mean this? class type foo = object('self) method get_parent : 'self end class type foo2 = object('self) constraint foo2 = #foo method baz : float method get_parent : 'self end The error you get is because the

Re: [Caml-list] Toplevel with camlp4

2009-03-26 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Are you using OCaml 3.10? I recall there's a bug that doesn't let you #use more than once due to bad file descriptors. It's been fixed in 3.11 Peng On Thursday 26 March 2009 09:59:20 pm Andre Nathan wrote: Hello I have the simple program

[Caml-list] can anyone replicate this camlp4 problem?

2009-03-25 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, camlp4 seems to break parsing of object duplication on 3.11. Can anyone replicate this problem? Is this an known issue? A quick google search did not reveal anything.. Peng Objective Caml version 3.11.0 # #use topfind;;

Re: [Caml-list] can anyone replicate this camlp4 problem?

2009-03-25 Thread Peng Zang
) - arr.(3) + d; copy method print = Format.printf %d %d a b end But my brain is fried and I can't think of a nicer way.. Peng On Wednesday 25 March 2009 04:15:38 pm Peng Zang wrote: Thanks, do you know of a good work around? Peng On Wednesday 25 March 2009 04:01:24 pm Andres Varon

[Caml-list] Re: ocaml_beginners::[] interpreter type information

2009-03-08 Thread Peng Zang
thoughts to the list. (I would name it OCamlDev.el, but SOLID sounds better.) On Fri, Mar 6, 2009 at 9:58 PM, Peng Zang peng.z...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 It's available as an extension to the toplevel. See enhtop: http://caml.inria.fr/cgi-bin

Re: [Caml-list] Objects and variants

2009-03-06 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 You're looking for a polymorphic method: class a = object method f : 'a. ([] as 'a) - unit = fun _ - () end Peng On Friday 06 March 2009 10:57:43 am Samuel Mimram wrote: Hi, When I try to compile the following code: class a = object

Re: [Caml-list] stl?

2009-03-04 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wednesday 04 March 2009 01:11:18 am Brian Hurt wrote: This is another large factor. The three reasons functors aren't used very much are because: 1) They're a big, scary name, 2) They're slightly less efficient, 3) There are no good tutorials

Re: [Caml-list] stl?

2009-03-04 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wednesday 04 March 2009 11:14:50 am Brian Hurt wrote: Yeah. I think of this as one of the advantages of Functors. Here are two real problems I've hit with type classes, in only a few weeks banging around in Haskell. For example, you can't

Re: [Caml-list] Toplevel - loading dependencies

2009-01-09 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Shouldn't ocamldep be able to solve this? It can read a source file and figure out the dependencies. So you could in theory generate a fake source file that is just open A and it should figure out the set of dependencies for module A. Peng On

Re: [Caml-list] Question about optimization

2008-11-02 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have often found -inline 10 to be faster than -inline 100. But YMMV, Peng On Saturday 01 November 2008 10:52:49 pm MichaƂ C wrote: Hi! I'm working on a physical based ray(path) tracer and the performance is one of my top priorities (just

Re: [Caml-list] What does Jane Street use/want for an IDE? What about you?

2008-10-22 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday 21 October 2008 03:31:26 pm Till Varoquaux wrote: There is a mix of Emacs,vim,texmate and other esoteric editors being used here. We are all free to choose what we use but I think a lot of us decide to cope with a steeper learning curve

Re: [Caml-list] What does Jane Street use/want for an IDE? What about you?

2008-10-20 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have written smart autocompletion based on the toplevel in a mode I call SOLID. http://www.cc.gatech.edu/~pengzang/tools.html I've never gotten around to announcing it because it takes time to polish up and write good doc... time that I

Re: [Caml-list] What does Jane Street use/want for an IDE? What about you?

2008-10-20 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Monday 20 October 2008 07:02:46 pm Robert Morelli wrote: Because of its poor design, I lost the heart to try to program complex tasks in Emacs lisp quite a while ago, so I don't have everything fresh in my mind. Perhaps Peng Zang who posted

Re: [Caml-list] strange behavior with camlp4 and #use

2008-09-16 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday 16 September 2008 05:58:17 pm Hezekiah M. Carty wrote: I/O error: Bad file descriptor when I try to '#use somefile' several times (when camlp4 is turned on). Yes, this is an unfortunate error which came along with the new camlp4

Re: [Caml-list] on polymorphic compare and objects

2008-09-03 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wednesday 03 September 2008 02:31:10 am Alain Frisch wrote: Peng Zang wrote: For objects, we require that all objects implement an equal method that satisfies the semantic contract. How do you ensure that the method is indeed implemented

Re: [Caml-list] 'open' on objects?

2008-09-02 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday 02 September 2008 03:03:28 pm Chris Clearwater wrote: Is it possible to create an object by extending another object? I'd like to do something like this: ... object open (an_object:class_type) ... end ... The short answer is

[Caml-list] on polymorphic compare and objects

2008-09-02 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I recently came across a post on Janest lamenting the perils of polymorphic compare. http://ocaml.janestcapital.com/?q=comment/reply/33 They make a great point, and I thought of a solution that has worked well for me in the past few months that

Re: [Caml-list] typeclasses in OCaml

2008-08-23 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Friday 22 August 2008 10:57:53 pm Jacques Garrigue wrote: There is no way to specify a 'z version of 'self, and this is the reason you cannot do this in ocaml. Even if you don't require structural polymorphism for your object type (which you

[Caml-list] typeclasses in OCaml

2008-08-22 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I have been using the Object system in OCaml for the equivalent functionality of haskell typeclasses for some time. It allows nice things like: class type ['a] foldable = object method fold : 'z. ('z - 'a - 'z) - 'z - 'z end let

Re: [Caml-list] Typeclasses in OCaml (Was: Haskell vs OCaml)

2008-08-14 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 14 August 2008 10:46:41 am Jim Farrand wrote: Things like the (=) operator in OCaml vex me. One of the big advantages of static typing and type inference is that stupid programmer errors are prevented at compile time. However, the (=)

Re: [Caml-list] Typeclasses in OCaml (Was: Haskell vs OCaml)

2008-08-14 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 14 August 2008 12:04:23 pm Jim Farrand wrote: This doesn't answer my question at all. :) Is there any theoretical reason they couldn't added? The kind of answer I'm looking for is There is no theoretical reason why not, or This is

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

2008-08-08 Thread Peng Zang
(Hashtbl.enum hashtbl) val get_one : ('a, 'b) Hashtbl.t - ('a * 'b) option Ah, thanks. On Aug 5, 2008, at 6:21 AM, Peng Zang wrote: I think this is pretty standard. At least, I see it in ExtLib and I do it on a regular basis. In fact I have a function to do this for me so I don't have

Re: [Caml-list] native vs bytecode

2008-08-06 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 What do you mean by dynamically load? You cannot mix native and bytecode generally speaking. I don't know of any speed comparisons of OCaml bytecode. You can always compile to native code, which is faster, so I don't understand why you would want

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

2008-08-05 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I think this is pretty standard. At least, I see it in ExtLib and I do it on a regular basis. In fact I have a function to do this for me so I don't have to do it over and over again. Eg. let get_one ht = mkGetOne Hashtbl.iter ht Peng On

Re: [Caml-list] newbie: how to call a function with multiple parameters?

2008-08-05 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 You don't pass arguments like you do in C or Java. In those languages you might do: somefunction(arg1, arg2, arg3) In OCaml, you do: somefunction arg1 arg2 arg3 In OCaml, (arg1, arg2, arg3) means create a 3-tuple. somefunction(arg1, arg2,

Re: [Caml-list] Error: This function is applied to too many arguments, maybe you forgot a `; '

2008-08-05 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday 05 August 2008 08:11:40 am Richard Jones wrote: On Sun, Aug 03, 2008 at 08:46:32PM -0400, Ben Aurel wrote: print_int fac(6);; Read this: http://www.ocaml-tutorial.org/the_basics Rich. Second that. You really should take a look at

Re: [Caml-list] equality operators in OCaml

2008-07-25 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Friday 25 July 2008 04:14:22 pm Matthew William Cox wrote: On Thu, Jul 24, 2008 at 09:40:36PM -0400, Peng Zang wrote: Yeah, that always seemed broken to me. If two things are physically equal (they occupy the same memory space) it doesn't

Re: [Caml-list] thousands of CPU cores

2008-07-11 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 10 July 2008 10:00:02 am Jon Harrop wrote: Today's biggest shared-memory supercomputers already have thousands of cores. Also, this is a CNET article.. not exactly known for being in depth or well researched and this article is no

Re: [Caml-list] on objects, equality and playing nicely with the stdlib

2008-05-29 Thread Peng Zang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 29 May 2008 04:13:20 am Christophe Raffalli wrote: Via Custom block (section 18.9.1 of the manual), you could create a functor with the following shape (I did not check my syntax): module type Quotient = type t type qt val