TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: whdjr on September 20, 2004, 11:35:36 AM
-
Can someone tell me why this does not work:
(setq sel (ss_get ":E:S"))
(mapcar '(lambda (x)
(if (/= x obj)
(ssdel x sel)
)
)
(ssnames sel)
)
But this does work:
(setq sel (ss_get ":E:S"))
(mapcar '(lambda (x)
(if (not (equal x obj))
(ssdel x sel)
)
)
(ssnames sel)
)
Here is the helper function SSNAMES:
(defun ssnames (selection_set / num lst)
(repeat (setq num (sslength selection_set))
(setq num (1- num)
lst (cons (ssname selection_set num) lst)
)
)
lst
)
This is baffling to me. If someone can explain this please do.
Thanks,
-
http://theswamp.org/phpBB2/viewtopic.php?t=2480
-
So with all that being said by CAB, am I correct in the way I am using (not (equal)) in this application or is there some other way to show not equal without using "/=".
-
You are on the right track, but there is allways another way to write it.
(setq sel (ss_get ":E:S"))
(mapcar '(lambda (x)
(if (eq x obj)
(); do nothing
(ssdel x sel)
)
)
(ssnames sel)
)
(setq sel (ss_get ":E:S"))
(mapcar '(lambda (x)
(cond ((eq x obj))((ssdel x sel))))
(ssnames sel)
)
PS revised the last code
-
(eq expr1 expr2)
The eq function determines whether expr1 and expr2 are bound to the same object (by setq, for example).
From VLisp A2K help. -David
-
Thanks guy for the input.
I keep codin' the way I have it.