I am working on a Lisp program that contains code to read in the dimensions of boxes and then sort them from shortest to longest lengths (and set each of these new lengths as new variables).
When I attempt to load my file into the interpreter, I get the following error:
*** - EVAL: undefined function NEW-D1
I am confused as to why I'd be getting this error because new-d1 isn't a function, it's a variable for the length of the shortest edge of a given box.
Here's the code where new-d1 is first initialized and set:
(defun get-box ()
(let ((d1 0) (d2 0) (d3 0) (new-d1 0) (new-d2 0) (new-d3 0))
(setf d1 (read))
(setf d2 (read))
(setf d3 (read))
(if (= d1 -1)
(exit)
(progn
(setq new-d1 (first (sort (list d1 d2 d3) #'<)))
(setq new-d2 (second (sort (list d1 d2 d3) #'<)))
(setq new-d3 (third (sort (list d1 d2 d3) #'<)))
(next-part-of-program (new-d1 new-d2 new-d3))))))
How can I change my code so the interpreter knows new-d1 isn't a function and doesn't treat it as such? Thanks for any help!
Edited to add: Next part of program code:
(defun next-part-of-program(d1 d2 d3)
(if (> d2 b)
(put-on-c-list(d1 c-list))
(if (> d2 a) and (< d2 c)
(put-on-b-list (d1 b-list))
(put-on-a-list (d1 a-list)))))
Note: I've initialized a-list, b-list, and c-list earlier as global variables/lists to be added to later.
Thanks again!
next-part-of-programis undefined. The symbolnew-d1is not used as a funtion in the above code. Please update your question with the actual code that produces the error.next-part-of-programfunction defined, and that's the place wherenew-d1is being called or otherwise used as a function.new-d1used as a function here or could it be even later in my code, such as input-on-a-list?