It is also possible to do the same thing, but with iterators instead of vectors. (This avoids storing the indices in memory.)
function alpha_iterator(::Val{N}, s, t=()) where {N}
N <= 1 && return ((s, t...),) # Iterator over a single Tuple
Iterators.flatten(alpha_iterator(Val(N-1), s-i, (i, t...)) for i in 0:s)
end
which produces the same sequence:
julia> println.(alpha_iterator(Val(3),3));
(3, 0, 0)
(2, 1, 0)
(1, 2, 0)
(0, 3, 0)
(2, 0, 1)
(1, 1, 1)
(0, 2, 1)
(1, 0, 2)
(0, 1, 2)
(0, 0, 3)