>>107074995
Here's a quote from "Category Theory for Computing Sciences" by Barr&Wells:
2.5.7 Kleene closure induces homomorphisms Let A and B denote
sets, thought of as alphabets. Let f : A −
B be any set function. We define
f ∗ : A∗ −
B ∗ by f ∗ ((a1 , a2, . . . , ak )) = (f (a1 ), f (a2 ), . . . , f (ak )). In particu-
lar, f ∗ () = () and for any a ∈ A, f ∗ (a) = f (a).
Then f ∗ is a homomorphism of monoids, a requirement that, in this
case, means it preserves identity elements (by definition) and concatenation,
which can be seen from the following calculation: Let a = (a1 , a2, . . . , am )
and a0 = (a0 1 , a0 2 , . . . , a0 n ) be lists in A∗ . Concatenating them gives the list
aa0 = (a1 , a2, . . . , am , a0 1 , a0 2 , . . . , a0 n )
Then
f ∗ (a)f ∗ (a0)==f ∗ (a1 , a2 , . . . , am )f ∗ (a0 1 , a0 2, . . . , a0 n)
(f (a1 ), f (a2 ), . . . , f (am ))(f (a0 1 ), f (a0 2 ), . . . , f (a0 n))
34
Categories
===(f (a1 ), f (a2 ), . . . , f (am ), f (a0 1 ), f (a0 2 ), . . . , f (a0 n ))
f ∗ (a1 , a2 , . . . , am , a0 1, a0 2 , . . . , a0 n )
f ∗ (aa0)
Thus any set function between sets induces a monoid homomorphism be-
tween the corresponding free monoids.
The function f ∗ is called αf in [Backus, 1981a] and in modern functional
languages is usually called map f or maplist f .
It is FUNCTIONAL. It's just a sugar for map.