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

www.microapl.co.uk

+ Add


Two-argument form  See also one-argument form Identity (Conjugate)

Adds the numbers in the right and left-hand arguments:

             12+3                     (Adds two scalars)
       15
             3 7 2+0 1 ¯4             (Adds the corresponding numbers
       3 8 ¯2                          in vectors of equal size)
             11+65 23 98 3            (Adds 11 to each number in a vector)
       76 34 109 14
             TABLE ← 2 3 ⍴ ⍳ 6        (Puts the numbers 1 to 6 in TABLE)
             10+TABLE                 (Adds 10 to each number in TABLE)
       11 12 13
       14 15 16
             TABLE+TABLE              (Adds corresponding numbers in
       2 4 6                          matrices of equal size and dimensions)
       8 10 12
             1 +5 (2 2 ⍴⍳4) (⍳5)      (Scalar left argument added to all
        6    2 3   2 3 4 5 6           elements of right argument)
             4 5
             2  3+5 (2 2 ⍴⍳4) (⍳5)    (Arguments must be the same length)
       LENGTH ERROR
             2 3+5(2 2⍴⍳4)(⍳5)
             ^
             (2 2⍴⍳4) 10 (5⍴3)+5 (2 2 ⍴⍳4) (⍳5)
       6 7    11 12   4 5 6 7 8       (Corresponding elements added)
       8 9    13 14

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