  We prove that every distributive algebraic lattice with at most $\aleph\_1$
compact elements is isomorphic to the normal subgroup lattice of some group and
to the submodule lattice of some right module. The $\aleph\_1$ bound is
optimal, as we find a distributive algebraic lattice $D$ with $\aleph\_2$
compact elements that is not isomorphic to the congruence lattice of any
algebra with almost permutable congruences (hence neither of any group nor of
any module), thus solving negatively a problem of E. T. Schmidt from 1969.
Furthermore, $D$ may be taken as the congruence lattice of the free bounded
lattice on $\aleph\_2$ generators in any non-distributive lattice variety. Some
of our results are obtained via a functorial approach of the semilattice-valued
"distances" used by B. Jonsson in his proof of Whitman's embedding Theorem. In
particular, the semilattice of compact elements of $D$ is not the range of any
distance satisfying the V-condition of type 3/2. On the other hand, every
distributive join-semilattice with zero is the range of a distance satisfying
the V-condition of type 2. This can be done via a functorial construction.
