From what my teacher told me, I should use let to declare local variables and setf to declare global variables.
I'm tried running the following code:
(let (state-list (problem-initial-state problem))
(print state-list))
and I get NIL.
However, when I try the following:
(setf state-list (problem-initial-state problem))
(print final-list)
I get the desired value (the value in problem-initial-state problem).
Why is that?
PS: I apologize for these begginer questions, I'm getting a hard time getting into LISP, coming from a C background.
You are missing a couple of parens in your
let
forms:will print
(1 2)
.Your form
binds
state-list
tonil
andproblem-initial-state
toproblem
.