Hi Joel,
Thanks for pointing out DeleteCases
. Important if order needs to be preserved. Similar to Union
and DeleteDuplicates
.
DeleteCases[list, Alternatives @@ {b, c, d, f, g, h, j, k, l, n, o, p, r, s, t}]
or
DeleteCases[list, x_ /; MemberQ[{b, c, d, f, g, h, j, k, l, n, o, p, r, s, t}, x]]
will preserve the order but Complement
will not, the result is sorted.
Complement[Reverse@list, {b, c, d, f, g, h, j, k, l, n, o, p, r, s, t}]
(* {a, e, i, m, q, w} *)
DeleteCases[Reverse@list, x_ /; MemberQ[{b, c, d, f, g, h, j, k, l, n, o, p, r, s, t}, x]]
(* {w, q, m, i, e, a} *)