Re: Evalutation of a string

From: Erick Gallesio <eg_at_unice.fr>
Date: Tue, 1 Sep 1998 17:13:03 +0200 (CEST)

Filippo De Grandi writes:
> I have a problem with scheme:
>
> I'm building an evalutator for scheme expressions that works on the web.
> It takes a sheme expression from a socket [for example: (define t 6) (+ t
> t)] and stores it in a string called dati.

Use the function "eval-string" for that, or the functions
read-from-string.
For instance, (eval-string (string-append "(begin "
                                          "(define t 6) (+ t 6)"
                                          ")"))
Or,e even
    (eval (read-from-string "(begin (define t 6) (+ t 6))"))

Eval-string, as eval, accepts also an optional environment as second
parameter.

Note that I have added the begin form around your string to be sure to
have only one result to compute.


                -- Erick
Received on Tue Sep 01 1998 - 17:11:37 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST