Generate combinations with replacement
CJam (8 bytes)

{m*:$_&amp;}


Online demo

Dissection

{    e# Declare block (anonymous function); parameters are n k
  m* e# Cartesian product, which implicitly lifts n to [0 1 ... n-1]
  :$ e# Sort each element of the Cartesian product, to give them canonical forms
  _&amp; e# Deduplicate
}