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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id C1671BC6B for ; Wed, 11 Jul 2007 00:44:21 +0200 (CEST) Received: from pih-relay06.plus.net (pih-relay06.plus.net [212.159.14.133]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6AMiJsN013660 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 11 Jul 2007 00:44:21 +0200 Received: from [80.229.56.224] (helo=beast.local) by pih-relay06.plus.net with esmtp (Exim) id 1I8ORJ-0007wu-LS for caml-list@inria.fr; Tue, 10 Jul 2007 23:44:14 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@inria.fr Subject: Pattern matching over lazy lists Date: Tue, 10 Jul 2007 23:38:46 +0100 User-Agent: KMail/1.9.7 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200707102338.47010.jon@ffconsultancy.com> X-Miltered: at concorde with ID 46940BC3.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 frog:98 lazy:02 lazy:02 match:02 pattern:04 pattern:04 matching:05 matching:05 patterns:09 think:12 ltd:86 products:86 forcing:13 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... -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. The OCaml Journal http://www.ffconsultancy.com/products/ocaml_journal/?e