Index thru a List of Lists in AutoLISP
I have a list of lists of integers:
(setq a '(21 14 35 29 16 28))
(setq b '(15 36 21 17 45 41))开发者_JAVA百科
(setq c '(24 21 35 28 17 21))
There could be 50 +/- lists total.
I have another list:
(setq me '(17 14 31 21 17 28))
I want to cycle through the initial list of lists and subtract each member of list a
(1st time thru) from list me
.
How would I be able to index thru the initial list of lists so that I can perform the comparison?
If I pretend to understand what you're asking ...
(setq
a '(21 14 35 29 16 28)
b '(15 36 21 17 45 41)
c '(24 21 35 28 17 21)
me '(17 14 31 21 17 28)
lst (append a b c)
)
(setq result
(vl-remove-if
'(lambda (x) (member x lst))
me
)
)
result's value is (31)
if that ^ was what you were looking for then a more generic solution:
(defun foo ( lst listOfLists )
( (lambda ( grandList )
(vl-remove-if
'(lambda (x) (member x grandList))
lst
)
)
(apply 'append listOfLists)
)
)
(foo me (list a b c))
returns (31)
精彩评论