Monday, August 03, 2009

First class functions

First class functions are very useful.

In some code I wrote, the graphs needed to be plotted with linear scaling on both axes and also with the abscissa linear and the ordinate log. Neat thing is, I can pass in the plotting function to use to the code, then have it use that function. I can test which function was passed in and change some settings that are used to generate ideal case lines that look right in each graph.

Anyway, it makes your life easier some times, so give it a try!

No comments: