Author Message

Since the question of adverb creation has come up, let me solicit some
help
in understanding the general process. I apologize if my examples seem
artificial--they illustrate my conceptual problems, which are based on
real problems.

1.  Can / be modeled in J?

2.  How does one write the following adverb, A?
a.  For an atomic verb (a monadic verb having rank 0 or a dyadic verb
having rank 0 0), if either of the atoms the verb
is presented with is 1, the result is 10, otherwise
the result is the normal result of the verb.
b.  For non-atomic verbs, the result is the number of atoms
in the normal result of the verb.

Example:
+A i.3 -> 0 10 2
(1 + i.3) +A i.3 -> 10 10 5
(<\)A i.3 -> 3

a =. i. 2 3
b =. i. 2 3 4
a \$A b is */\$(a\$b) or 1440 because \$ has dyadic rank _ 1

Basically, I am trying to understand the following concepts in J adverb
creation:
1.    How does one modify the operand(s) to the verb ("preprocess the
operands). So far as I know this must be done tacitly, since x.
for an adverb is presumably the verb it is modifying. Can any
adverb be written tacitly  with respect to the verb operands?
2.    How does one modify the normal result of the verb ("postprocess the
results of the verb").
3.    How does one distinguish in the adverb whether the verb is being
used

Any help on understanding these concepts would be appreciated.

hf

Tue, 10 Mar 1998 03:00:00 GMT
Harry Felder:
:  1.  Can / be modeled in J?

yes.  I'm not going to do it in this post, however.

:  2.  How does one write the following adverb, A?
:      a.  For an atomic verb (a monadic verb having rank 0 or a dyadic verb
:          having rank 0 0), if either of the atoms the verb
:          is presented with is 1, the result is 10, otherwise
:          the result is the normal result of the verb.
:      b.  For non-atomic verbs, the result is the number of atoms
:          in the normal result of the verb.

Why would you want to?  This sounds incredibly arbitrary.  [In real
life, if presented with a problem like this, it's probably time to
review the overall goals of your project.]  Nevertheless, it is
possible.  I'd could write something like this:

A = 0 : 1
\$. =. \$. -. (0 = x. mr) # 3             NB. 0
\$. =. \$. -. (0 0 -: x. dr) # 5          NB. 1
v1 =. x. ex1a                           NB. 2
v1 =. x. ex1b                           NB. 3
v2 =. x. ex2a                           NB. 4
v2 =. x. ex2b                           NB. 5
v1 : v2                              NB. 6
)

mr =: ' {. x. hasrank' : 1      NB. monadic rank of verb
dr =: ' }. x. hasrank' : 1      NB. dyadic rank of verb

hasrank =: 0 : 1        NB. rank of verb
t =. - " x.

Quote:
> 2{ 5!:2 <'t'

)

CAUTION:

[1] I'm used to J release 1 version 7.  Release 2 has some superficial
incompatabilities that I think would prevent the above from working
there.

[2] I've not tested this -- the machine I'm posting from doesn't have
J on it at the moment.

:  Basically, I am trying to understand the following concepts in J adverb
:  creation:
:  1.  How does one modify the operand(s) to the verb ("preprocess the
:        operands). So far as I know this must be done tacitly, since
:        x.  for an adverb is presumably the verb it is modifying. Can
:        any adverb be written tacitly with respect to the verb
:        operands?

In general, use & for this.

:  2.  How does one modify the normal result of the verb ("postprocess
:        the results of the verb").

:  3.  How does one distinguish in the adverb whether the verb is being

In general, define both the monadic and dyadic case and join them
together with :

--
Raul

Thu, 12 Mar 1998 03:00:00 GMT

 Page 1 of 1 [ 2 post ]

Relevant Pages