This question asks to create a Clojure macro to generate several functions. We figured out a way to do this but were stuck with the question of "Is this a good idea?".
My initial reaction is not really, for two reasons
- You then have functions that are not defined in your code, and this can complicate understanding your code quite a bit! (Imagine somebody has a problem with one of your functions and looks at the source code only to not find it anywhere).
- It is better to factor out the commonality of the code in a function or macro. Letting your computer write a bunch of functions that are very alike is a poor approach to that.
What do you think? When does generating functions in a Lisp make sense? Should it ever be 'on the fly' or would you prefer to have it in a file somewhere?