[Top][All Lists]

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

Re: [Chicken-users] how to unintern a symbol

From: Alexej Magura
Subject: Re: [Chicken-users] how to unintern a symbol
Date: Mon, 02 Feb 2015 11:55:12 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

AFAICT that just defines a symbol to itself, and only then if you run:

(define foo 1)
(define foo (unintern 'foo))
(eq? foo |foo|) => #t

But, as I said, that only defines 'foo as |foo|: it doesn't undefine the symbol, and it needs to have side-effects, since the CL unintern AFAIK effects the targeted package, or in our case module. 

After uninterning foo, if I were to enter foo into the REPL to be evaluated, it would throw an unbound variable exception.

On 02/02/2015 11:31 AM, Peter Bex wrote:
On Mon, Feb 02, 2015 at 10:51:26AM -0700, Alexej Magura wrote:
Does Chicken have anything comparable to Common Lisp's /unintern/? I
thought that it might be under /##sys/, since other features present
in Common Lisp, but absent in Chicken are available under that
namespace, but it doesn't seem to be provided by that
There's string->uninterned-symbol, which is even documented, right
below "gensym":

If you have a symbol you want to unintern, you can get its string
and create an uninterned symbol from that:

(define unintern (o string->uninterned-symbol symbol->string))

(eq? (unintern 'foo) 'foo) => #f


reply via email to

[Prev in Thread] Current Thread [Next in Thread]