Re: automatically call functions based on arguments
- From: Rainer Joswig <joswig@xxxxxxx>
- Date: Tue, 29 Apr 2008 11:35:55 +0200
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/
.
- Follow-Ups:
- Re: automatically call functions based on arguments
- From: normanj
- Re: automatically call functions based on arguments
- From: Alessio Stalla
- Re: automatically call functions based on arguments
- References:
- automatically call functions based on arguments
- From: normanj
- automatically call functions based on arguments
- Prev by Date: Re: automatically call functions based on arguments
- Next by Date: Re: automatically call functions based on arguments
- Previous by thread: Re: automatically call functions based on arguments
- Next by thread: Re: automatically call functions based on arguments
- Index(es):