the 'J' Language
Home pages:
JEHS 
Stats 
SCU 
WRI 
Maths 
Warwick
What is J?
J is a concise and powerful language
for communicating mathematical ideas unambiguously,
not least between humans and computers.
Full details and software can be found at
http://www.jsoftware.com.
J has the usual builtin operations like
+
,

,
*
(multiply),
%
(divide), and
^
(exponential or power).
Some other important mathematical ideas are expressed in J as
a character followed by a colon or a full stop.
For example,
'not' is represented in J by .
,
'matrix inverse' by %.
,
'root' (including 'square root') by %:
,
'log' by ^.
,
'polynomial' by p.
,
and 'Taylor coefficient' by t.
.
J really is best thought of as a language 
objects are nouns, functions are verbs
whose action may be modifed by adverbs like /
(see below), etc.
While learning J I have sometimes found it helpful
to point and read aloud!
For example, the following brief dialogue between myself and the computer:
x=. i. 10
x
0 1 2 3 4 5 6 7 8 9
+/ x
45
# x
10
mean=. +/ % #
mean x
4.5
may be read as:

ME: x is defined to be a list of the first 10 nonnegative integers

(
i.
is an inbuilt J verb)

ME: what is x?

(J sentences typed into a computer are either definitions,
containing
=.
,
or instructions to evaluate something,
i.e. implicit questions of the type
'what do you understand by ...?')

PC: <answers>

(note that whatever I type is indented but the computer's replies are not)

ME: sum over x

(more formally, insert a '
+
' between the items of x,
and evaluate the resulting expression)

PC: <answers>

(correctly!)

ME: what is the number of items in x?

(
#
is another inbuilt J verb)

PC: <answers>

ME: "mean" is defined to be "sum over" divided by "number of items in"

(note that verbs  functions  in J can be defined directly,
without reference to dummy arguments etc.
This is particularly useful because much of mathematics, such as
group theory,
studies verbs rather than nouns)

ME: what is the mean of x ?

PC: 4.5

(I have now taught the computer the definition of "mean").
Excellent introductory documentation,
including examples of statistical applications in J,
can be obtained from
Keith Smillie's home page.
See also
Jack Siler's
J page,
Jim Weigang's home page (for APL),
Vector
(journal of the British APL Association),
and the
J Archives
at Waterloo.
My own embryonic "Introduction to J" is available as zipped postscript
in A4
or US letter
sizes.
I hope to update and expand it soon. Honest.
Scripts
J code like the above is conveniently stored in text files called
(J) scripts.
You may like to look at:

jehutils.js
,
a script of J utilities (contained in the following zipfile).

jfwjehs.zip
,
a zipfile of various J scripts
(expands to form jfw/jehswww
and subdirectories thereof).
Disclaimers

J has a very steep learning curve,
and I have only been using J in earnest since November 1995.
Please don't treat my J code as necessarily a good example.

The J scripts I have made available on the WWW are somewhat
outdated, but I hesitate to disseminate newer test versions.
Note in particular that some of the
@
symbols ('atop')
should be replaced by @:
('at')
following changes in J version 3.03.

I have no connection with J's developers and vendors,
except as a delighted customer.
My (Current) Top 10 Reasons for Using J

Power
Like APL (but much more so),
J is a powerful language for expressing mathematical concepts,
for quickly trying out crazy ideas to see which ones aren't so crazy
after all,
and for catalysing insights into the underlying maths.

Communicability
Unlike APL, J uses just standard ASCII.

Coherence
J is not designed by a committee 
it is the brainchild of one person (Ken Iverson),
with additional input by Roger Hui and feedback from other users.
J didn't have to be downwardly compatible with anything
(don't think of it as APL++!)

Programming Environment
The J development environment makes it easy to split up a huge
programming task into manageable chunks.
Divide and conquer.

Portability
The J language is fully portable
(in theory to any system with a C compiler).

Flexibility
The PC implementation for professional developers can be linked
to other software by DLLs, OLE etc.
(specific user interfaces on the one hand,
numbercrunching engines on the other).

Windows
The PC implementation makes MSWindows programming bearable.
Impressivelooking user interfaces can be produced with minimum pain.

Poverty
A version of J (including all documentation)
is freely available from
http://www.jsoftware.com.
You can try before you buy,
and endusers will not have to pay any extras to use software
produced in J.
Before 1996 I used a commercial APL,
whose vendors wanted £1500 per annum from the Statistics Department
for continuing support.

Fatfree
The complete J system takes around 5 Mb disk space.
Small is beautiful.

Morale
This frees my CDRom
(that I bought with every intention of programming in C++)
so that I can listen to music while working late at night.
Essential for morale.
Pertinent (& Impertinent) Quotes

In science, each new point of view calls forth a revolution in nomenclature.

Friedrich Engels.

A good notation has a subtlety and suggestiveness which at times
make it almost seem like a live teacher.

Bertrand Russell.

It is a profoundly erroneous truism, repeated by all copy books and by
eminent people when they are making speeches,
that we should cultivate the habit of thinking of what we are doing.
The precise opposite is the case.
Civilization advances by extending the number of important operations
which we can perform without thinking about them.

Alfred North Whitehead,
Introduction to Mathematics.
This page is maintained by
J.E.H.Shaw@warwick.ac.uk.