The following works:
 
#lang racket/base
#;1 (define ns (make-base-namespace))
#;2 (namespace-variable-value 'list #t (λ () 'not-found) ns)
; -> #<procedure:print-syntax-width>
#;3 (namespace-set-variable-value! 'list 'whatever (λ () #f) ns)
#;4 (namespace-undefine-variable! 'list ns)
#;5 (namespace-variable-value 'list#t (λ () 'not-found) ns)
; -> not-found
 
But when I omit line 3 it does not work:
 
#lang racket/base
#;1 (define ns (make-base-namespace))
#;2 (namespace-variable-value 'list #t (λ () 'not-found) ns) ; ->
#<procedure:list>
#;4 (namespace-undefine-variable! 'list ns)
;-> error namespace-undefine-variable!: given name is not defined
;       name: list

This I did with: Welcome to DrRacket, version 6.2.0.5--2015-07-06(d6fa581/a)
[3m].
Code in the definitions window. The problem is not typical for 'list only.
The same happens with (at least some) other variables of a base-namespace.
 
I have no clue why commenting out line 3 gives an error.
Do I misinterpret the docs on namespaces?
 
Thanks, Jos
 
PS I use a base-namespace in a toy interpreter.
It allows me to easily borrow all variables from a base-namespace.
But some of them I want to undefine.
 
 
 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to