[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: preserving quotes in output



Probably you want to use `write' instead of `display':

> (define (f x) (write x))
> (define c '("hello"))
> (f c)
("hello")

Hope that helps,
Robby

Quoting Chris Uzdavinis:
> 
> (I'm using 103p1)
> 
> Is there a way to preserve quotes around strings when I'm writing out
> the expression in which the strings are found?  For example, my
> program is creating some Scheme code at runtime, and when it writes it
> to disk quoted-strings in the code lose their quotes.
> 
> A simple reduction of this problem can be seen here:
> 
> (define (f x) (display x))
> (define c '("hello"))
> (f c)
> 
> Results in:
> 
>  (hello)
> 
> But I'd like it to result in:
> 
>  ("hello")
> 
> 
> When I fprintf my s-expression, the same thing happens in my disk
> file.
> 
> Thanks again for your help.
> 
> --
> Chris