Topic: APLX Help : Help on APL language : APL Primitives : ^ And
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

^ And


Compares two arguments which must consist only of 0's and 1's. If both elements compared are 1's, the result for that comparison is 1. Otherwise the result for that comparison is 0.

             1 ^ 1
       1
             1 ^ 0
       0
             0 ^ 0
       0
             0 0 0 1 1^1 1 1 1 0     (Each element in a vector is compared
       0 0 0 1 0                      with the corresponding element in a
                                      vector of equal size)
             TABLE←3 3⍴1 1 1 0 0 0 1 0 1
             1^TABLE                 (Each element in a matrix is compared
       1 1 1                          with 1)
       0 0 0
       1 0 1
             ^/TABLE                 (Applies ^ to each row of the matrix.
       1 0 0                          A 1 in the result shows that the
                                      corresponding line contained only 1's)
             ^\1 1 1 0 1 0 1 0 1     (The result is all 0's after the first 0)
       1 1 1 0 0 0 0 0 0

Topic: APLX Help : Help on APL language : APL Primitives : ^ And
[ Previous | Next | Contents | Index | APL Home ]