J (programming language)
|Paradigms :||Purely functional programming language|
|Designer:||Kenneth E. Iverson|
|Current version :||806 (November 12, 2017)|
|Influenced by:||APL , FP and FL|
|Operating system :||Windows , Linux , macOS , Pocket PC|
J is a purely functional programming language , which was developed in the early 1990s by Kenneth E. Iverson and Roger Hui . It is based on the developed by Iverson programming language APL and by John Backus designed programming FP and FL .
Since J is a powerful language in dealing with arrays , and accordingly also with matrices , it is particularly suitable for solving mathematical and statistical problems. J is also MIMD (Multiple Instruction, Multiple Data) capable.
J is based on APL, which requires special characters in the source text , but only uses commands and operands that consist of characters in the range of the ASCII character set. This bypasses some problems that can arise when coding special characters in the source text.
The following code calculates the arithmetic mean ("average") of an array.
avg=: +/ % # avg 1 2 3 4
The definition of the function
avgmakes use of the concept of Tacit programming (Eng. Implicit programming): The operands are not explicitly mentioned in the definition. Instead, the function is defined as a fork . The fork
+/ % #is synonymous with a function
(+/ operand) % (# operand), i.e. H. first the left and right functions are applied to the argument and then the middle dyadic ( binary ) function is
%applied to the results obtained. The left function
+/sums all the elements of the array (in the example call in line 2: 1 + 2 + 3 + 4 = 10), the right function
#supplies the number of elements in the array (in this case 4 elements) and
%divides the left operand the right one (10 ÷ 4 = 2.5).
After the function definition , avg is called with an array
1 2 3 4as an operand.