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 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 956B0BBCA for ; Thu, 28 Feb 2008 18:15:25 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAON6xkdQRFuwh2dsb2JhbACQcQEBAQgKKZxj X-IronPort-AV: E=Sophos;i="4.25,420,1199660400"; d="scan'208";a="7823495" Received: from furbychan.cocan.org ([80.68.91.176]) by mail2-smtp-roc.national.inria.fr with ESMTP; 28 Feb 2008 18:15:25 +0100 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1JUmLs-0003aJ-5l; Thu, 28 Feb 2008 17:15:24 +0000 Date: Thu, 28 Feb 2008 17:15:24 +0000 To: Fabrice Marchant Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Please a simple Camlp5 example Message-ID: <20080228171523.GA13606@annexia.org> References: <20080228164737.45250e33@orange.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080228164737.45250e33@orange.fr> User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Spam: no; 0.00; camlp:01 0100,:01 wiki:01 28,:98 wrote:01 caml-list:01 functions:01 string:02 string:02 macro:03 let:03 thu:05 implement:06 deriving:07 deriving:07 On Thu, Feb 28, 2008 at 04:47:37PM +0100, Fabrice Marchant wrote: > > Hi ! > > Aware that this belongs to beginners-list, I first posted there > three weeks ago, but without any answer : > > I bet this kind of code should be rather common : > > let string_of_piece_type = function > King -> "King" > | Queen -> "Queen" > | Rook -> "Rook" > | Bishop -> "Bishop" > | Knight -> "Knight" > | Pawn -> "Pawn" > > Please have you got an example where the macro helps to implement such kind of "string_of_type" function ? You probably want to look at deriving (http://code.google.com/p/deriving/) or tywith (http://www.seedwiki.com/wiki/shifting_focus/tywith) which can generate these functions automatically. Rich. -- Richard Jones Red Hat