Explicit-to-tacit

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Primer

# Explicit-to-tacit translator

There is a primitive which automatically converts one-line explicit definitions to an equivalent tacit definition. You can learn a lot about tacit programming by writing one line explicit definitions, converting them to tacit form, and studying the resulting tacit definition.

Let's do this with an explicit fahrenheit definition. A left argument of `3` to `:` creates an explicit definition. A left argument of `13` to `:` creates a tacit definition.

       fx =:  3 : '32 + y. * 9 % 5'	NB.  3 explicit
       ft =: 13 : '32 + y. * 9 % 5'	NB. 13 tacit

Use the View menu to select Linear Display.

       ft
    32"_ + ] * 1.8"_

At first glance this is confusing as it introduces several new things at once. The first thing to do is to look at the boxed display.

Use the View menu to select the Box Display.

       ft
    +--------------------------+
    ¦+------+¦+¦+-------------+¦
    ¦¦32¦"¦_¦¦ ¦¦]¦*¦+-------+¦¦
    ¦+------+¦ ¦¦ ¦ ¦¦1.8¦"¦_¦¦¦
    ¦        ¦ ¦¦ ¦ ¦+-------+¦¦
    ¦        ¦ ¦+-------------+¦
    +--------------------------+

At the top level of boxing there are 3 boxes. This is a train with three elements and is in fact a fork. You can take this thing apart by giving names to the parts and looking at them separately.

The first element of the fork is the phrase `32"_` . Give this a name and experiment with it a bit as a monadic verb.

       left =: 32"_
       left 123
    32

       left i.5
    32

Whatever you give left as an argument, it just returns `32`. You've seen the `"` conjunction before, but not with a constant left argument. Let's look this up in the J Dictionary. When you turn to the definition for rank you will notice that there are three pages of definitions, each with its own header. The three headings are:

    	Rank	m " n
    	Rank	u " n
    	Assign rank	m " v	u " v	mv lv rv

The different definitions are for the rank conjunction used with different types of arguments. In the headings `m` and `n` indicate noun arguments and `u` and `v` indicate verb arguments. Your earlier use of `"` involved a verb left argument and a noun right argument and is covered by the second definition. Both `32` and `_` (infinity) are nouns so it is the first definition that is relevant.

Reading the definition for `m " n` makes it clear that the observations are correct. With a right rank of `_` , the derived verb applies to its entire right argument, and no matter what it is, it returns the left argument, which is `32`.

Let's look at the right element of the fork.

       right =: ] * 1.8"_
       right 23
    41.4

       right 10
    18

Let's not worry about the details of the definition, but again, by observation, what the verb right does is to multiply its argument by `1.8` (which is `9%5`).

The final definition is a fork.

       ff =: left + right
       ff 100
    212

       ff 0
    32

The result of the fork, `ff` , does work. Let's look in more detail at the definition of the fork.

    left + right	evaluates as	(left y) + (right y)
    		  32     + (1.8 * y)

Which is the Fahrenheit conversion!

Compare your custom built tacit definition with the automatically translated one and note how different they are.

    32&+@(1.8&*)
    	vs
    32"_ + ] * 1.8"_

Tacit programming is very rich and varied and is tightly tied to adverbs and conjunctions such as bond, atop, and rank, and to trains such as hook and fork.

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Primer