TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: roy_043 on December 03, 2010, 01:06:31 PM
-
To check for a non-nil list you can use this single function:
(vl-consp lst)
Instead of:
(and lst (listp lst))
To check for a non-nil atom I still use:
(and at (atom at))
Is that the only way? Or is there perhaps a single predicate function that can accomplish the same?
-
(_atom at)
(defun _atom ( a ) (and a (atom a)))
:lol:
-
How about (boundp) ? -David
-
(defun _atom (a) (and a (atom a)))
(setq
a nil
b 'a
c 1
d 'c
lst '(1 2 3)
ss (ssget "_X")
)
; (boundp 'a) => nil
; (boundp 'b) => T
; (boundp 'c) => T
; (boundp 'd) => T
; (boundp 'lst) => T
; (boundp 'ss) => T
; (boundp a) => nil
; (boundp b) => nil
; (boundp c) => nil
; (boundp d) => T
; (boundp lst) => nil
; (boundp ss) => nil
; (_atom a) => nil
; (_atom b) => T
; (_atom c) => T
; (_atom d) => T
; (_atom lst) => nil
; (_atom ss) => T