[plt-scheme] Character problem

From: Robby Findler (robby at cs.uchicago.edu)
Date: Tue May 31 09:59:55 EDT 2005

Probably you want to call this function

  (define (char->symbol c) (string->symbol (string c)))

on each element of your list.


At Tue, 31 May 2005 09:52:53 -0400, Todd Dobmeyer wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> I am new to using Scheme. I am working on a Scheme project for a class 
> at Wright State University. We have to read in RPN (reverse polish 
> notation) expressions from a text file, convert this RPN string to a 
> list, and then manipulate the list to work with (eval) to find the 
> answer. I have everything working except for one part. That is when I 
> am trying to convert the string to a list. I can use the string-ref 
> with a counter in a loop to add each non-space character to the list 
> because we are guaranteed to have numbers or operators only. My 
> problem is that string-ref returns a character as #\5, which is the 
> way to define a character. But eval cannot work on individual 
> characters if you have a list of them. It needs the list to be '(+ 5 
> 3) and not '(#\+ #\5 #\3) if I understand this correctly. Is there a 
> simple way to truncate the #\ off each item? Thanks for any help you 
> have!
> Todd Dobmeyer

Posted on the users mailing list.