Coding for discrete sources