Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2007-10-18 (15:16)
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
_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.


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.
> _______________________________________________
> Caml-list mailing list. Subscription management:
> Archives:
> Beginner's list:
> Bug reports: