list - getting undefined reference to a function in commonLISP -
i'm trying compile following code:
(defun nextstates (st) "generate possible states" (setf n 0) (setf states-list (make-list 9)) (setf list-actions (possible-actions)) (loop x in list-actions (setf aux (nextstate st x)) (when (not(member aux (states-list) :test #'equalp)) (progn (setf (nth n states-list) aux) (setf n (+ n 1)) ) ) ) (values states-list) )
nextstate function , states-list list, both of defined. i'm getting "undefined reference states-list". don't know i'm doing wrong. appreciated
renaming badly camel case lisp case i'm left this.
(defun next-states (st) "generate possible states" (loop :for action :in (possible-actions) :for aux := (next-state st action) :then (next-state st action) :when (not (member aux states-list :test #'equalp)) :collect aux :into states-list :finally (return states-list)))
as test here had:
(defun possible-actions () "have duplicates see not member in action" '(0 1 3 3 4)) (defun next-state (st action) "simple version test" (+ st action)) (next-states 3) ; ==> (3 4 6 7)
Comments
Post a Comment