Re: automatically call functions based on arguments



In article
<5a39817b-35cc-483c-878c-7e69891cba45@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
normanj <nii2awh@xxxxxxxxx> wrote:

Suppose there are several functions (or macros):
func-aa-1-1
func-aa-2-1
func-bb-1-3
Is there a way to call these functions like this:
(call-function 'aa 1 1) => (func-aa-1-1)
(call-function 'bb 1 3) => (func-bb-1-3)

And, if the expected function doesn't exist, how to emit warning?

Thanks.

1) create a string with the function name (upper case!)
2) create a symbol from the string (use INTERN)
3) check if the symbol names a function (use FBOUNDP)
4) use FUNCALL on the symbol to call that function

if you really have macros replace 4) with:

4) create a list with the name of the function/macro as an element
5) call EVAL with the list as an argument

--
http://lispm.dyndns.org/
.