... Or simply:
I think your solution is (almost) the same as my 2nd suggestion.
Many ways to skin a cat; I posted it for the sole purpose that it is a slight adaptation to what had already been posted.
Using OR:
"_X"
'((-4 . "<OR"))
'((-4 . "OR>"))
)
)
This is the route that I would take, as I recall that there may be a limit on the string length for ssget filter list items, and such a limit would obviously be reached earlier than any possible limit on the number of filter list items.
I don't particularly like the way the code 'looks'
This:
"_X"
'((-4 . "<OR")
(8 . "0")
(8 . "Layer1")
(8 . "Layer2")
(8 . "Layer3")
(8 . "ABCD")
(8 . "DEFG")
(8 . "HIJK")
(-4 . "OR>")
)
)
... Compared to this:
(ssget "_x" (list (8 .
"0,Layer1,Layer2,Layer3,ABCD,DEFG,HIJK")))
...
But... The speed difference is quite impressive - thanks for commenting, as it prompted me to take a second look.
Wouldn't selecting items on frozen/locked layers cause an error when it comes time to do something with the selection set?
That entirely depends on the logic you build into your code, frankly... Being that this is a would-be sub-function, I'd suggest that your main code handle the qualifying of the members of layerList being passed from the outset, rather than to expect the sub-function to account for user error, YMMV.
Also what happens if you pass a null layer value?
As the creator of the list argument being passed, you'd have intentionally passed nil or empty string... Or intentionally written code that allows for such a potentiality in the first place.
Cheers all.