I am not quite sure what you mean by "when an adverb is applied to an adverb"
Once (a0 a1) is parsed it becomes an adverb. It is a new adverb and it is its own self contained object. Once we apply X to it, there is no more parsing to be done, there is only the result of applying the adverb to its argument. When an adverb happens to be a train what does this mean? In the current implementation it means apply the first adverb in the train then apply the result to the second adverb in the train. No one is quite sure what is meant by "when an adverb is applied to an adverb", that is the basis of the discussion. So far the 2 ideas are: it generates the train of the two adverbs or; it results in a syntax error (current meaning). Previous versions of J did neither.

In other words, here's five adverbs:

a0=: 0 (1 : '/')
a1=: \
a2=: 1 : '/'
a3=: a0 a1
a4=: a2 a1

The confusing thing, if I understand your thinking properly, is that
you expect 0 a4 to be reparsed as a3. But, instead, 0 a4 gives you a
syntax error.
Not quite. I am not expecting a re-parsing, and as far as I can see it is not mentioned in the dictionary. Unless I am mis-understanding the parsing rules, once the adverb train is parsed it becomes a unit and there is simply the application of that unit to its argument. The meaning of that unit is sparsely discussed in the dictionary and is what is in question here. If the "application of an adverb to an adverb" makes you uneasy a way out would be to change the parsing rules so that the application of adverb trains are part of parsing and not built in to action "3 Adverb". But currently there is no "Train parsing rule" so I don't see where, in the specification of the language, this is required to be a syntax error.

A side effect of the proposed change (from syntax error) is that:

X (a0 a1) <==> (X a0) a1

in more cases now. That seems good to me. What are the downsides?

Meanwhile... error messages can help you find mistakes in your coding.
So, there's that.

Thanks,


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to