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 E815FBC6B for ; Sat, 18 Aug 2007 17:08:42 +0200 (CEST) Received: from pih-relay05.plus.net (pih-relay05.plus.net [212.159.14.132]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l7IF8gVe017789 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Sat, 18 Aug 2007 17:08:42 +0200 Received: from [80.229.56.224] (helo=beast.local) by pih-relay05.plus.net with esmtp (Exim) id 1IMPus-00016i-0C for caml-list@yquem.inria.fr; Sat, 18 Aug 2007 16:08:42 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Pattern matching over lazy values Date: Sat, 18 Aug 2007 15:57:31 +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: <200708181557.32056.jon@ffconsultancy.com> X-Miltered: at concorde with ID 46C70B7A.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; syntax:01 syntax:01 foo:01 val:01 compiler:01 ocaml:01 ocaml:01 highlighted:98 frog:98 lazy:02 lazy:02 match:02 match:02 let:03 pattern:04 Incidentally, would it not be enormously beneficial to be able to pattern match over lazy values? This syntax is never used: # fun (x y) -> true;; Syntax error: ')' expected, the highlighted '(' might be unmatched so you can allow "lazy foo" as a pattern: # let force (lazy n) = n;; val force : 'a lazy_t -> 'a and then make the pattern match force lazy values only as it comes across them, so you can pattern match over lazy trees. I can't see any way to do this without hacking the compiler... -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. OCaml for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists/?e