From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 88AB1BDCB for ; Sat, 20 Aug 2005 15:26:14 +0200 (CEST) Received: from pih-relay04.plus.net (pih-relay04.plus.net [212.159.14.131]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j7KDQC5Y015927 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Sat, 20 Aug 2005 15:26:13 +0200 Received: from [80.229.56.224] (helo=chetara) by pih-relay04.plus.net with esmtp (Exim) id 1E6TMM-0003ds-QA for caml-list@yquem.inria.fr; Sat, 20 Aug 2005 14:26:06 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] recursive polymorphic variants? Date: Sat, 20 Aug 2005 14:23:16 +0100 User-Agent: KMail/1.7.2 References: <20050818212744.94BD41EB0C3@labrador.eecs.harvard.edu> <20050819.065118.03980029.garrigue@math.nagoya-u.ac.jp> In-Reply-To: <20050819.065118.03980029.garrigue@math.nagoya-u.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508201423.16571.jon@ffconsultancy.com> X-Miltered: at nez-perce with ID 43072F74.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 recursive:01 variants:01 abstracting:01 reuse:01 variants:01 cvs:01 ocaml:01 ocaml:01 ocaml's:01 stdlib:01 recursion:01 stdlib:01 recursive:01 unnamed:98 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Thursday 18 August 2005 22:51, Jacques Garrigue wrote: > Have a look at "Private rows: abstracting the unnamed" and > "Code reuse through polymorphic variants" at > http://www.math.nagoya-u.ac.jp/~garrigue/papers/ > > They both give examples of how to define extensible languages using > polymorphic variants. The first one relies on an experimental feature > only available in the CVS version of ocaml. Excellent papers, thanks. Firstly, may I ask if there is an ETA on the release of a new OCaml version with this added functionality? Secondly, I've been playing around with a term-level interpreter for a DSL and, in particular, have been looking at including O(n log n) patterns as well as a the usual linear patterns. I've done this by supplementing the usual list and array containers with a built-in set container based upon the one in OCaml's stdlib. As this is a set of values and a value can be a set, there is an obvious recursion. I implemented it by cut and pasting the stdlib code into my own and altering it to have mutually recursive "value set" and "value" comparison functions. Would your private row types let me do this without cut and pasting the code? I can't see how, but I'm hoping. :-) -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists