Array: Difference between revisions
Content added Content deleted
m (grammar) |
(not a task; don't use {{header}}) |
||
Line 9: | Line 9: | ||
In most programming languages, arrays are accessed by using the array brackets <code>[</code> and <code>]</code>, e.g. in <code>A[i]</code>, but exceptions are [[Rexx]], instead using the dot operator <code>.</code>, such as in <code>A.i</code>, [[Ada]] and [[BASIC]] which use round parentheses <code>A(i)</code>, and of course in the [[LISP|lisps]] which uses constructions like <code>(ELT A n)</code> for accessing and <code>(SETA A n new_val)</code> for setting (Interlisp) or <code>(vector-ref A n)</code> for accessing and <code>(vector-set! A n new_val)</code> for setting (Scheme). No bracket indexing occurs in [[J]], an array language; instead, the normal syntax of function creation and function calling applies. |
In most programming languages, arrays are accessed by using the array brackets <code>[</code> and <code>]</code>, e.g. in <code>A[i]</code>, but exceptions are [[Rexx]], instead using the dot operator <code>.</code>, such as in <code>A.i</code>, [[Ada]] and [[BASIC]] which use round parentheses <code>A(i)</code>, and of course in the [[LISP|lisps]] which uses constructions like <code>(ELT A n)</code> for accessing and <code>(SETA A n new_val)</code> for setting (Interlisp) or <code>(vector-ref A n)</code> for accessing and <code>(vector-set! A n new_val)</code> for setting (Scheme). No bracket indexing occurs in [[J]], an array language; instead, the normal syntax of function creation and function calling applies. |
||
== |
==[[C]]== |
||
We wish to open a text file and compute letter frequency |
We wish to open a text file and compute letter frequency |
||
Line 32: | Line 32: | ||
} |
} |
||
== |
==[[J]]== |
||
The example task is the same: open a text file and compute letter frequency. |
The example task is the same: open a text file and compute letter frequency. |
||
<br>Written in this array programming language, no loops are specified. |
<br>Written in this array programming language, no loops are specified. |