I need to convert a character, i.e. #\+ so that it may be passed as a
function parameter to FUNCALL. I have been going though ANSI Common Lisp,
but cannot find a function or macro to convert #\+ into perhaps '-
Is there a way to get "-" into '-, if so then (setf operator (format nil
"~A" #\+) would be my first step.
-Luke
Hi Luke J Crook,
> I need to convert a character, i.e. #\+ so that it may be passed as a
> function parameter to FUNCALL. I have been going though ANSI Common Lisp,
> but cannot find a function or macro to convert #\+ into perhaps '-
>
> Is there a way to get "-" into '-, if so then (setf operator (format nil
> "~A" #\+) would be my first step.
If I understand you correctly you want to convert a string into a symbol
before FUNCALLing it. For example:
(funcall (read-from-string (string #\+)) 1 2) => 3
Note that SYMBOL-NAME converts from a symbol to its string representation.
(symbol-name '+) => "+"
Something at the back of my mind is nagging me that there may be a better
function than READ-FROM-STRING for converting strings into symbols. But
SYMBOL-NAME doesn't list a cross-reference from See Also.
Regards,
Adam
"Adam Warner" <······@consulting.net.nz> writes:
> Something at the back of my mind is nagging me that there may
> be a better function than READ-FROM-STRING for converting
> strings into symbols. But SYMBOL-NAME doesn't list a
> cross-reference from See Also.
FIND-SYMBOL and INTERN. And sometimes, what you really want is
CASE ;-)
Regards,
--
Nils G�sche
Ask not for whom the <CONTROL-G> tolls.
PGP key ID #xD26EF2A0
Hi Nils Goesche,
>> Something at the back of my mind is nagging me that there may
>> be a better function than READ-FROM-STRING for converting
>> strings into symbols. But SYMBOL-NAME doesn't list a
>> cross-reference from See Also.
>
> FIND-SYMBOL and INTERN.
Ouch. Thanks :-D
"Adam Warner" <······@consulting.net.nz> wrote in message
···································@consulting.net.nz...
> Hi Luke J Crook,
>
> > I need to convert a character, i.e. #\+ so that it may be passed as a
> > function parameter to FUNCALL. I have been going though ANSI Common
Lisp,
> > but cannot find a function or macro to convert #\+ into perhaps '-
> >
> > Is there a way to get "-" into '-, if so then (setf operator (format nil
> > "~A" #\+) would be my first step.
>
> If I understand you correctly
Yes, sorry. I seem to have substituted - for +.
-Luke