(member item list)
Identify the first occurrence of an item in the list.
This function identifies the first occurrence of an item in a list. A list is returned, beginning with the first occurrence of the item and containing any items following it. This is useful if you need to make a change to a particular item in the list, but you aren't sure exactly where the item is.
Examples
Code | Returns |
---|---|
(setq a '(1 2 3 4 3 2 1)) | (1 2 3 4 3 2 1) |
(member 3 a) | (3 4 3 2 1) |
(- (length a) (length (member 3 a))) | 2 |