The J programming language [Berry 1970,Burk 2001,Bur 2001,Hui 2001] is, perhaps, the only programming language which satisfies
the criteria of Section 1.1. J uses infix notation with primitive functions denoted by
a special symbol, such as +
or %
, or a special symbol or word followed by the suffix of .
or :
.
Each function name may be used as a monad (one argument, written to the right) or as a dyad (two
arguments, one on the left, the other on the right).
The J vocabulary of primitive (built-in) functions is shown in Figures 1 and 2. These
figures show the monadic definition of a function on the left of the *
and the dyadic
definition on the right. For example, the function symbol +:
represents the monad double
and the
dyad not-or
(nor
).
J uses a simple rule to determine the order of evaluation of functions in expressions.
The argument of a monad or the right argument of a dyad is the value of the entire expression
on the right. The value of the left argument of a dyad is the first item written
to the left of the dyad. Parentheses are used in a conventional manner as punctuation
which alters the order of evaluation. For example, the expression 3*4+5
produces
the value 27
, whereas (3*4)+5
produces the value 17
.
The evaluation of higher level functions (function producing functions) must be done (of course)
before any functions are applied. Two types of higher level functions exist; adverbs (higher level
monads) and conjunctions (higher level dyads). Figures 1 and 2
show adverbs in bold italic face and conjunctions in bold face. For example, the conjunction
bond (Curry) binds an argument of a dyad to a fixed value producing a monad function as a result
(4&*
produces a monad which multiplies by 4
).
J is a functional programming language which uses functional composition to model computational
processes. J supports a form of programming known as tacit. Tacit programs have
no reference to their arguments and often use special composition rules known as hooks
and forks. Explicit programs with traditional control structures may also be written.
Inside an explicit definition, the left argument of a dyad is always named x.
and the
argument of a monad (as well as the right argument of a dyad) is always named y.
.
J supports a powerful set of primitive data structures for lists and arrays. Data (recall that functions have first-class status in J), once created from notation for constants or function application, is never altered. Data items possess several attributes such as type (numeric or character, exact or inexact, etc.) shape (a list of the sizes of each of its axes) and rank (the number of axes). Names are an abstraction tool (not memory cells) which are assigned (or re-assigned) to data or functions.