Crash on local variable, but not on global
Posted: Tue Jul 27, 2010 9:36 am
I'm running two bits of code that I thought would do the exact same thing. One crashes, the other doesn't.
The working one:
Where *pool*, of course, is global.
The non-working one:
Which crashes (if you must know, it's "*** - +: NIL is not a number").
So, without going into detail about what add_rand_circuit does, can somebody tell me if there is some sort of, I dunno, size limit or other significant difference between a global variable and a local variable? The same thing happens if I replace "pool" in the "meh" function with a let variable.
Thanks a mil,
Siggy
The working one:
Code: Select all
(loop for i from 0 to 20 do (setf *pool* (add_rand_circuit *needs_pool* *pool*)))
The non-working one:
Code: Select all
(defun meh (pool) (loop for i from 0 to 20 do (setf pool (add_rand_circuit *needs_pool* pool))))
(setf *pool* (meh *pool*))
So, without going into detail about what add_rand_circuit does, can somebody tell me if there is some sort of, I dunno, size limit or other significant difference between a global variable and a local variable? The same thing happens if I replace "pool" in the "meh" function with a let variable.
Thanks a mil,
Siggy