Call function based off of a string in Lisp

Posted by powerj1984 on Stack Overflow See other posts from Stack Overflow or by powerj1984
Published on 2010-05-30T20:54:35Z Indexed on 2010/05/30 21:22 UTC
Read the original article Hit count: 161

I am passing in command line arguments to my Lisp program and they are formatted like this when they hit my main function: ("1 1 1" "dot" "2 2 2")

I have a dot function and would like to call it directly from the argument, but this isn't possible because something like (funcall (second args)...) receives "dot" and not dot as the function name.

I tried variations of this function:
(defun remove-quotes (s)
(setf (aref s 0) '""))

to no avail, before realizing that the quotes were not really a part of the string. Is there a simple way to do this, or should I just check each string and then call the appropriate function?

Thanks!

© Stack Overflow or respective owner

Related posts about string-manipulation

Related posts about lisp