From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA17808; Fri, 20 Jul 2001 22:10:13 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA17805 for ; Fri, 20 Jul 2001 22:10:12 +0200 (MET DST) Received: from mail4.microsoft.com (mail4.microsoft.com [131.107.3.122]) by concorde.inria.fr (8.11.1/8.10.0) with SMTP id f6KKABb01019 for ; Fri, 20 Jul 2001 22:10:11 +0200 (MET DST) Received: from 157.54.9.101 by mail4.microsoft.com (InterScan E-Mail VirusWall NT); Fri, 20 Jul 2001 13:09:59 -0700 (Pacific Daylight Time) Received: from red-msg-04.redmond.corp.microsoft.com ([157.54.12.74]) by inet-imc-01.redmond.corp.microsoft.com with Microsoft SMTPSVC(5.0.2195.2966); Fri, 20 Jul 2001 13:09:43 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.0.4712.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [Caml-list] Views Date: Fri, 20 Jul 2001 13:09:43 -0700 Message-ID: Thread-Topic: [Caml-list] Views Thread-Index: AcERUPs/MoFv1FCXRYylq+mRpXiDzgAA20Hg From: "Manuel Fahndrich" To: "Chris Hecker" , "Krishnaswami, Neel" , X-OriginalArrivalTime: 20 Jul 2001 20:09:43.0662 (UTC) FILETIME=[EA77A0E0:01C11157] Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk You might also want to look at a paper I wrote that is not referenced in Okasaki's paper. "Statically checkable pattern abstractions", ICFP'97. http://research.microsoft.com/~maf/papers.htm#Misc=20 In that paper we describe under what circumstances pattern matches with pattern abstractions (views) can still be verified for exhaustiveness and redundancy. This issue is not addressed in Okasaki's paper due to the particular semantics he chooses, namely to construct explicit values for the view and then match on those. In our paper, we do not construct the view values, but simply generate bindings for the free pattern variables. This raises a number of issues w.r.t. the matching semantics, and redundancy and exhaustiveness checking becomes non-trivial. At the same time, the pattern matching becomes more expressive, and it is possible to generate more efficient pattern matching code, without the need to construct the view values. The way in which pattern matching becomes more expressive is that one can write a view pattern Contains(x) | Empty for a list data type One can then write a pattern case e of Contains(5) =3D> (* do case where list contains a 5 *) | Contains(x) =3D> (* contains something, but no 5 *) | Empty =3D> (* list is empty *) As the example shows, the view transformation depends on nested patterns, e.g., the code that runs over the list is different if we match Contains(5), than if we match Contains(x). In the latter case, which element should we return, which gets us into the different possible match semantics (first, any, all). -Manuel =20 -----Original Message----- From: Chris Hecker [mailto:checker@d6.com]=20 Sent: Friday, July 20, 2001 12:08 PM To: Krishnaswami, Neel; caml-list@inria.fr Subject: [Caml-list] Views > Personally, I like views; here are some references >so you can judge for yourself: >http://www.cs.columbia.edu/~cdo/papers.html#ml98views >http://cm.bell-labs.com/cm/cs/who/wadler/papers/view/view.dvi >http://www.cs.orst.edu/~erwig/papers/abstracts.html#IFL96 Those are excellent! Exactly what I wanted and have wanted for a while when I realized that pattern matching didn't work on abstract types. Is there any chance of getting something like this into ocaml? What do the INRIA folks think about the idea? Chris ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr