Logo

Programming-Idioms

Set the boolean b to true if the set x contains the element e, false otherwise.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
b = x.find(e) != x.end();
b = x.Contains(e);
var b = x.contains(e);
b = x(e)
b := x[e]
_, b := x[e]
import Data.Set (member)
b = e `member` x
let b = x.has(e);
boolean b = x.contains(e);
(setf b (not (null (member e x))))
b := e in x;
$b = $x{$e};
b = e in x
b = x.include? e
let b = x.contains(&e);