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

# Order of execution - adverbs & conjunctions

Adverbs and conjunctions have higher precedence than verbs. This means that an adverb or conjunction is executed before a verb. Furthermore, the left argument of an adverb or conjunction is the entire verb phrase that precedes it. The exact rules for parsing and execution are given in section E of the J Dictionary.

For practical purposes, the following examples illustrate the rules.

       a =. i.2 3
       +/"1 - a
    _3 _12

Like all J sentences, the above sentence executes from right-to-left. Before the `+` can be parsed as being a dyad or a monad, the higher precedence `"` conjunction executes. The `"` conjunction takes the 1 as its right argument and the entire verb phrase to its left as its left argument. The verb phrase to the left is the adverb `/` which takes the `+` as its left argument. The following uses parentheses to make clear the order of execution that follows from the rules.

       ((+/)"1) (- a)

As mentioned earlier, simple examples with constants may require that you separate the constant that is the conjunction argument from the constant that is the argument of the derived verb.

       a (+"1) 1 2 3
       a +"1 (1 2 3)
       a +"1 [ 1 2 3

The last one uses the monad `[` (same) that is defined to just return its argument. This is a bit shorter and avoids the use of parentheses.

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