From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 17EF2BB84 for ; Tue, 17 Jun 2008 23:58:41 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgwBAL/QV0hTkhUImmdsb2JhbACSNwEBAQEBCAUIBxEDnSU X-IronPort-AV: E=Sophos;i="4.27,660,1204498800"; d="scan'208";a="12197148" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 17 Jun 2008 23:58:41 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m5HLwXR1000897 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 17 Jun 2008 23:58:40 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgwBAL/QV0hTkhUImmdsb2JhbACSNwEBAQEBCAUIBxEDnSU X-IronPort-AV: E=Sophos;i="4.27,660,1204498800"; d="scan'208";a="12197147" Received: from smtp.bulldogdsl.com (HELO cht-smtp-002.bulldogdsl.com) ([83.146.21.8]) by mail2-smtp-roc.national.inria.fr with ESMTP; 17 Jun 2008 23:58:40 +0200 Received: by cht-smtp-002.bulldogdsl.com (Postfix, from userid 1002) id A063C1E41D2; Tue, 17 Jun 2008 22:58:39 +0100 (BST) Received: from [192.168.123.191] (host-84-9-233-143.dslgb.com [84.9.233.143]) by cht-smtp-002.bulldogdsl.com (Postfix) with ESMTP id 3A0A81E41EB; Tue, 17 Jun 2008 22:58:36 +0100 (BST) Message-ID: <4858338B.3020103@ed.ac.uk> Date: Tue, 17 Jun 2008 22:58:35 +0100 From: Jeremy Yallop User-Agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509) MIME-Version: 1.0 To: Nathaniel Gray Cc: caml-list@inria.fr Subject: Re: [Caml-list] ANN: patterns v0.4 References: <48579E13.8070706@ed.ac.uk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4858338A.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 camlp:01 camlp:01 -like:01 icfp:01 variants:01 ocaml:01 0.4:98 polymorphic:01 wrote:01 wrote:01 caml-list:01 jambon:01 seems:03 pattern:04 Nathaniel Gray wrote: > On Tue, Jun 17, 2008 at 4:20 AM, Jeremy Yallop wrote: >> I'm pleased to announce a new release of `patterns', an OCaml >> framework for writing extensions to pattern matching using Camlp4. > > Ooh, very interesting! Have you looked at "active patterns" in F#? > They look really useful and I've been wanting to code them up in > camlp4 for a while now but haven't had the time. It sounds like your > framework could make that much easier. Yes, one of the reason for writing the framework was to be able to implement F#-like active patterns. I think it should be reasonably straightforward to do -- in fact, I'd expect design considerations to take up more time than actual implementation work (although I say that from the perspective of being already familiar with the "patterns" framework, of course). If I remember rightly, there's a note at the end of the ICFP07 active patterns paper about using polymorphic variants to add active patterns in OCaml, which seems like it might be a good starting point. You might also be interested in the "views" feature of Martin Jambon's "Micmatch", which is along the same lines as active patterns: http://martin.jambon.free.fr/micmatch-manual.html#htoc10 Jeremy.