You could do
hcat( (f(i) for i in 1:4)...)
# or
hcat(ntuple(i->f(i), 4 )...)
They both appear to get constant folded. Remember that this only works well if the length (e.g. 4) is a compile-time constant. If it can change at runtime, you should probably not be using StaticMatrix for this.