> Is it possible and senseful for a compiler to extract common
> sub-expressions? Naively I think that for a given tree of an
> expression it is efficiently possible to find all common sub-trees.
> Referential transparency would assure that equal expressions have the
> same value, so they can be replaced by the same object. E.g.  the
> example above could be automatically transformed to: 
> 
> ms as =
>    let tmp0 = zipWith (+) (zipWith (*) as tmp1) (0:tmp1)
>        tmp1 = 1:tmp0
>    in  tmp0

It's possible and will preserve semantics, but isn't always an
optimization.

http://www.haskell.org/pipermail/haskell-cafe/2003-December/005574.html
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to