Revision as of 04:32, 8 May 2008

It is sometimes easier or more efficient to write functions which have particular "start arguments" or that pass state. When this is the case write wrappers rather than trying to code within the original signature.

3 Hiding the worker

Of course, one then has to de-hide the worker if one want to test it with different initial arguments.

In some cases, though, the worker can be a generally useful function on its own merits, in that case one obviously shouldn't hide it.

One common case is where you want to subject the worker function to Unit testing. In such a situation, the test suite has to be able to get to the worker function. Another is where the worker might be a candidate for further abstraction. (See Higher order function for examples.)