Lokesh Sharma
Lokesh Sharma

Reputation: 126

EVAL: undefined function DEFINE

I've written a very simple program:

(define size 2)

(print size)

When I run this code, I get following error:

*** - EVAL: undefined function DEFINE

What does the error mean? How can I resolve it?

Upvotes: 6

Views: 4516

Answers (2)

sadfaf
sadfaf

Reputation: 39

define in the Scheme programming language means defining a variable or a function, defvar or defparameter in the Common Lisp programming language (which is what CLISP implements, and which is different from Scheme) means defining a variable. defun in Common Lisp means defining a function.

CL-USER 195 > (defparameter size 2)
SIZE

CL-USER 196 > (print size)

2 
2

Upvotes: 2

sds
sds

Reputation: 60014

define is not a part of the ANSI Common Lisp language which is implemented by GNU CLISP (I think you are confusing CL with Scheme).

When defining a variable, use defvar, for a function use defun.

You might want to get a book, e.g., ANSI Common Lisp.

Upvotes: 11

Related Questions