       else if Array.isArray a and Array.isArray b
         if a.length != b.length
           throw "Cannot perform min operation with array operands of different lengths"
-        numbersOnly = true
-        for i in [0...a.length]
-          if typeof a[i] != 'number' or typeof b[i] != 'number'
-            numbersOnly = false
-            break
-        if numbersOnly
+        if (isArrayType a, 'number') and (isArrayType b, 'number')
           (Math.min a[i], b[i]) for i in [0...a.length]
         else 
           "min(#{glsl.vec3Lit a}, #{glsl.vec3Lit b})"

      else if Array.isArray a and Array.isArray b
        if a.length != b.length
          throw "Cannot perform operation with arrays of different lengths"
        numbersOnly = true
        for i in [0...a.length]
          if typeof a[i] != 'number' or typeof b[i] != 'number'
            numbersOnly = false
            break
        if numbersOnly
          (Math.max a[i], b[i]) for i in [0...a.length]
        else 
          "max(vec3(#{a}), vec3(#{b}))"

          when -1 then "-#{b}"
          else 
            # Number must not be integers (bitwise op converts operand to integer)
            "#{glsl.floatLit a} * #{b}"
      else if typeof b == 'number'
        switch b
          when 0 then 0
