Version française
Home     About     Download     Resources     Contact us    
Browse thread
Help me find this pdf
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Till Varoquaux <till.varoquaux@g...>
Subject: Re: [Caml-list] Help me find this pdf
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 <jon@ffconsultancy.com> 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/