Re: automatically call functions based on arguments
- From: normanj <nii2awh@xxxxxxxxx>
- Date: Tue, 29 Apr 2008 11:25:15 -0700 (PDT)
Sorry, those digits should be replaced with normal strings.
Now, the presence of these digits is strange. Couldn't they be
parameters to the functions? Do you have a lot of them?
All those parameters have nothing to do with the parameters
of functions/macros, they are only related with their names.
Yes, maybe hundreds.
(defvar *name-to-function-map*
'((aa func-aa)
(bb func-bb)
(cc func-cc)))
(defun call-function (name arguments)
(let ((fun (cdr (assoc name *name-to-function-map*))))
(if fun
(apply fun arguments)
(error "No user function named ~S" name))))
(call-function 'aa 1 2)
(call-function (read) (read) (read))
This could be taken as a solution.
.
- Follow-Ups:
- Re: automatically call functions based on arguments
- From: Pascal J. Bourguignon
- Re: automatically call functions based on arguments
- References:
- automatically call functions based on arguments
- From: normanj
- Re: automatically call functions based on arguments
- From: normanj
- Re: automatically call functions based on arguments
- From: Pascal J. Bourguignon
- automatically call functions based on arguments
- Prev by Date: Re: def app = apply, problem
- 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):
Relevant Pages
|