On Wed, Sep 10, 2008 at 6:10 PM, Ian Gorse <[EMAIL PROTECTED]> wrote: > (y*2)+20 > or > (y*9)-28 > > I am just trying to understand tacit verbs more, and I set myself > little algorithms to experiment in J. > I am just trying to understand the individual steps required to make a > tacit verb out of such simple calculations.
My first step usually involves constructing an executable example of the phrase I want to work with, and some representative data. 3 :'(y*2)+20' 2 3 5 7 24 26 30 34 Then, as I modify the expression, I can test my work and find when I make mistakes. ((y*2)+20) 2 3 5 7 |value error: y ((]*2)+20) 2 3 5 7 |syntax error Also, one pattern that works fairly frequently is to re-arrange things so that my constant appears on the left of a dyad and a verb appears on its right. In this case both of your original verbs were commutative but if they were not, I could have used ~ to commute my arguments (20 + (2 * ])) 2 3 5 7 24 26 30 34 Also, note that I like to get rid of redundant parenthesis (20 + 2 * ]) 2 3 5 7 24 26 30 34 There is not much more that can be done with direct simplification, here. However, another useful approach involves inspecting the dictionary and seeing if it has something that is relevant to the problem I am trying to solve. And, in this case 20 2 p. 2 3 5 7 24 26 30 34 You can't get much simpler than that. -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
