[Disclaimer: I'm more fluent in Scheme than CL, so excuse me if I don't
say this exactly right...]
Noam Elbaum <firstname.lastname@example.org> wrote:
| I need to concatenate two strings (add two string to form one string ) in
| order to use them as a function name.
| meaning :
| i have two functions named: global-a, global-b
| and i want to call one of them according to variable named c which have the
| values of 'a or 'b.
| I want to do:
| (funcall (concatinate 'global- c ))
Personally, I wouldn't do it that way at all! Try something like this
instead [note: I'm deliberately not using quasiquotes, since you said
you're a newbie]:
(cons 'a #'global-a)
(cons 'b #'global-b)
(defun callit (arg)
(let ((elem (assoc arg *global-funcs*)))
(funcall (cdr elem))
...handle the error...)))
Then (callit 'a) would call the function "global-a", and so on.
Also, this way the keys & function names are *not* required to be
related in any way (though they still *may* be, if you like). That is,
if "*global-funcs*" contains "(cons 'foo #'bar)", then (callit 'foo)
will call "bar", not "global-foo".
p.s. Later, if the "*global-funcs*" list gets too long [whatever
"too long" might mean, in your particular application], you might
consider changing it to a hash table, and changing "callit" accordingly.
None of the code that uses "callit" would need to change, though.
Rob Warnock, 8L-855 email@example.com
Applied Networking http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
1600 Amphitheatre Pkwy. FAX: 650-933-0511
Mountain View, CA 94043 PP-ASEL-IA