[plt-scheme] string-eval

From: Robby Findler (robby at cs.uchicago.edu)
Date: Wed Mar 23 17:58:56 EST 2005

You need to use

  ~s

not ~a.

If you look closely at the first case, you'll see that you're getting
back a symbol, not a string. ~s means to use `write' and ~a means to
use display.

Robby

At Wed, 23 Mar 2005 17:50:24 -0500, "David J. Neu" wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> Hi,
> 
> I'd like to be able to store an association list in a DBMS and later
> retrieve it.
> 
> The code below works fine for
> (define alist `((a . 1) (b . "foo")))
> 
> but generates the error:
> 
> UNKNOWN::26: read: unexpected ')'
> 
> when b is "", i.e. for
> (define alist `((a . 1) (b . "")))
> 
> Many thanks for any suggestions!
> 
> Cheers,
> David
> 
> 
> 
> (require (lib "string.ss")
> 	 (lib "pconvert.ss"))
> 
> (define alist `((a . 1) (b . "")))
> 
> ;; simulate storing alist in a DBMS and reading it back
> (define alist-as-string (format "~a" (print-convert alist)))
> 
> (eval-string alist-as-string)
> 
> UNKNOWN::26: read: unexpected ')'



Posted on the users mailing list.