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

Resetting all Lisp variables.

162 views
Skip to first unread message

Juan Pardillos

unread,
May 25, 2002, 3:13:23 PM5/25/02
to
Hello,

anybody knows how can I set all Lisp variables to nil?. The goal is to
get the initial state without having to restart the Lisp interpreter.

I'm using Franz Lisp.

Thanks in advance

Christopher Browne

unread,
May 25, 2002, 3:57:29 PM5/25/02
to
Quoth sic...@eresmas.com (Juan Pardillos):

> anybody knows how can I set all Lisp variables to nil?. The goal is to
> get the initial state without having to restart the Lisp interpreter.

You don't want to do that in any case. There are all sorts of
variables whose values should _not_ be nil.

You should instead look at what environment you're using that _needs_
to get reset. And perhaps that will indicate such things as:

a) Setting up a (REINITIALIZE) function for one package or another
that resets certain *GLOBAL* values in that package;

b) Tying more state to object slots, so that what you do is to
initialize some new instance objects with pristine initial states.

Those are two pretty sensible strategies; they _don't_ involve trying
to look at "all Lisp variables."
--
(reverse (concatenate 'string "moc.enworbbc@" "sirhc"))
http://www.ntlug.org/~cbbrowne/internet.html
"Cat's motto: No matter what you've done wrong, always try to make it
look like the dog did it." -- Unknown

Joe Marshall

unread,
May 25, 2002, 3:41:55 PM5/25/02
to

"Juan Pardillos" <sic...@eresmas.com> wrote in message news:6278687.02052...@posting.google.com...

> Hello,
>
> anybody knows how can I set all Lisp variables to nil?.

(do-all-symbols (s) (when (boundp s) (set s nil)))

> The goal is to
> get the initial state without having to restart the Lisp interpreter.

The above will not accomplish that.

Getting the Lisp system back to its initial state is a very hard thing
to do. You would have to record the initial state of every
accessible object and then arrange to put it back. It would be
faster and more reliable to restart the Lisp process.

What are you trying to do?

Coby Beck

unread,
May 25, 2002, 7:29:02 PM5/25/02
to

"Juan Pardillos" <sic...@eresmas.com> wrote in message
news:6278687.02052...@posting.google.com...
> Hello,
>
> anybody knows how can I set all Lisp variables to nil?. The goal is to
> get the initial state without having to restart the Lisp interpreter.

Be careful what you wish for! They don't all start out as nil...

You could delete the package that all of your work is in and then reload
your files. I've never tried that but it seems that should do it, hopefully
someone will correct me if I'm wrong.....

But if you have too much stuff all munged up to keep track of and can't
write a reinitialize function, you should just restart.

--
Coby Beck
(remove #\Space "coby 101 @ bigpond . com")


Juan Pardillos

unread,
May 27, 2002, 4:53:22 AM5/27/02
to
OK. I got the point. Then, is there some way to restart the Lisp
interpreter without having to exit completely the Franz Lisp
environment. (Something like a restart function).

Thanks

Erik Naggum

unread,
May 27, 2002, 7:32:38 AM5/27/02
to
* Juan Pardillos

| OK. I got the point. Then, is there some way to restart the Lisp
| interpreter without having to exit completely the Franz Lisp
| environment. (Something like a restart function).

What, precisely, is it that you have forgot to save, or what to keep
around? Most Common Lisps have the ability to save a new Lisp image.
Next time :), you can do that before you clobber your image.
--
In a fight against something, the fight has value, victory has none.
In a fight for something, the fight is a loss, victory merely relief.

70 percent of American adults do not understand the scientific process.

Bob Bane

unread,
May 27, 2002, 10:42:30 AM5/27/02
to
Erik Naggum wrote:

> * Juan Pardillos
> | OK. I got the point. Then, is there some way to restart the Lisp
> | interpreter without having to exit completely the Franz Lisp
> | environment. (Something like a restart function).
>
> What, precisely, is it that you have forgot to save, or what to keep
> around? Most Common Lisps have the ability to save a new Lisp image.
> Next time :), you can do that before you clobber your image.
>

I remember debugging my disseration code by doing something like the
following:

% lisp

1_ (load "example-problem.lisp")

;; Lots of trace output as problem loads...

2_ (fork)

;; Original image gets suspended behind child image

3_ (start-testing-example)

;; Lots more trace output, debugger excursions, etc...
;; Ultimately system becomes sufficiently broken internally
;; that it's time to stop

17_ (exit)

;; Child process exits, parent resumes control of terminal

3_

;; And we're back in an unpolluted image...

At times, I would get nested three and four images deep, saying (fork)
whenever I wanted a checkpoint I could fall back to while hacking.

0 new messages