I would like to reverse the effect of Counts
, i.e., starting with
x = <|a -> 4, b -> 2, c -> 1|>
I would like to reconstruct a sorted list
y = {a, a, a, a, b, b, c}
such that Counts[y] == x
. I have come up with
y = Join @@ ConstantArray @@@ Normal @ x
but I'd like to know if there's anything more elegant than this, with less intermediary expressions.