Don Watson wrote:
The grammar of tacit S is identical to the grammar of explicit J ...
You can come close to S with J's tacit programming
--------------------------------------------------
Here are three verbs for the distance formula, distance is (Sum of (x-y)^2) ^
0.5
d =: 4 : '(+/(x-y)^2)^0.5'
d1 =: ([: +/([ - ]) ^ 2"_) ^ 0.5"_
d2 =: ([: +/ - ^ 2"_) ^ 0.5"_
p =: 1 2
q =: 4 6
p (d,d1,d2) q NB. Distance from p to q three ways
5 5 5
Explicit verb d is a straightforward transcription of the algebraic formula.
Tacit verb d1 is a recognizable transcription of the explicit once you know [: f g means "the f
of g" and 2"_ and 0.5"_ are constant functions -- for every x and y, 2"_ y is 2 and x 2"_ y is 2.
My point is, verb d1 is fairly close to the way Don Watson's S would express it: you can come
close to S with J's tacit programming.
Tacit verb d2 is less recognizable because unneeded left and right identity functions have been
removed.
Learning to appreciate trains
-----------------------------
A train f g h i j (in which the letters represent verbs) can be visualized as a binary tree
created from right to left
g
/ \
f i
/ \
h j
The application (f g h i j) y means right argument y is supplied at each terminal node f, h, j,
and the application x (f g h i j) y means left and right arguments x and y are supplied at each
terminal node. Thus
(f g h i j) y means (f y) g (h y) i (j y)
and
x (f g h i j) y means (x f y) g (x h y) i (x j y).
A left terminal node may be [: (cap), in which case no argument is supplied there, and the
parent node is applied monadically to the result of the right node. Thus
(f g [: i j) y means (f y) g (i j y),
x (f g [: i j) y means (x f y) g (i x j y).
Beginners should avoid trains in which a left terminal node is missing.
A balanced tree can be accomplished with parentheses:
train (u f v) g h i j is
g
/ \
f i
/ \ / \
u v h j
Kip Murray
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm