On Thu, Jun 4, 2009 at 1:25 PM, Don Watson <[email protected]> wrote: > position on this. However, hasn't the right to left grammar also > been implemented in interactive J?
If I understand how you are using these words, the "right to left grammar in J" and the "hook/fork grammar in J" are the same grammar. 10 + (+/ % #) i. 3 11 ((i.3) +/ >:) i. 5 1 2 3 4 5 2 3 4 5 6 3 4 5 6 7 But I would use different words for describing these concepts. Where you use the phrase "right to left grammar", I think I would use "noun phrase". Likewise, in place of "hook/fork grammar", I think I would use "verb phrase". Now, clearly, verbs may be used in noun phrases. For example, 1 + 1 produces a noun, even though it uses a verb. Likewise, nouns may be used in verb phrases. 2 ! >: produces a verb, even though it uses a noun. > "Second, fork/hook grammar is right-to-left. For example, > f g h i j > is equivalent to > f g (h i j)" > > Well, it is and it isn't right to left. (f g (h i j)) and (f g h i j) > are a different grammar from f g (h i j). I do not know what you mean by a different grammar, here. However, when I type the following expressions into J (f g (h i j)) (f g h i j) f g (h i j) I get the same thing from all of them. > I suspect, though, that we have no disagreement here. Maybe > my term "right-to-left" isn't a good one, but I am sure we agree > on what I mean Well.. I am comfortable with using the term "noun phrase". If you could confirm that you are comfortable with this term, then I think we agree. > That would really help, because in the examples I see in > the documentation, the fork grammar is more of a handicap > than help. There is a continual need for "@ or "@:" to act > in lieu of parentheses.I really need to see multiple > applications of the fork in one sentence or expression. Ok, for example http://www.jsoftware.com/jwiki/System/Requests/Quaternions contains the definition inv=: conj % ip~ Here, conj is a verb, and ip~ is a verb (ip is also a verb). This definition says that the inverse of a quaternion is its conjugate divided by the product of the quaternion with itself. In explicit form, this could be rephrased INV=: verb define (conj y) % y ip y ) Likewise, the definition of mul, on the same page, is a hook whose right tine is a fork. If we wanted to define either of these in a purely right-to-left fashion, using only monadic functions, we would run into problems, wouldn't we? > My position is that I would like to see the capability for > both fork/hook grammar and what I mean by right-to left > grammar to have a tacit form. I suspect the following, that: I feel I am unclear on your goals, because from my point of view you have expressed a contradiction. > 1) In some situations, fork/hook tacit J is the only answer. I would not go that far -- forks and hooks are concise, but can be replaced by explicit verb definitions. > 2) In other situations, the best answer is to use fork/hook > tacit for some of the work and right-to left tacit for > the rest. Well.. "right to left tacit" seems to me to be a bit ambiguous. Tacit typically involves verb phrases, and we have several existing verb phrase mechanism in J but they all involve some punctuation. In the past, you have proposed different punctionation be used. And, of course, there's a whole "noun phrase" realm which we might consider. So I am not sure if we are discussing some proposal for different punctuation, if we are discussing verb phrases as they currently exist in J, or if we are discussing noun phrases. > 3) Many beginners would be better using right-to-left tacit > first - while there will be others who will want to go > straight to forks and hooks. Er... really? Personally, I think people do best when they think in terms of data, rather than in terms of code. > Anyway, thanks for your help. I look forward to seeing > your examples. Hypothetically speaking, we can find you other examples. But since you do not really disagree with the premise that forks (and hooks) can be useful, I am not really sure what you need examples of. -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
