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=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 91A81BC6B for ; Wed, 11 Jul 2007 17:51:31 +0200 (CEST) Received: from out2.smtp.messagingengine.com (out2.smtp.messagingengine.com [66.111.4.26]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6BFpUIC016631 for ; Wed, 11 Jul 2007 17:51:31 +0200 Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 62A698FED; Wed, 11 Jul 2007 11:51:26 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 11 Jul 2007 11:51:27 -0400 X-Sasl-enc: fiPnNzS995kKbGDSBdMWiyfaUhctGVtfOpFIUbMyJV2x 1184169086 Received: from [192.168.1.10] (AMontsouris-753-1-9-100.w90-2.abo.wanadoo.fr [90.2.133.100]) by mail.messagingengine.com (Postfix) with ESMTP id DC0D21EA53; Wed, 11 Jul 2007 11:51:25 -0400 (EDT) Date: Wed, 11 Jul 2007 17:51:16 +0200 (CEST) From: Martin Jambon X-X-Sender: martin@martin.ec.wink.com To: Jon Harrop Cc: caml-list@inria.fr Subject: Re: [Caml-list] Pattern matching over lazy lists In-Reply-To: <200707102338.47010.jon@ffconsultancy.com> Message-ID: References: <200707102338.47010.jon@ffconsultancy.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at discorde with ID 4694FC82.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 camlp:01 2007,:98 wrote:01 caml-list:01 jambon:01 jambon:01 lazy:02 lazy:02 match:02 pattern:04 pattern:04 jul:04 matching:05 matching:05 On Tue, 10 Jul 2007, Jon Harrop wrote: > > What's the best way to do this? > > I was thinking of forcing the first few elements of a lazy list before pattern > matching and then looking for forced values in the lists as patterns but I > don't think you can deconstruct a lazy value in a pattern match... You can use this approach: http://martin.jambon.free.fr/micmatch-manual.html#htoc13 I found this convenient for "sliding window" signal analysis. It requires micmatch and a 3.09-compatible version of camlp4. Martin