Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

unintern a symbol vs set to nil

50 views
Skip to first unread message

Xah Lee

unread,
Jun 9, 2011, 6:36:41 PM6/9/11
to
in a elisp program, if i have created a temp var (but not using let)
and later i want to delete the var, i can do:

(setq temp1 nil)

or is it better to do

(unintern 'temp1)

The temp1 var holds a big list, and there are few more, e.g. temp2,
temp3.

-----------------------------

Mathematica is similar to lisp in the symbol system. In Mathematica,
lisp's “unintern” is “Remove”. From my know-how, basically you don't
Remove a symbol. You just Clear it (set it to nil).

-----------------------------
if i use “let”, that means few hundred lines inside it with other
lets. Not desirable.

How do you solve this problem?

Thanks.

Xah

Konfusius

unread,
Jun 10, 2011, 5:23:00 AM6/10/11
to

you cannot delete a symbol. the garbage collection deletes objects
automatically when not referenced anymore. but since the symbol templ
is referenced by your program it cannot be deleted.

uninterning doesn't do the job either because it just causes the
reader not to recognize your symbol templ anymore. when you enter an
expression containing templ after uninterning it the reader will
create a new symbol different from your old symbol templ that just
happens to have the same name.

you also don't need to unbind templ. unbinding is done automatically
once the binding form is left.

what you actually want to do is to return templ into the state it had
when your program started. this is done by (setq templ nil).

Pascal J. Bourguignon

unread,
Jun 12, 2011, 12:44:34 AM6/12/11
to
Konfusius <wenha...@plus.cablesurf.de> writes:

You shouldn't have given those explanations to Xah, now he will write
yet another article about the idiocy of lisp hackers who designed such a
system...

--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.

Xah Lee

unread,
Jun 12, 2011, 2:33:51 AM6/12/11
to
Pascal J Bourguignon <p...@informatimago.com> wrote:
> Not at all.  (Yet some other fodder for Xah's idiocy articles, sorry).

you mean my articles describing idiots like you?

Here's a juicy passage of Pascal J Bourguignon fellow, in which you
can get a glimpse of his highness:

«Ruby's been done by some Japanese newbie... I guess there was some
language barrier preventing him to learn from the 50 years of
occidental experience in programming language design. At least, he
wasn't a "linguist"... In any case, why should we suffer for THEIR
incompetences?!?»

Xah

Xah Lee

unread,
Jun 12, 2011, 8:46:27 AM6/12/11
to

thanks. That's useful.

Xah

0 new messages