Don, Your conversion of my tacit expression to S seems OK. However, since I have no way to execute the tacit S expression, it is difficult for me to say whether it would produce the same results as the original tacit J expression.
The true proof of the pudding would be for you to develop a simple tacit S interpreter, to see what issues you get into. Your rules for converting from J tacit to S tacit seem fairly straightforward. You should be able to write a J program that takes an S tacit expression, converts it into a J tacit expression, executes the J expression, and returns the result. If you can do this, then we can explore the S syntax much more thoroughly. If your interpreter would also print out the interim J tacit version of the S expression, then we would have an excellent vehicle for discussing the finer points of S tacit syntax vs. J tacit. Skip Cave Don Watson wrote: > Hi Skip, > > I will indeed do as you suggest. It's a good idea and I totally agree > that it is up to me to convince everyone. > > In the meantime, you gave me the following example to convert. I have > done my best. If I have not made a mistake with my lack of J experience, I > would be surprised. You said: > > >> 3 (<:@[ <.[ <.@(] * [ % [: >./ ]) (- <./)@]) i. 21 >> 0 0 0 0 0 0 0 1 1 1 1 1 1 1 2 2 2 2 2 2 2 >> > > >> How would S simplify this tacit expression? >> > > Here we go, starting from your expression: > > 3 ( <:@[ <.[ <.@(] * [ % [: >./ ]) (- <./)@]) i. 21 29 > > Let's replace all "]" and "[" by y and x for the moment and take away the > arguments. > > ( <:@x <.x <.@(y * x % [: >./ y) (- <./)@y) > > The parenthesis of the fork aren't needed, nor is the "@:" to the right of > it. > > ( <:@x <.x <.@(y * x % [: >./ y) - <./y) > > The cap isn't needed since verbs are monadic if they have a verb to their > left in a right to left system. > > ( <:@x <.x <.@(y * x % >./ y) - <./y) > > The next "@" is acting as a parenthesis that makes certain that the "x<." is > used before the subtraction, so we can replace it with parentheses. > > ( <:@x <.(x <.(y * x % >./ y)) - <./y) > > The last "@" symbol is also acting as a parenthesis to ensure that the > monadic verb "<:" acts on x before it is input to the dyadic verb on its > right, so that we can parenthesize it and remove the "<@" > > ( (<:x) <.(x <.(y * x % >./ y)) - <./y) > > Thus this must be the equivalent explicit expression. To turn it into > revised tacit form, replace all "x"s with "[" and all "y"s with "]". Now we > have converted current tacit form to a revised tacit form we can put the > arguments back. > > 3 ( (<:[) <.([ <.(] * [ % >./ ])) - <./]) i. 21 > > Right to left tends to generate more parentheses - but it is much easier to > convert to tacit form and once you understand right to left, that's the only > rule you have to learn, apart from replacing x and y with [ and ] to turn > into tacit and vice versa to return. > > I expect you to find mistakes, but it's an attempt. > > Don > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
