NB: Take careful note of the terminology: modifiers take operands, verbs take arguments.
Grouping And Order Of Execution
sentence: 2 * %: @ + / @: *: 1 2 3 start-points of phrases: 2 * %: @ + / @: *: 1 2 3 | | | | parenthesized version: 2 * (((%: @ +)/)@:*:) 1 2 3 sentence: 2 * %: @ (+ /) @: *: 1 2 3 start-points of phrases: 2 * %: @ (+ /) @: *: 1 2 3 | | | | | parenthesized version: 2 * ((%: @ (+/))@:*:) 1 2 3
Modifier Execution: Creating The Derived Verb
Consider the sentence
+/ 1 2 3 6
Two executions were performed. First, the adverb / was executed, with its u set to +, to produce an anonymous derived verb. Then, the anonymous verb was executed on the noun argument 1 2 3 to produce the result 6.
Executing A Modifier Produces A Derived Verb
SumItems =: +/ SumItems 1 2 3 6
Strictly speaking, executing the sentence
SumItems 1 2 3
does not execute any modifiers. / was executed when SumItems was defined.
The derived verb is guaranteed to execute according to the definition of the modifier. For example, monadic +/ produces a derived verb that adds all the items of y. Many combinations of verbs and modifiers are recognized and implemented with customized derived verbs.
Displaying The Derived Verb
Executing The Derived Verb
The derived verb is executed like any other verb. It has a verb rank for each argument, which controls how the argument is split into cells. The rank of the derived verb is part of the description of a modifier. Sometimes the rank depends on the operands of the modifier.
When the derived verb is executed, the names u (and v, for a conjunction) are set with the values that were saved when the derived modifier was executed. If a u and v is a noun, the name m or n is also set. y (and x for a dyadic verb) are also set, and then the body of the derived verb is executed sentence by sentence.
NB. Adverb. u is applied to y and creates a Boolean list of elements to keep. NB. Result is the culled y usedtocull =: 1 : 0 (u y) # y ) NB. verb to cull numbers less than 0 cullminus =: >:&0 usedtocull cullminus _2 _1 0 1 2 0 1 2 >:&0 usedtocull _2 _1 0 1 2 0 1 2
Then usedtocull is given the left operand >:&0. This produces a derived verb, which contains the body of usedtocull, and the saved u value of >:&0.