Consider as a toy example that I want a replacement which acts on
{x,1,2,3}
by replacing $x$ with the length of the list itself. In this example this should output
{4,1,2,3}
So I want a code that looks like
{x,1,2,3}/.{x->Length[???]}
where "???" should indicate the expression on which I am doing the replacement. Is there a way to do this or an easy alternative ?