Suppose there is a vector $\mathbf y$
$$\mathbf y=\begin{bmatrix} y_1 \\ y_2 \\ y_3\end{bmatrix}$$ A vector squared is a dot product, just a scalar. So then, what is the function to get $$f(\mathbf y)=\begin{bmatrix} y_1^2 \\ y_2^2 \\ y_3^2 \end{bmatrix}?$$
I believe there is no standard function that does this - we can build one that does this job in the way you describe: set
$$f(y) = (y_1 ^2, \ldots)$$
and this is a function.
We can, however, achieve this via a Hadamard product, a pointwise matrix product. Again, a bit nonstandard, but doable.