Filter an array so that duplicate items are removed
1-byte built-ins
05AB1E (legacy)
Ù
Try it online!
Alternatively:
ê
Try it online!
APL (Dyalog Unicode)
∪
Try it online!
Jelly
Q
Try it online!
W
U
Stax
u
MATL
u
Try it online!
MathGolf
▀
Try it online!
Seriously/Actually
╔
Japt
â
Try it online!
Pyth
{
Try it online!
Husk
u
Try it online!
Pyke
}
Try it online!
Canvas
D
Try it online!
Python 3, 15 3 bytes
Reduced to 3 bytes thanks to a'_'!!!
set
Try it online!
Without set
Python 3, 35 \$\cdots\$30 29 bytes
Saved 3 bytes thanks to a'_'!!!
Saved a byte thanks to Jitse!!!
Saved a byte thanks to Jonathan Allan!!!
lambda l:list(dict(zip(l,l)))
Try it online!
Python 3, 3 bytes
set
Try it online! It also works on Python 2
Or without set
:
Python 3, 34 29 26 bytes
lambda l:[*dict(zip(l,l))]
Try it online! Thanks to Jonathan Alan and Surculose Sputum for helping me golf this one!