From: Igor Sheyn
Subject: Common LISP
Date: 
Message-ID: <2colk8$q1p@news.bu.edu>
What's the way to convert a single character string into a
corresponding symbol ( i.e. \#d into `d )?
THanks
Igor

From: Thomas A. Russ
Subject: Re: Common LISP
Date: 
Message-ID: <TAR.93Nov22093653@grover.ISI.EDU>
In article <...> ·····@cs.bu.edu (Igor Sheyn) writes:
 > What's the way to convert a single character string into a
 > corresponding symbol ( i.e. \#d into `d )?

(intern (make-string 1 :initial-element #\d))

  ==> \d   ;(A symbol with print-name of lower-case D!)

(intern (make-string 1 :initial-element (char-upcase #\d)))

 ==>  D   ;(A symbol with print-name of upper-case D!)

If you don't want the symbol interned, then use make-symbol instead of
intern. 


Also, why do you want to do this in the first place?
--
________________________________________________________________________
Thomas A. Russ,  USC/Information Sciences Institute          ···@isi.edu    
4676 Admiralty Way, Marina del Rey, CA 90292          (310) 822-1511x775
From: Barry Margolin
Subject: Converting char to symbol (was Re: Common LISP)
Date: 
Message-ID: <2cratiINN82i@early-bird.think.com>
In article <··········@news.bu.edu> ·····@cs.bu.edu (Igor Sheyn) writes:
>What's the way to convert a single character string into a
>corresponding symbol ( i.e. \#d into `d )?

(defun char-symbol (char)
  (make-symbol (make-string 1 :initial-element char)))

Note that this will make the symbol #:|a|, since it doesn't intern the
symbol and it doesn't change the case of the character.  You can replace
MAKE-SYMBOL with INTERN if you want an interned symbol, and you can use
CHAR-UPCASE to force it to canonicalize the case of the character
(actually, you should probably make it check the READTABLE-CASE state).
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar
From: William M. York
Subject: Re: Converting char to symbol (was Re: Common LISP)
Date: 
Message-ID: <YORK.93Nov24124315@sparkie.PARC.Xerox.COM>
In article <············@early-bird.think.com> ······@think.com (Barry Margolin) writes:


   In article <··········@news.bu.edu> ·····@cs.bu.edu (Igor Sheyn) writes:
   >What's the way to convert a single character string into a
   >corresponding symbol ( i.e. \#d into `d )?

   (defun char-symbol (char)
     (make-symbol (make-string 1 :initial-element char)))

How about (make-symbol (string char))?