adverbs can return nouns, though most are designed to return a verb. 1 : 'm + y' NB. a verb because it accesses y 1 : 'u 2' NB. returns a noun because it doesn't access y even though it uses a verb as adverb parameter
Consider this noun producing adverb, A_z_ =: 1 : 'a =: u a' its defined in z, just for convenience. It applies its verb parameter to a and stores the result in a. The value of a it will use is whatever locale it is qualified with. a=.1 a_b_ =: 3 +: A 2 +: A_b_ 6 a_b_ 6 a&+ A_b_ NB. the a parameter is taken from caller's locale as u is parsed before it is passed to A_b_ 8 a_b_ =: i.5 a&(0}) A_b_ NB. sending parameters to amend in place 2 1 2 3 4 OOP approach often involves creating side effects in class instances. Noun returning adverbs can access all instance variables (or other program data), and make any side effects it wants. For instance, it can save or backup data to disk in the last amend example. The neat part is that with class defined adverbs, you can send verb messages to your objects. Even though they are verbs, they can be bound with many caller supplied nouns (such as the 2 parameters to }), and in a tacit expression caller variables get fixed into the supplied verb. Its also neat, because many other uses of adverbs in objects are unintuitively problematic in their parsing. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
