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=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 5871ABC69 for ; Thu, 18 Oct 2007 17:16:24 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FAAsVF0fRVaKxmGdsb2JhbACCOIwVAgEBBwQGERaBKQ X-IronPort-AV: E=Sophos;i="4.21,296,1188770400"; d="scan'208";a="18222155" Received: from el-out-1112.google.com ([209.85.162.177]) by mail4-smtp-sop.national.inria.fr with ESMTP; 18 Oct 2007 17:15:59 +0200 Received: by el-out-1112.google.com with SMTP id n30so58604elf for ; Thu, 18 Oct 2007 08:15:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=K8OjHlcQFsgCrrbRpqJxo+YHb9s65Nv3WAoFsrfQ6NM=; b=e5LYGZP49GJunAxEWMAzgG3IOmsLQ5afj/84AjlpyhFnU26pAFnJ5/t47Xlz4kfcArVNxizSvyeu+syww/MQtJM1akjMSBzhi9SKDuCpurdOtmIjBeX7knzqSWjh9vsL+YTTGDjwmLWS0faOyawGE3INe3gkc++oNJhzDSezu2U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DYpTKnhXE6bVJULyhHGLqPIWPdj20nc5p2pwqy8CI4XorgV+xfzMbROwsxzxskEeaTZt8nnsDsC0qqjCgNB/ahYaKbm6jKSg/5GEt9J656O6FShpjoXrso5rBfGpAlrngaPMDtlBTtdSLHioxrTjp6Jgk/ZvuGTBKt9E0KqMbB8= Received: by 10.142.125.5 with SMTP id x5mr197168wfc.1192720557594; Thu, 18 Oct 2007 08:15:57 -0700 (PDT) Received: by 10.143.7.19 with HTTP; Thu, 18 Oct 2007 08:15:57 -0700 (PDT) Message-ID: <9d3ec8300710180815r5dba9da1v2a163f6fc3847aab@mail.gmail.com> Date: Thu, 18 Oct 2007 11:15:57 -0400 From: "Till Varoquaux" To: "Jon Harrop" Subject: Re: [Caml-list] Help me find this pdf Cc: caml-list@yquem.inria.fr In-Reply-To: <200710181417.20870.jon@ffconsultancy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200710181325.30668.jon@ffconsultancy.com> <4717544B.3040000@lix.polytechnique.fr> <200710181417.20870.jon@ffconsultancy.com> X-Spam: no; 0.00; syme:01 afaik:01 ocaml:01 haskell:01 compilation:01 cheers:01 haskell:01 fpls:01 beginner's:01 ocaml:01 bug:01 frog:98 beginners:01 wrote:01 wrote:01 Lat time I checked Don Syme was working to optimize active patterns. At the time there wasn't (AFAIK) any way to "group" computation beetween active patterns. In ocaml pattern matching happens on all the patterns at once, as you go forward impossible cases are dropped, this is probably what is also done in Haskell. Ideally you'd want to: _Have a number of comparaisons that, in worst case complexity is O(n+m) where n is the length of your longest pattern and m is the number of your patterns. I don't know how this could be achieved with views. _Force a minimal number of values. I believe you need your pattern matching compilation to handle lazy cases specifically in order to get both of the above requirements. AliceML might do it. Cheers, Till On 10/18/07, Jon Harrop wrote: > On Thursday 18 October 2007 13:40:43 Arnaud Spiwack wrote: > > > Scala can do something similar by controlling evaluation simply by > > > altering the signature. However, I've reviewed Haskell recently and I > > > think complete laziness is more of a hindrance than a benefit. The only > > > think I'd like to see added to eager FPLs is the ability to pattern match > > > over lazy values, forcing them only when necessary. > > > > Which might simply need to have a support for views, wouldn't it ? > > Yes. F# provides pattern matching over lazy lists using exactly that technique > and views are more generally useful when dissecting data structures held in > foreign formats without copying them. > > However, implementing views is probably a lot harder than just implementing > pattern matching over lazy values. I suspect pattern matching over lazy > values could be implemented much more efficiently that the more general case > of views. > > -- > Dr Jon D Harrop, Flying Frog Consultancy Ltd. > http://www.ffconsultancy.com/products/?e > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- http://till-varoquaux.blogspot.com/