EVAL: undefined function DEFINE
Asked Answered
T

2

6

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?

Tynishatynwald answered 10/7, 2015 at 17:30 Comment(0)
D
11

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.

Dumond answered 10/7, 2015 at 19:29 Comment(0)
O
2

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
Optimist answered 11/7, 2015 at 7:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.