Are my docs incorrect or out outdated?

Michael

===================

From: file:///usr/share/plt/doc/guide/eval.html#%28tech._current._namespace%29

#lang scheme
  
  (eval '(cons 1 2))

This fails because the initial current namespace is empty. When you run 
mzscheme in interactive mode (see Interactive Mode), the initial namespace is 
initialized with the exports of the scheme module, but when you run a module 
directly, the initial namespace starts empty.

In general, it’s a bad idea to use eval with whatever namespace happens to be 
installed. Instead, create a namespace explicitly and install it for the call 
to eval:

  #lang scheme
  
  (define ns (make-base-namespace))
  (eval '(cons 1 2) ns) ; works


--- On Thu, 6/24/10, Noel Welsh <[email protected]> wrote:

From: Noel Welsh <[email protected]>
Subject: Re: [racket] Need a namespace
To: "michael rice" <[email protected]>
Cc: [email protected]
Date: Thursday, June 24, 2010, 11:27 AM

You're using a define in a place where you aren't allowed to put a
define. E.g., this will work:

(define foo 1)

This won't work:

(define bar (define foo 1) foo)

N.



      
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to