Personally I would just use a single array to store the output values because 
they don't interact with each other.
    
    
    type
        Vec*[N: static[int], V] = array[N, V]
        Vec3*[V] = Vec[3, V]
    
    var
        a = Vec3[int]([1, 2, 3])
        b = Vec3[int]([-1, 2, 5])
        c = Vec3[int]([1, -2, 4])
        s = @[a, b, c]
    
    
    proc min[T](vals: varargs[Vec3[T]]): Vec3[T] =
        
        result = vals[0]
        
        for v in vals:
            result[0] = min(v[0], result[0])
            result[1] = min(v[1], result[1])
            result[2] = min(v[2], result[2])
    
    
    echo min(s)
    echo min(a, b, c)
    
    
    Run

My main two issues with this is that the first check is redundant, but I'd 
argue it's ok because it makes the code a bit cleaner. And that I'm not sure 
that the proc name is what I would use, but that is easily changable.

Reply via email to