CL-USER> is unbound

Discussion of Common Lisp
Post Reply
SterlingM
Posts: 8
Joined: Sun Mar 21, 2010 8:18 pm

CL-USER> is unbound

Post by SterlingM » Sun Mar 21, 2010 8:22 pm

I am trying to load a previously saved file. I type in

Code: Select all

(load "/home/sterling/helloworld.cl") 
But everytime it tells me that the CL-USER> variable is unbound. I'm not sure how to make the variable...bound? Can anyone tell me how to fix this? Thanks.

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: CL-USER> is unbound

Post by ramarren » Sun Mar 21, 2010 11:15 pm

You posted in the Emacs Lisp subforum, but "CL" indicates Common Lisp. Are you aware of the difference? Where do you type your form in? Also, "CL-USER>" is not a variable, it is usually a SLIME prompt indicating current package. How did you save your file?

SterlingM
Posts: 8
Joined: Sun Mar 21, 2010 8:18 pm

Re: CL-USER> is unbound

Post by SterlingM » Mon Mar 22, 2010 8:01 am

Ramarren wrote:You posted in the Emacs Lisp subforum, but "CL" indicates Common Lisp. Are you aware of the difference? Where do you type your form in? Also, "CL-USER>" is not a variable, it is usually a SLIME prompt indicating current package. How did you save your file?
I'm aware that they are different, but the book I'm going by (Practical Common Lisp) uses Emacs as an editor. I thought CL-USER> being a variable looked weird, but that's what it says. Specifically --

The variable CL-USER> is unbound.
[Condition of type UNBOUND-VARIABLE]

In Emacs, I hit C-x C-s and type in the path to save the file.

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: CL-USER> is unbound

Post by ramarren » Mon Mar 22, 2010 8:39 am

I think you are saving the interaction buffer. Why would you expect loading it to work? Create a new file with C-x C-f, write your definitions there and then load that.

JamesF
Posts: 98
Joined: Thu Jul 10, 2008 7:14 pm

Re: CL-USER> is unbound

Post by JamesF » Mon Mar 22, 2010 4:10 pm

SterlingM wrote:It tells me that the CL-USER> variable is unbound. I'm not sure how to make the variable...bound? Can anyone tell me how to fix this? Thanks.
It would help if you posted the code in question, so that we can see what CL is trying to evaluate. At a guess, you've taken the example a bit too literally and typed CL-USER> at the beginning of a line; CL won't realise you've repeated its prompt, and will try to resolve that variable.
So you could bind that symbol to a variable, but I strongly suspect that it would be the correct solution to the wrong problem.

SterlingM
Posts: 8
Joined: Sun Mar 21, 2010 8:18 pm

Re: CL-USER> is unbound

Post by SterlingM » Mon Mar 22, 2010 10:04 pm

JamesF wrote:
SterlingM wrote:It tells me that the CL-USER> variable is unbound. I'm not sure how to make the variable...bound? Can anyone tell me how to fix this? Thanks.
It would help if you posted the code in question, so that we can see what CL is trying to evaluate. At a guess, you've taken the example a bit too literally and typed CL-USER> at the beginning of a line; CL won't realise you've repeated its prompt, and will try to resolve that variable.
So you could bind that symbol to a variable, but I strongly suspect that it would be the correct solution to the wrong problem.
After I save a file with correct defun line in it, I try to load it (in a new file) with

Code: Select all

(load "/home/sterling/helloworld.lisp")
Nothing more, nothing less. It's the first and only line in the code. The CL-USER> is always there; I am not retyping it. I apologize if this seems like a ridiculous question...I am also quite frustrated with it. It seems so simple, and I don't understand why it's giving me this error.

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: CL-USER> is unbound

Post by ramarren » Mon Mar 22, 2010 11:53 pm

SterlingM wrote:(in a new file)
I still think you are confusing files and buffers in Emacs, and saving a Slime REPL buffer, which contains the CL-USER> prompt. Emacs will not ask you for a file name after C-x C-s if the buffer is already associated with one. You should write a code you want to load later in a file buffer (created with C-x C-f), not REPL buffer. You should type forms to interact with the running Lisp session in the REPL buffer, not file buffer.

gugamilare
Posts: 406
Joined: Sat Mar 07, 2009 6:17 pm
Location: Brazil
Contact:

Re: CL-USER> is unbound

Post by gugamilare » Tue Mar 23, 2010 11:51 am

Ramarren already said it, but, just to simplify it:
  • Create a new file with C-x C-f or in the menu "File > Visit new file...",
  • Define your function in the opened file,
  • Hit C-c C-k to compile and load the file,
  • Change to the REPL buffer and test your function.

SterlingM
Posts: 8
Joined: Sun Mar 21, 2010 8:18 pm

Re: CL-USER> is unbound

Post by SterlingM » Tue Mar 23, 2010 3:14 pm

Okay, it is working how I expect now. You're right, I was confused about files and buffers. Thanks for the help.

Post Reply