[Haskell-beginners] Where/Let clauses and subexpression repetition/memoization

Brandon Allbery allbery.b at gmail.com
Fri Aug 19 04:22:22 CEST 2011


On Thu, Aug 18, 2011 at 21:21, Michael Serra <mk.serra at gmail.com> wrote:

> My "superstition" here has been that the former only evaluates pxls' once,
> whereas the latter computes it twice.  This seems like a basic issue which
> must have been confirmed or debunked somewhere in my readings, but it hasn't
> sunk in with me.
>

As I understand it, common subexpression elimination in lazy languages is
difficult at best because the shared subexpressions may thereby become
ineligible for fusion, so you're expected to do it explicitly by means of
where/let clauses.  So your superstition is actually the truth.

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110818/e282065a/attachment.htm>


More information about the Beginners mailing list