我正在LISP中使用CLISP運行該程序的程序。Lisp,雖然CLISP函數未定義錯誤?
我的功能中有一個while語句,但CLISP正在恢復
*** - EVAL: undefined function WHILE
功能不花哨,
(defun heap-insert (heap item key)
"Put an item into a heap. [Page 150 CL&R]."
;; Note that ITEM is the value to be inserted, and KEY is a function
;; that extracts the numeric value from the item.
(vector-push-extend nil heap)
(let ((i (- (length heap) 1))
(val (funcall key item)))
(while (and (> i 0) (>= (heap-val heap (heap-parent i) key) val))
do (setf (aref heap i) (aref heap (heap-parent i))
i (heap-parent i)))
(setf (aref heap i) item)))