1
$\begingroup$

Example:

HoldComplete[{b,a,a,a}] /. a->Nothing
HoldComplete[{b,a,a,a}] /. l_List->DeleteCases[l,a]
HoldComplete[{b,a,a,a}] /. l_List:>DeleteCases[l,a]
HoldComplete[{b,a,b,a}] //. {head___,a..,tail___}->{head,tail}

Only the last works but it's has a low efficiency. What's the right way to do things like this?

$\endgroup$
2