Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EVAL: undefined function DEFINE

Tags:

lisp

clisp

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?

like image 623
Lokesh Sharma Avatar asked Jul 10 '15 17:07

Lokesh Sharma


2 Answers

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.

like image 149
sds Avatar answered Oct 22 '22 15:10

sds


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
like image 33
sadfaf Avatar answered Oct 22 '22 16:10

sadfaf