Names for small functions: just say no... Re: Data.List.join

Jason Dagit dagit at
Fri Nov 10 04:13:10 EST 2006

On 11/9/06, Udo Stenzel <u.stenzel at> wrote:
> Jon Fairbairn wrote:
> > But not all patterns deserve names. To give a
> > reductio-ad-absurdam sort of analogy, suppose someone looked
> > at a lot of C and came to the conclusion that ???for (i=0,
> > i++, ...)??? occurred in 90% of programmes.  Were they to
> > reason that it would be worth #defining a macro FORI(...)
> > and using that instead, I suspect that the suggestion would
> > be roundly dismissed.
> Well, I presume you actually meant 'for( i=0; ... ; i++ )', an error
> which would have been avoided by using a macro.  Also, a macro would
> have liberated you of the choice between '++i' and 'i++', where '++i' is
> often more efficient (at least in C++).  And in C++, you're encouraged
> to use std::for_each anyway, which is the C++ way to spell 'mapM_'.
> Which would make your point kinda moot, but I'm not really convinced
> that arguments from a souped up assembly language can be used to make a
> point about Haskell.

To further belabor the point...In the linux kernel they almost exactly
do  what Jon was pointing out as a dismissable solution.  In the linux
kernel they do it for the kernel's data structures.  You can find
macros galore for manipulating lists and iterating over them[1].



More information about the Libraries mailing list