[Haskell-beginners] Performance of function defined in a 'where' clause

Brent Yorgey byorgey at seas.upenn.edu
Sat May 9 21:11:11 EDT 2009


On Sat, May 09, 2009 at 05:50:33PM +0100, Kevin Haines wrote:
>
> palette = listArray (0,49) paletteList
> paletteList = [
>             Palette 0 0 0,
>             Palette 0 0 0,
>             Palette 0 0 0,
> 		.....

By the way, this should probably be something like

  palette = listArray (0,49) (replicate 50 $ Palette 0 0 0)

Unless, of course, there are things other than Palette 0 0 0 in the
remainder of the list.  If you ever have to copy and paste *anything*
in a Haskell program, warning bells should start going off in your
head. =)

Unfortunately, performance tuning is a black art of which I know
precious little.  Perhaps others will have some good suggestions.

-Brent


More information about the Beginners mailing list