Stone–Weierstrass-type theorems for groups of group-valued functions with a discrete range or a discrete domain are obtained. We study criteria for a subgroup of the group of continuous functions C ( X , G ) ( X compact, G a topological group) to be uniformly dense. These criteria are based on the existence of so-called condensing functions, where a continuous function ϕ : G → G is said to be condensing (respectively, finitely condensing) if it does not operate on any proper, point separating, closed subgroup of C ( K , G ) , with K compact, (respectively, with K finite) that contains the constant functions. The set D F ( G ) of finitely condensing functions in C ( G , G ) , is characterized, for any Abelian topological group G , as the set of those functions that are both non-affine and do not have nontrivial generalized periods (i.e. that do not factorize through nontrivial quotients of G ). This provides approximation theorems for functions with discrete domain and arbitrary (topological group) range. We also show that when G is discrete, every finitely condensing functions is condensing. The set of D ( G ) of condensing functions is thus characterized for discrete Abelian G . This provides approximation theorems for functions with an arbitrary (compact) domain and a discrete range. Answering an old question of Sternfeld, the description of D ( Z ) that follows is particularly simple: given ϕ : Z → Z , ϕ ∈ D ( Z ) if and only if for every k ∈ N with k ≥ 2 , there are n 1 , n 2 ∈ Z such that n 1 − n 2 is a multiple of k , while ϕ ( n 1 ) − ϕ ( n 2 ) is not.