Probably an easy one for anyone who actually knows how to write macros in any Lisp. I want to be able to define synonyms for function names. I’ve been copy-and-paste hacking core.clj to do this, but I don’t want to be such a dunce forever! It seems obvious a macro that rewrites the call to a synoym-function into a call to the original function is the right way to do it.
Share
If I understand your question, there’s an easier way: def the new symbol to the old function.
The performance of def also outperforms the macro approach:
foo2 is then effectively an alias for + and behaves exactly the same way (being rewritten as +) except for the restrictions that are placed on using macros where a value must be returned.
If you want the behavior of the “alias” to be exactly the same as that of the original function (callable in the same contexts as well) then you need to use def to rename the function.