Subject: [clisp-list] problem with defun

From: sd sf <[email-masked]>
Date: Sat May 31 20:41:04 2003

Hi. I'm new to clisp, so bear with me. In any case when I try to use defun to define functions I get the error that the function defun is not defined. 
I have clisp 2.30.
What could be the problem?

---------------------------------
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

---

From: Pascal Bourguignon <[email-masked]>
Date: Sat May 31 20:57:05 2003

sd sf writes:
> Hi. I'm new to clisp, so bear with me. In any case when I try to use
> defun to define functions I get the error that the function defun is
> not defined.
> I have clisp 2.30.

That  may  occur when  you  are  in a  package  that  does not  import
COMMON-LISP:

[15]> (defpackage "POOR-LIL-PACKAGE" (:use))
#<PACKAGE POOR-LIL-PACKAGE>
[16]> (in-package "POOR-LIL-PACKAGE")
#<PACKAGE POOR-LIL-PACKAGE>
POOR-LIL-PACKAGE[17]> (defun my-fun () :not-fun)
*** - COMMON-LISP:EVAL: the function DEFUN is undefined
1. Break POOR-LIL-PACKAGE[18]> 

The solution would be to add "COMMON-LISP" to the use list:

[2]> (defpackage "POOR-LIL-PACKAGE" (:use "COMMON-LISP"))
#<PACKAGE POOR-LIL-PACKAGE>
[9]> (in-package "USER")
#<PACKAGE COMMON-LISP-USER>
[10]> (defun my-fun () :not-fun)
MY-FUN
[11]> 

Another  reason could  be if  you  played with  the readertable.   The
symbols in  COMMON-LISP package  are all in  upper case.   The default
readertable convert  lower-case to  upper-case, but if  it's modified,
you could get the |defun| symbol instead of the |DEFUN| symbol, and of
course, |defun| is not defined...

If it's  not one of these  cases, please explain in  more details what
you're doing to get the error message!

-- 
__Pascal_Bourguignon__                   http://www.informatimago.com/
----------------------------------------------------------------------
Do not adjust your mind, there is a fault in reality.