Elisp: Check Element Exist in List
Check Element Exist in List
member
-
(member x list)
Check if x is in list. If so, return a list starting with the first occurrence. Else return nil.
Comparison done using
equal
. 〔see Elisp: Equality Test〕(member "4" '("3" "4" "5")) ;; ("4" "5")
Check Element Exist in List, for Symbols or Int
memq
-
(memq x list)
similar to
member
, but comparison done usingeq
.Use this if all items are Symbols or int.
〔see Elisp: Equality Test〕
Check Element Exist in List, for Decimal Numbers
memql
-
(memql x list)
similar to
member
, but comparison done usingeql
.good for if elements are decimal numbers.
〔see Elisp: Equality Test〕
Check Element Exist in List, for Strings
member-ignore-case
-
(member-ignore-case x list)
similar to
member
, except that x should be a string, and comparison ignores letter-case.(member-ignore-case "A" '("b" "a")) ; ("a")