Array programming: Difference between revisions

Content deleted Content added
Jon Awbrey (talk | contribs)
m puncs, decaps
Jon Awbrey (talk | contribs)
m Overview: formats
Line 29:
This need to loop and index to perform operations on arrays is both tedious and error prone.
 
In array languages, operations are generalized to apply to both scalars and arrays. Thus, ''a''+''b'' expresses the sum of two scalars if ''a'' and ''b'' are scalars, or the sum of two arrays if they are arrays. When applied to arrays, the operations act on corresponding elements as illustrated in the loops above. Indeed, when the array language compiler/interpreter encounters a statement like:
 
A := A + B
 
andwhere ''A'' and ''B'' are two -dimensional arrays, it generates code that is effectively the same as the C loops shown above. An array language, therefore, simplifies programming.
 
==Example languages==