Varargs of vectors and scalars under modulo

I would first switch the order of modulo and the vectors, replace the list of vectors by a single vector argument followed by trailing dots, get the number of vectors with length(u̲) and replace the loop accordingly.

Something like this:

function list_span(modulo::Int, u̲::Vector{T}...) where T <: Number
	span = Vector{T}[]
    n_vec = length(u̲)

    for j in 0:modulo^n_vec-1
        λ = digits(j, base=modulo, pad=n_vec)
        w̲ =mod.(sum(λ .* u̲), modulo)
		if w̲ ∉ span
			push!(span, w̲)
		end        
    end	
	return span
end
2 Likes