Code: Select all
(loop for y below m do
(loop for x below n do
(when(zerop(coord x y table))
(print l)
(unless(setf v([b]gennum[/b] x y [b]l[/b] out))
(return-from alpha nil)))))
Code: Select all
(loop for y below m do
(loop for x below n do
(when(zerop(coord x y table))
(print l)
(unless(setf v([b]gennum[/b] x y [b]l[/b] out))
(return-from alpha nil)))))
That code is very confusingly indented, and hence unreadable. Please use standard indentation rules. It is also apparently a fragment with missing context. Since, as it stands, it uses several identifiers as global variables, it is impossible to say anything about its behaviour. In any case, using the return value of SETF as a condition seems weird. And I don't even understand your question, "attaching its return value" to what?xernobyl wrote:Why is my gennum function attaching it's return value l? I've commented everything inside gennum, just left a return value.
Code: Select all
(print l)
(loop for y below m do
(loop for x below n do
(when(zerop(coord x y table))
(setf v (gennum x y l out))
(put v x y out)
(push v l)))
(print v)
(print l))
Code: Select all
(1 8 2 9 6)
7
(7 8 2 0 9 0 6 NIL NIL NIL)
3
(3 0 1 NIL 2 0 NIL 7 6 NIL)
7
(7 NIL NIL NIL NIL 0 4 NIL 8 2)
Code: Select all
(1 8 2 9 6)
7
(7 1 8 2 9 6)
3
(3 7 1 8 2 9 6)
7
(7 7 1 8 2 9 6)
That code on my system results in:xernobyl wrote:Trying to simplify the problem...
Code: Select all
The variable L is unbound.
[Condition of type UNBOUND-VARIABLE]