A tacit expression is a sequence of J operations, which can be separated from its arguments. In other words, it preserves its features when put between parentheses or assigned to a name.
Tacit expressions is one of the pillars of J programming. They make possible functional programming of a special kind: not only stateless computation, but the one without variables.
Here we shall discuss, what features of J make up tacit expressions.
Contents
Introduction
To better understand the tacit facilities in J we will talk about the dataflow of evaluation in J. An expression always results in a single output. The input creates a number of cases: monadic has one argument, dyadic input has two. Typically, adverb can have up to three inputs, and conjunction up to four. However, adverbs and conjunctions may themselves produce adverbs and conjunctions thus resulting in expressions with arbitrary number of inputs.
1 '2' 3 (2 : '2 : ''+''') 4 '5' 6 NB. six inputs 7
Sections of the dataflow also have different throughput capacities: ranks of data that can be passed at a time. As a result when passing through different sections, undergoing re-shaping, splitting and combing structural operations as well as boxing and opening, different amounts of data may follow separate paths, and reconstruct in different ways.
Building the Pipeline
We can think of the evaluation dataflow as a pipeline through which the data passes. The basic units of the pipeline are monadic and dyadic verbs. Monadic verb makes a straight section of the pipeline: one input and one output. Dyadic verb creates a join: two inputs result in one output. The higher order operations and trains serve as links in the pipeline that combine sections together and structure the pipeline in a number of ways: append two sections for sequential evaluation, branch the input sending the data along parallel paths, change the position of the inputs, or apply a section to parts of the input in a certain order or otherwise modify a section so that it is evaluated differently.
Reordering Input
Reflexive adverb u~ y branches the input and evaluates u dyadically.
Passive adverb x u~ y swaps the two streams of input.
Form |
Monad |
Dyad |
Rank |
[x] u~ y |
|
|
_ ru lu |
Sequence
The following conjunctions link two verbal sections to be evaluated in sequence. The differ in rank and treatment of dyadic case.
Name |
Form |
Monad |
Dyad |
Rank |
Atop |
u@v |
|
|
mv mv mv |
At |
u@:v |
_ _ _ |
||
Compose |
u&v |
|
mv mv mv |
|
Appose |
u&:v |
_ _ _ |
Dual
The following produce a three part sequence of verbal sections with the last one being the obverse of the first.
Under piecewise |
u&.v |
|
|
mv mv mv |
Under in toto |
u&.:v |
_ _ _ |
Train of Verbs
In verbal trains monadic or diadic input is optionally branched and/or separated (dyadic into two monadic) and applied dyadically or monadically to the verbs sequentially or by joining the results of intermediate evaluation into a dyadic input.
Name |
Form |
Monad |
Dyad |
Rank |
Hook |
(u v) |
|
|
_ _ _ |
Fork |
(w u v) |
|
|
_ _ _ |
Capped Fork |
([: u v) |
|
|
_ _ _ |
Dyadic fork is the most general case, whereas other cases are obtained by removal of certain branches or splits.
In [1] the effect of hook was achieved by the Withe conjunction, except its rank was mv lu mv.
Higher order operations
In general, the foundation of J language, the parts of speech -- adverbs, conjunctions and gerunds -- do the job of linking the sections of the pipeline to produce various types of pathways.
Selection
This group of conjunctions control the manner in which verbal sections are selected and applied.
Power conjunction u^:n (u^:v) specifies whether (n=0 or not), how many times (|n) or using the obverse (n<0) to apply the verbal section, based on the value of noun n (result of verb v). (See Dyadic Bond conjunction.)
Power |
u^:n |
|
|
_ _ _ |
Agenda conjunction m@.n (m@.v) selects a verb of gerund m, based on the value of n (result of v). If n (result of v) is boxed it creates a parenthezised train.
Evoke Gerund Append m`:0 creates a train with Append (,) between verbs of m.
Evoke Gerund Train m`:6 creates a train of verbs of m.
Apply foreign x 128!:2 y applies string in x to y.
Conjunction Adverse u::v evaluates v is u fails.
Structural
Structural modifyers control how data is broken into pieces and sent through the verbal sections.
Rank conjuntion f"n modifies the throughput capacity of a verbal section.
Monadic adverb Insert u/ y (m/ y) or Evoke Gerund Insert m`:3 y break the input into items (cells of rank _1) and insert the verb u (cyclically verbs of m).
Dyadic adverb Table x u/ y applies u to each cell of x and y in toto.
Monadic conjunction Determinant u . v applies u and v recursively on minors of the input.
Dyadic conjunction Dot Product u . v applies as u@(v"(1+lv,_)).
Level At conjunction u L: n applies the verb u at the levels specified by n.
Spread conjunction u S: n produces the list resulting from applying u to the argument(s) at levels n.
Note: other higher order operations may result in piecewise passage of input, for example &.> and @ as oppsed to @: control how data is broken for further processing. Also, combination of selection and structural verbs applied to to the same input sent along parallel paths and then collected can explicitly accomplish a similar result of structural dataflow.
Partitions
Partitions are related to structural modifiers. They apply verbs to intra-cell possibly overlapping parts of the input other than left/right argument or rank cells.
Form |
Monad |
Dyad |
Rank |
u\ m\ |
Prefix |
Infix |
_ 0 _ |
u\. m\. |
Suffix |
Outfix |
_ 0 _ |
u/. m/. |
Oblique |
Key Classify |
_ _ _ |
Cut conjuntions u;.n (m;.n) define another family of partitioning modifyers.
Form |
Monad |
Dyad |
Rank |
u;. 0 |
Reverse each axis |
Sub-block |
_ 2 _ |
u;. 1 |
By initial preserving fret |
By frets in x |
_ 1 _ |
u;._1 |
By initial fret |
_ 1 _ |
|
u;. 2 |
By final preserving fret |
_ 1 _ |
|
u;._2 |
By final fret |
_ 1 _ |
|
u;. 3 |
Max blocks |
By blocks |
_ 2 _ |
u;._3 |
By complete blocks |
_ 2 _ |
Specialization
Monadic Bond conjunction u&n and m&v fixes the nound to the dyadic verb.
Dyadic Bond conjunction x u&n y and x m&v y in addition uses x as Power conjunction n argument.
Inverse Conjunction u:.v specifies the obverse v for verb u.
Fit conjunction modifies certain verbs in ways prescribed in their definitions.
Mathematical
Taylor u t., Weighted Taylor u t:, Taylor Approximation u T. n
Even u..v, Odd u.:v
Derivative conjunction u d. n, u D. n.
Secant Slope u D: n
Hypergeometric m H. n
Related Areas
Argument Aliases
Argument aliases make tacit expressions look as familiar mathematical formulas.
'`X Y'=: [`] sum=: X + Y
Tacit Valued Explicit Definitions
Non-tacit Expressions
Tacit Definition
Explicit Definition
See Also
[1] Iverson, K.E., A Dictionary of APL, ACM APL Quote-Quad, Volume 18, Number 1, September, 1987.
[2] Roger K. W. Hui, Kenneth E. Iverson, Eugene E. McDonnell: Tacit Definition. APL91, Conference on APL 1991: 202-211
[3] E. E. McDonnell , K. E. Iverson, Phrasal forms, ACM SIGAPL APL Quote Quad, v.19 n.4, p.197-199, Aug. 1989
Functional_programming, Wikipedia
Parts of speech, J Dictionary
Trains, ibid
Discussion
Monadic hook (f g) y is a generalization of reflexive. In fact, (f ]) y ≡ f~ y . In general, hook reflects its argument with a modified self on the right. For example, (>. -) is magnitude, (% >./) is scaling. -- OlegKobchenko 2006-05-22
This page is meant to focus on the reflexive. It is true that hook is a generalization of reflexive, but why stop there? Fork is a generalization of hook, and the monad f~ is just the monad of the fork ] f ] . -- RogerHui 2006-05-22 16:33:19
Discussing a subject, it is good to mention related areas. There is an immediate analogy: y f y and y f g y . And the idea about fork is good too: (h y) f (g y). The common benefit of these facilities is reusing the argument without explicit indication, thus extending the possibilities for tacit expressions. -- OlegKobchenko 2006-05-22 17:39:52
In this case, by mentioning too many things you lose focus and can lead the reader astray. See following item. -- RogerHui 2006-05-22 19:43:37
... or the writer, yes. I suggest moving the proceedings of this discussion into a new topic, such as "Tacitization", then link from here. It would describe the role of each feature (reflexive, passive, hook, fork, atop, etc.) with patterns (use cases) and examples, etc. -- OlegKobchenko 2006-05-22 20:48:42
Perhaps we should mention the contexts where a person learning, reading, or maintaining J code is likely to encounter ~. I find it is usually applied as a stylistic measure. Apropos of the preceding comments, it is usually in association with either hook or fork:
One of the most common and useful applications of ~ is within a hook. Two examples:
Monadic filtering: #~ f where f is the filter, e.g. #~ 0 < ] NB. Select positive numbers
Classification of data: g/.~ f where f is the classification function and g processes classes, e.g. </.~ * NB. Group by sign
Another common use of ~ is in forks. To increase readability, ~ is used to shorten or simplify long trains. That is: a complex, parenthesized right tine (usually a train itself) is often swapped with a simpler left tine, with the middle tine commuted, so that the parens around the tine can be removed. Example:
(+/ % #) % <./ becomes <./ %~ +/ % #.
This transformation is usually applied both iteratively and recursively, resulting in a flattened (minimally parenthesized), but equivalent train. I call this transformation flattening, front-loading, or right-loading.
-- DanBron 2006-05-22 18:08:14
The use of ~ in the preceding point is irrelevant, as in both cases it is the dyad f~ (passive or commute) that is used. -- RogerHui 2006-05-22 19:43:37
I was aware, when I wrote them, that my comments made no use of "reflexive". Notice that I don't use that word, but I do use the word "commuted" (and "swapped"). Most references are to the symbol ~ (hence "... is likely to encounter ~") . I wasn't led astray so much as I was continuing a train of thought (hence "Apropos of the preceding comments ... "). Oleg has given a useful name to the ideas I was trying to express.
I think such a essay would be more useful and interesting than one dedicated only to "reflexive", as dyadic invocations of f~ are much more common, widespread, and useful than monadic invocations. Of the examples given, I, personally, have only ever used 2. Of the remainder, half are reproductions of primitives.
-- DanBron 2006-05-22 21:19:04Well then you should write that other essay, rather than try to cram unrelated ideas into an essay on reflexive. -- RogerHui 2006-05-22 21:28:07
From Essays/Reflexive
The discussion will continue here. The material of the discussion will be gradually adapted for the body of this topic. -- OlegKobchenko 2006-05-22 23:22:51
I had only the idea to help users read code. I did not have the idea to split it onto a seperate essay. The credit there belongs to Oleg. I considered my comments incentives to rename and repurpose your essay. Moot now; we have the skeleton of the new essay. -- DanBron 2006-05-23 00:28:36
I'm focusing on the interpretation hierachy essay, so I probably won't contribute large passages to this. But I'll contribute ideas or seeds, if that's helpful. -- DanBron 2006-05-23 00:28:36

![\xymatrix@=6pt@C=0pt{u\\ \\ y\ar@/^/[uu]\ar@/_/[uu] } \xymatrix@=6pt@C=0pt{u\\ \\ y\ar@/^/[uu]\ar@/_/[uu] }](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_89327f253c9ee03367fad4c7f77a382e3885c0f8_p1.png)
![\xymatrix@=6pt@C=0pt{&u\\ \\ x\ar@(ur,dr)[uur]& &y\ar@(ul,dl)[uul] &} \xymatrix@=6pt@C=0pt{&u\\ \\ x\ar@(ur,dr)[uur]& &y\ar@(ul,dl)[uul] &}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_69120a55f260c0e4972ce591b5b8376e2645a8a4_p1.png)
![\xymatrix@=8pt@C=0pt{&u&\\ &v\ar[u]&\\&y\ar[u]&} \xymatrix@=8pt@C=0pt{&u&\\ &v\ar[u]&\\&y\ar[u]&}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_6414dcb6dd76f25ca55da82d2a8ba2a868c6222f_p1.png)
![\xymatrix@=8pt@C=0pt{&u&\\ &v\ar[u]&\\x\ar[ur]&&y\ar[ul]} \xymatrix@=8pt@C=0pt{&u&\\ &v\ar[u]&\\x\ar[ur]&&y\ar[ul]}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_6c4fca0af577f8379b04b8b75f9c1e7ae9ec64d6_p1.png)
![\xymatrix@=8pt@C=0pt{&u&\\v\ar[ur]&&v\ar[ul]\\x\ar[u]&&y\ar[u]} \xymatrix@=8pt@C=0pt{&u&\\v\ar[ur]&&v\ar[ul]\\x\ar[u]&&y\ar[u]}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_b996d5d9da4309b062a3c97e05ec68020654b7ac_p1.png)
![\xymatrix@=8pt@C=0pt{v^{-1}\\u\ar[u]\\v\ar[u]\\y\ar[u]} \xymatrix@=8pt@C=0pt{v^{-1}\\u\ar[u]\\v\ar[u]\\y\ar[u]}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_9c5bfe0896cdb7cd4a74f8847e5d60baa7aa5bec_p1.png)
![\xymatrix@=8pt@C=0pt{&v^{-1}\\&u\ar[u]&\\v\ar[ur]&&v\ar[ul]\\x\ar[u]&&y\ar[u]} \xymatrix@=8pt@C=0pt{&v^{-1}\\&u\ar[u]&\\v\ar[ur]&&v\ar[ul]\\x\ar[u]&&y\ar[u]}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_8e2755f23080fcf7b3299aa5ad4df127db93eb10_p1.png)
![\xymatrix@=8pt@C=0pt{u\\ &v\ar[ul]\\y\ar[uu]\ar[ur]} \xymatrix@=8pt@C=0pt{u\\ &v\ar[ul]\\y\ar[uu]\ar[ur]}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_629071037938e6e9fbeb21ccc3ab895b7531bd71_p1.png)
![\xymatrix@=8pt@C=0pt{u&\\&v\ar[ul]\\x\ar[uu] &y\ar[u]} \xymatrix@=8pt@C=0pt{u&\\&v\ar[ul]\\x\ar[uu] &y\ar[u]}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_e23064c55292c6ecc3651ea84b3d7c16e90a3837_p1.png)
![\xymatrix@=8pt@C=0pt{&u&\\w\ar[ur]& &v\ar[ul]\\&y\ar[ur]\ar[ul]&} \xymatrix@=8pt@C=0pt{&u&\\w\ar[ur]& &v\ar[ul]\\&y\ar[ur]\ar[ul]&}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_25439474c427d320e18293db1cba619daf71fba8_p1.png)
![\xymatrix@=8pt@C=0pt{&u&\\w\ar[ur]& &v\ar[ul]\\x\ar[u]\ar[urr]& &y\ar[u]\ar[ull]} \xymatrix@=8pt@C=0pt{&u&\\w\ar[ur]& &v\ar[ul]\\x\ar[u]\ar[urr]& &y\ar[u]\ar[ull]}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_7b01c3fe8b640a8923afbc45c4934a4c22162fce_p1.png)
![\xymatrix@=8pt@C=0pt{u\\v\ar[u]\\y\ar[u]} \xymatrix@=8pt@C=0pt{u\\v\ar[u]\\y\ar[u]}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_125934be0b312ac1458973725430d07d8c977f5b_p1.png)
![\xymatrix@=8pt@C=0pt{&u\\&v\ar[u]\\x\ar[ur]&&y\ar[ul]} \xymatrix@=8pt@C=0pt{&u\\&v\ar[u]\\x\ar[ur]&&y\ar[ul]}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_b0f5b9539782469992e7ac35ab168c13e736f45c_p1.png)
![\xymatrix@=8pt@C=0pt{u^n\ar@(r,r)[d]\\y\ar[u]} \xymatrix@=8pt@C=0pt{u^n\ar@(r,r)[d]\\y\ar[u]}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_472bdd2cf31c2815fb873610c2de46522a98a065_p1.png)
![\xymatrix@=8pt@C=0pt{&u^n\ar@(r,r)[dr]\\x\ar[ur]&&y\ar[ul]} \xymatrix@=8pt@C=0pt{&u^n\ar@(r,r)[dr]\\x\ar[ur]&&y\ar[ul]}](/jwiki/Essays/Tacit%20Expressions?action=AttachFile&do=get&target=latex_0f57b181faef91f3557d244c986cd7c3be80b8f5_p1.png)