Hi
regarding
>You tested assoc with symbol nil. When you test against a var which is nil,
>you get: The variable is unbound.
Assoc will do the same with nil and a variable bound to nil - the behaviour you described would occur is an unbound variable is passed to assoc -
example in Corman Lisp using the variable 'a' :
a
;;; An error occurred in function #< COMPILED-FUNCTION: #xD27570 >:
;;; Error: The variable A is unbound
...
(assoc 'r nil)
NIL
(assoc 'r a)
;;; An error occurred in function #< COMPILED-FUNCTION: #xD7D638 >:
;;; Error: The variable A is unbound
;;; Entering Corman Lisp debug loop.
...
;;; Returning to top level loop.
(setq a nil)
NIL
(assoc 'r a)
NIL
The way tha newlisp automatically binds a newly referenced variable to nil is different from common lisp that requires a setq but the newlisp action is the more appropriate one for a language more targeted at scripting.
I believe that ISLISP (eg see
http://christian.jullien.free.fr/ ) even requires the variable name be bound using defglobal, let, for, or let* before it can be setq'ed to - for extra safety I guess.
eg:
C:\openlisp>openlisp
;; OpenLisp v7.5.0 (Build: 3110) by C. Jullien [May 6 2003 - 18:45:55]
;; Copyright (c) 1988-2003.
...
? (setq a nil)
** setq : unbound-variable : a
? (defglobal a nil)
= a
? a
= nil
? (setq a nil)
= nil
?
Does alisp automatically bind new vars to nil?
Regards
Nigel