On Tue, May 29, 2012 at 12:18 AM, Arthur Anger <[email protected]> wrote:
> 3. Dictionary sections on Monad-Dyad use are terribly brief.  Discussions of
> adverb and conjunction definition processes are longer in JLearn and JfC, and
> somewhat complement each other, but still leave me somewhat confused.  Are
> there yet other elaborations available?

Have you read the dictionary itself?  It might be time to review the
dictionary:  http://www.jsoftware.com/help/dictionary/contents.htm

Briefly, however:

The monadic definition of a verb is used when you give the verb a
single argument (which appears on the right of the verb).

The dyadic definition of a verb is used when you give the verb two
arguments (the second argument appears on the left of the verb).

In all cases verb results are nouns.

And, of course, nouns can be arbitrary dimensioned arrays.

Adverbs and conjunctions are more complicated.  An adverb can take one
argument which can be a noun or a verb, while a conjunction can take
two arguments which can be nouns or verbs.  And it's up to you what
kind of result they can produce -- their result can be a noun, a verb
(meaning you are providing monadic and dyadic verb definitions --
though those can be empty), a new adverb or a new conjunction.  So
there are 8 kinds of adverbs, just considering argument and result
types, and 16 kinds of conjunctions based on argument and result
types.  In theory, you can define an adverb or conjunction which
treats all of these cases but in practice you almost always want a
specific single case.

Furthermore, in explicit definitions, there are rules for what the
argument names represent which vary depending on the complete set of
names which are used in that definition, but do not vary between
adverbs and conjunctions.

m: left noun argument to adverb or conjunction (undefined if verb given)
n: right noun argument to conjunction (undefined in adverb)

u: left noun or verb argument to adverb or conjunction
v: right noun or verb argument to adverb or conjunction

x: left argument to verb unless no m, n, u, v are present (then replaces u)
y: right argument to verb unless no m, n, u, v are present (then replaces v)

Note that letters which appear in strings or in comments do not count.
 Letters which appear in unreachable code do count.

Note that I am just repeating here statements which are provided in
the dictionary, mostly in the appendix on grammar (and the vocabulary
page for explicit definition:
http://www.jsoftware.com/help/dictionary/d310n.htm).  My organization
is different (and reflects what I think might be confusing based on
the points you raised).

Here's more details on the special words which are only available in
explicit definitions:
http://www.jsoftware.com/help/dictionary/ctrl.htm

You may also want to study J's expression parsing rules (which apply
everywhere):
http://www.jsoftware.com/help/dictionary/dicte.htm

Note that there's also a trace facility, to illustrate those parsing rules:

   require 'trace'
   trace '+/1 2 3'
(this example produces 10 lines of output).

Note that the current implementation of trace uses its own locale and
is not aware of what locale you are calling it from.  If you want to
be using pre-defined names in trace, you should use the result of
cofullname in your expressions.

   add=: +
   cofullname 'add'
add_base_

I do not know where to find documentation on the trace facility which
could be used to replace my description here.

I hope this helps,

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

Reply via email to