Newsgroups: comp.lang.apl
Path: watmath!ljdickey
From: ljdickey@watmath.waterloo.edu (L.J.Dickey)
Subject: Re: what is j?
Message-ID: <1991May14.115924.2017@watmath.waterloo.edu>
Organization: University of Waterloo
References: <199113.993.337@canrem.uucp>
Distribution: comp
Date: Tue, 14 May 1991 11:59:24 GMT
Lines: 76

In article <199113.993.337@canrem.uucp> "greg trice"
>	<greg.trice@canrem.uucp> writes:
>  I've only recently started to read this group, and I'm mystified by
>all the references to J. I assume it is a language, if so, what
>relationship does it have to APL? I've used APL for many years and I've
>never seen any other language that remotely resembled it. Is J such an
>animal? Perhaps for the benefit of those new to J somebody could post a
>listing showing where APL and J differ. I'm assuming J has some
>relationship to APL because why would it be discussed here otherwise?

J is a dialect of APL.  Its special features include boxed arrays,
complex numbers, the rank operator, other new operators, hook and
fork, and tacit function definition.  Its closest linguistic relative
is SAX APL ( Sharp APL for UNIX ).   It runs on several machines,
including Mac, PC, Atari ST, Archimedes, SUN, MIPS, VAX (BSD), SGI,
and NeXT.  The code is easily portable, because it is fully ascii
text.  The software is free to those who have net or BBS access.

It is currently being developed by Iverson Software Incorporated
(yes, the same Iverson who invented APL).

Some interesting examples of J code are:

           data =. 10 + i. 6
           data
        10 11 12 13 14 15
           sum =. +/
           sum data
        75
           $ data
        6
           avg =. sum % $
           avg data
        12.5

You can learn a lot about J from this example.
Index origin is always 0.
Tacitly defined verbs (such as "sum" and "avg"), don't mention the
argument.

The function "avg" above is an example of a fork.  The fork comes
in two flavors, monadic and dyadic. The monadic fork
		(f g h) y
means
		(f y) g (h y)
and the dyadic fork
		x (f g h) y
means
		(x f y) g (x h y)
.  A model that I keep in my head for the dyadic fork can be
illustrated by the "lessthan or equal" idea, which this example
shows:

		   or =.   +.
		   1 0 1 0 or 1 1 0 0
		1 1 1 0

		   5 < i. 10
		0 0 0 0 0 0 1 1 1 1
		   5 = i. 10
		0 0 0 0 0 1 0 0 0 0
		   5 ( < or = ) i. 10
		0 0 0 0 0 1 1 1 1 1

Yes, of course, J does have a "lessthan or equal" verb of its own,
so the above particular lines probably would not be used in any
application.  It is just that this example shows how natural the
fork is, and how close it is to common usage.  It is surprising
to me that it has not been introduced into programming languages
before.

-- 
Prof L.J. Dickey, Faculty of Mathematics, U of Waterloo, Canada N2L 3G1
	internet:	ljdickey@watmath.UWaterloo.ca
	obsolescent?:	ljdickey@watmath.waterloo.edu
	UUCP:		ljdickey@watmath.UUCP	..!uunet!watmath!ljdickey
