Forgive me if this does not belong here.
All throughout primary school I've seen the notation $f(x)$ to denote a function, that is, if we are talking about the squaring function, we would write
$$ f(x) = x^2 $$
to denote/define the function (IIRC this notation was invented by Euler).
However, in the past few years I've been introduced to the notation
$$ x \mapsto x^2 $$
when talking about an anonymous function that we don't need to give a name (and as someone who does functional programming I find it very intuitive and useful).
My question is, should we prefer
$$ f(x) = x^2 $$
or
$$ f \colon x \mapsto x^2 $$
when defining a function with a name. It seems to me the former is more common, but wouldn't it make sense to use the latter to be consistent with anonymous functions? What's the standard in professional mathematics (e.g. papers)? Does anyone think one is more readable than the other?
Oh, and I've also seen
$$ f(x) := x^2 $$
as another alternative.

The problem with all of these notations is that they don't indicate the domain or codomain of the function. I would introduce a function in two parts, first I would write $f : X \to Y$ which indicates the domain and codomain, then write either $f(x) = \dots$ or $x \mapsto \dots$ , both are acceptable.
Example: I would write either $f : \Bbb{R} \to \Bbb{R}$, $x \mapsto x^2$ or $f : \Bbb{R} \to \Bbb{R}$, $f(x) = x^2$.
In both cases, the first part tells you the name of the function, its domain, and its codomain, while the second tells you how it acts on an element of the domain.