Thank you Robert for clarifying the case I mentioned.
I tried to play with cond/case/when instead of defun and this also was not much successful. May be I do something wrong from CL perspective. But let me explain in general what is the purpose.
I always felt a lack of meta-programming in Erlang. For example I need to parse some protocol. And code should be efficient (as much as it can be in Erlang). Natural approach is to have multi-head function with patterns for any piece of API/Protocol input. This may be a tedious work. And when you have to match a lot of similar patterns with difference in details, meta-programming might help.
Initial idea was to implement a macros, when you write:
(some-parser-macro (1 'a) (2 'b) (3 'c))
and this would work like if you write:
(defun some-parser
Or even better, adding one more macro:
(defmacro some-pattern-to-result-mapping
((1) 'a)
((2) 'b)
((3) 'c))
and writing
(another-parser-macro (1 2 3))
to have it producing same matching function.
My examples are primitive, just to give an idea. Real matching patterns and actions are functions of many parameters and number of patterns will be roughly product of dimensions.
I understand that all this "magic" I can do following "data is program and vice versa" idiom, but I want it to happen at compile-time, not runtime.
At this point I don't see clear way how to implement it in LFE. Or in Common Lisp in general? I have heard many positive things about extremely powerful Lisp macros. Did I miss something?
Thank you.