Confusion with $\hom$ function I'm reading Barr & Wells's Category Theory and I'm very confused about a definition it gives.

Definition
Let $S$ and $T$ be sets, and let $\hom(S, T)$ denote the set of all functions with domain $S$ and codomain $T$. Let $f : T \to V$ be a function. The function
$$\hom(S, f) : \hom(S, T) \to \hom(S, V)$$
is defined by
$$\hom(S, f)(g) = f\circ g$$
$\hom(S, f)$ is an example of a $\hom$ function. Note that $\hom(S, x)$ is overloaded notation: when $x$ is a set, $\hom(S, x)$ is a set of functions, but when $x$ is a function, so is $\hom(S, x)$.

I couldn't understand this definition, how to use it or what's it for… can someone give me a light, an example, or anything that helps so I can understand it?
I didn't understand why to use a function in the second parameter, and I didn't understand $\hom(S, f) : \hom(S, T) \to \hom(S, V)$. If $\hom(A,B)$ is the set of functions with domain in $A$ and codomain in $B$, $\hom(S,f)$ should (at least) have it domain in $S$, but it's not.
 A: $
\newcommand{\Hom}{\mathrm{Hom}}
$
$\Hom(S, f)$ is a function: it takes in a $g\in \Hom(S, T)$, and it outputs the map $f\circ g$, which is an element of $\Hom(S, V)$. Think about it this way: if I give you a map $f$ from $T$ to $V$, this lets me convert a map from $S$ to $T$ (this is $g$) into a map from $S$ to $V$ (this is $f\circ g$).
To explain the notation a bit, the domain of $\Hom(S, f)$ is $\{$maps from $S$ to $T\}$ - that is, $\Hom(S, T)$ - and the codomain of $\Hom(S, f)$ is $\{$maps from $S$ to $V\}$ - that is, $\Hom(S, V)$. So $\Hom(S, f): \Hom(S, T)\rightarrow \Hom(S, V)$ as written in your text. Arguably this is a little misleading.
For example, let's look at groups. Then maybe we have $S=\mathbb{Z}$, $T=\mathbb{Z}/6\mathbb{Z}$, and $V=\mathbb{Z}/2\mathbb{Z}$. Let $f$ be the usual surjective homomorphism from $T$ to $V$: it sends $[0], [2], [4]$ all to $[0]$, and $[1], [3], [5]$ all to $[1]$. Now, suppose $g$ is some homomorphism from $S$ to $T$. Then we can compose $g$ with $f$, to get a map from $S$ to $V$. For example, if we take $g$ to be the usual surjective homomorphism from $S$ to $T$ (namely, $x\mapsto x$ mod $6$), then $f\circ g$ is the usual surjective homomorphism from $S$ to $V$ (namely, $x\mapsto x$ mod $2$).
Think of a triangle, with vertices $S$, $T$, and $V$. $f$ is an edge from $T$ to $V$, and if I have an edge from $S$ to $T$ this lets me build an edge from $S$ to $V$. That's what $\Hom(S, f)$ is doing.
