[Next] [Up] [Previous] [Contents]
Next: Vector coersion operator Up: Vectors and vector operators Previous: The concatenation operator

Extension of operators to vectors

Logical operators extend to vectors in the obvious way, by applying them one-by-one to the elements of the vector. That is, if f is a unary operator, then

        f[x,y] = [f(x),f(y)]
For example,

        ~[0,1,0] = [1,0,1]
Binary logical operators extend similarly. That is, if * is a binary operator, then

        [w,x] * [y,z] = [w*y, x*z]
For example,

        [0,1] & [1,1] = [0,1]

A binary logical operator may be applied to two vectors only when the vectors have the same length.



Ken McMillan
Sat Jun 6 21:41:59 PDT 1998