[racket] tinyscheme vs. racket question

From: Gregory Woodhouse (gregwoodhouse at me.com)
Date: Mon Sep 10 13:19:20 EDT 2012

Is there a similar function for characters? I.e., one that will map #\1 to 1?

Sent from my iPhone

On Sep 10, 2012, at 9:44 AM, Carl Eastlund <cce at ccs.neu.edu> wrote:

> The following expression should do what you want:
> 
> (+ (string->number "1.2") 1)
> 
> If you're starting from a symbol, use symbol->string before string->number.
> 
> Carl Eastlund
> 
> On Mon, Sep 10, 2012 at 12:41 PM, Nikolaus Klepp <dr.klepp at gmx.at> wrote:
> Hi all,
> 
> In tinyscheme I can do this:
> 
> > (+ (string->symbol "1.2") 1)
> 2.2
> 
> In racket that does not work, because
> 
> > (string->symbol "1.2")
> '|1.2|
> 
> which is not a number. I can use this workaround:
> 
> > (+ (read (open-input-string "1.2")) 1)
> 2.2
> 
> But is there a clean way to get the above line from tinyscheme working on
> racket without that workaround?
> 
> Nik
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120910/33cde7cf/attachment.html>

Posted on the users mailing list.