Simplify, simplify
The compiler (13 :) that produces the tacit form (] , ]) $ ({.&1@(1&+@])) uses simple rules to translate into tacit form, and the forms produced are not highly optimized. It may be useful to see how such a form may be further simplified. The main verb in the form is $ , and this admits of no simplification. The verb to its left, ],] suggests that the adverb ~ , defined by f~y is y f y , may be used to advantage. We can replaced ],] by ,~ . In the verb on the right, {.&1@(1&+@]) , the phrase 1&+@] adds 1 to its argument, and J provides the increment primitive (>:) to do the same thing. The phrase {.&1 , meaning “take 1” suggests that we might replace the adverb &1 by the verb 1: , which is a verb whose value is always 1 . We can permute the terms so that it reads >: {. 1: , which is a fork whose left verb adds 1 to the argument, whose right verb yields 1 always, so that overall it produces the desired overtake of 1 (>: {. 1:) 4 1 0 0 0 0 We may now write the complete verb in the simpler form IMS =. ,~ $ >: {. 1: IMS 2 1 0 0 1 100 time 'IMS 100' 0.00483333 and this, though prettier, is not significantly faster than IMT . |