User Guide | Installation | Development | Categories | Git | Build Log
debug/tte - Tacit-to-explicit verb definition converter
Explicates a tacit verb u (the "explicand"). The result is the "explication" of u -- i.e. an explicit definition behaving like the original verb: u .
Each sentence computes an intermediate result from a phrase of (tacit) u -- usually a noun but sometimes a verb.
This is assigned to a pronoun (proverb) generated by verb: gensym .
Loading the addon creates a locale: 'tte' containing the code of the utility, plus a single adverb in the z-locale: tte_z_ .
Use the utility by applying the adverb: tte to the desired target tacit verb, just as you would use the primitive adverb: f. .
The locale: 'tte' also contains documentation, in the form of a noun: ABOUT_tte_
The result of applying tte_z_ to a verb v is another verb: vx .
Verb vx does not have a name unless you give it one by assignment. Normally you would only do this if you wanted assurance that v and vx behave the same. Then you can use both verbs in equivalent expressions.
In normal use you'd simply let J display the contents of (v tte), which is an explicit definition, with commented lines. The comments tell you what action tte has performed to generate each given line.
Typically the explication: vx is easier for a beginner to read and follow than the original target verb.
The definition of vx always has a monadic part and a dyadic part, separated by (:) as is the convention. But usually one or the other part is not relevant to your purpose.
However tte cannot tell which valency you want. Why not? Because, unlike an explicit verb, a tacit verb is in principle always monad/dyad, even if it is logical to call it only in one particular valency.
See the example below using: mean=: +/ % # -where logically only the monad returns a meaningful result.
The utility might indeed have been written to ask you whether you wanted the target verb explicated as a monad or dyad. But it is more straightforward to always deliver both monad and dyad parts and let you choose the one you want.
In the explication: vx the intermediate results by default are saved like this:
] s0=: # y
not like this:
s0=. # y
-the professional way to write an explicit definition.
This allows you to re-enter the lines of the explication in immediate mode with sample x and y values, and inspect the intermediate values of the algorithm, as well as retaining these values in the working namespace (usually _base_) after a sample run.
This behavior can be changed by assigning new values to COPULA_tte_ and PREVERB_tte_ (See vx for details)
The default behavior emphasises that tte is not meant for the composition of operational verb definitions, but to help a beginner understand how a given tacit verb works. To that end, algorithmic efficiency has been totally sacrificed.
To see a description of the addon:
require 'debug/tte' ABOUT_tte_
To apply it to a tacit verb, e.g. my_tacit_vb ...
1. Expose the target verb in a single line in the session log, either as a name or a (verb) value...
2. Type tte after the verb and press Enter...
my_tacit_vb tte 3 : 0 ... )
3. To verify that the original verb and its explication behave the same...
- give the explication a name, e.g. my_tacit_vb_explicated
- run both verbs with test arguments.
mean=: +/ % # NB. a sample "explicand" require 'debug/tte' mean tte 3 : 0 NB. +/ % # ] s0=: # y NB. simple: # ] t0=: +/ y NB. (main)h: ,'/' ] r0=: t0 % s0 NB. simple: % NB. fork: +/ % # : ] s0=: x # y NB. simple: # ] t0=: x +/ y NB. (main)h: ,'/' ] r0=: t0 % s0 NB. simple: % NB. fork: +/ % # ) mean_explicit =: mean tte mean 2 3 4 3 mean_explicit 2 3 4 3
Written by User:Ian Clark (2012)
based on: jsoftware.com/jwiki/Scripts/TacitToExplicit
from an original script (tte.ijs) by Zsban Ambrus.