Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
Select your favorite languages :
  • Or search :

Idiom #277 Remove an element from a set

Remove the element e from the set x.

Explains what happens if e was already absent from x.

x.remove(e);
integer,allocatable::x(:)
integer::e=6
x=[2,4,6,8,10]
!remove 6
x=pack(x,x/=e)
delete(x, e)
delete(x, e)
import java.util.Set;
x.remove(e);
x := x - [e];
Exclude(x,e);
@x = grep $e ne $_, @x;
x.remove(e)
x.delete(e)

New implementation...