Saturday, 28 September 2013

LISP Changing a global variable value in a local function

LISP Changing a global variable value in a local function

I am a novice in the field of lisp... i am writing a code to solve the 8
puzzle in bfs...
I want to store the visited lists in a global list and change its value
regularly from within a function... (defparameter vlist nil) (defun
bfs-core(node-list) (let (cur-node tmp-node-list) (if (null node-list) NIL
(progn ; (if (= 1 (length node-list)) (setq cur-node (car node-list))
(setq tmp-node-list (cdr node-list)) (if (goalp cur-node) cur-node ((setq
vlist (append cur-node vlist)) (bfs-core (append tmp-node-list (expand
cur-node)))))) ) ) )
The defparameter one is my global variable... and witjin the function i
want to change its value with setq... i have also used defvar, setf,set
and all possible combinations..... Can anyone help me out????

No comments:

Post a Comment