Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating resource.
Please try to avoid dependencies to third-party libraries and frameworks.
List.mem x list
(some (partial = x) list)
(some #{x} list)
list.contains(x);
x in list
Enum.member?(list, x)
lists:member(X, List).
member(_, []) -> false; member(Value, [H|_]) where Value =:= H -> true; member(Value, [_|T]) -> member(Value, T).
member(_, []) -> false; member(Value, [H|T]) -> case H of Value -> true; _ -> member(T) end.
if (findloc (list, x, 1) != 0) then
if (any(x == list)) ...
func Contains(list []T, x T) bool { for _, item := range list { if item == x { return true } } return false }
list.contains(x)
x `elem` list
find _ [] = False find n (x:xs) | x == n = True | otherwise = find n xs
return list.indexOf(x) !== -1;
return list.includes(x);
boolean contains(int[] list, int x){ for(int y:list) if( y==x ) return true; return false; }
boolean <T> contains(T[] list, T x){ if( x==null){ for(T y:list) if( y==null ) return true; }else{ for(T y:list) if( x.equals(y) ) return true; } return false; }
list.contains(x)
x in list
(member x list)
function contains(list, x) for _, v in pairs(list) do if v == x then return true end end return false end
[list containsObject:x];
in_array($x, $list, true);
result := false; for e in list do if e=x then begin result := true; break; end
# To check an array for a value: print "Found 'foo'\n" if grep { $_ eq 'foo' } @a_list; # To check a map for a value: print "Found 'bar'\n" if exists $map{bar};
member(X, [One]).
x in list
list.include? x
list.contains(&x);
(&list).into_iter().any(|v| v == &x)
list.iter().any(|v| v == &x)
list.contains(x)
(define (contains list x) (cond [(null? list) #f] [(equal? (car list) x) #t] [else (contains (cdr list) x)]))
List.Contains(x)