J (programming language)

from Wikipedia, the free encyclopedia
J
Paradigms : Purely functional programming language
Publishing year: 1990
Designer: Kenneth E. Iverson
Developer: JSoftware
Current  version : 806   (November 12, 2017)
Typing : weak
Influenced by: APL , FP and FL
Operating system : Windows , Linux , macOS , Pocket PC
License : GPLv3
Jsoftware.com

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.

In contrast to many other languages ​​that allow object-oriented programming , the flexible, hierarchical namespace scheme of J enables both class-based and prototype-based programming.

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.

Although J corresponds to the MIMD architecture and not the Von Neumann architecture , it can also be used like a Von Neumann language.

Sample code

The following code calculates the arithmetic mean ("average") of an array.

avg=: +/ % #
avg 1 2 3 4

Edition: 2.5

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.

Individual evidence

  1. www.jsoftware.com .
  2. J806 release November 12, 2017 .

Web links