The key is the rank of the verb. That is given in the Dictionary.
x + y fails, and x , y works, in the cases you give, because
+ has rank 0 while , has rank _ .
The verb itself is applied to operand cells, which are the highest-rank
pieces the interpreter can find whose rank does not exceed the verb rank.
What the verb does on those cells is completely up to the verb and
you can't model it generally.
What can be modeled generally is what happens when the operands
have rank higher than the rank of the verb. In that case, the
operands are broken into cells, the verb is applied on each cell,
and the results are padded with framing fills to produce an array.
In your example, the verb dyad , has infinite rank so nothing general
can be said. You have to follow the description of the verb which,
as you noted, has its quirks.
Dyad {. is a similar example. What it does for overtake has to
be modeled as the idiosyncratic behavior of that verb.
So, the 'hooks' you refer to appear when the verb is applied to its
cells. The rank of the cells is specified by the rank of the verb.
Henry Rich
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of metaperl.j
> Sent: Sunday, November 25, 2007 4:55 PM
> To: [email protected]
> Subject: [Jgeneral] J for C - generic dyad application versus
> verb specific
>
>
> At:
> http://www.jsoftware.com/help/jforc/loopless_code_i_verbs_have
> _r.htm#_Toc141157992
>
> We see Henry discuss how dyadic + works. One key requirement
> for dyadic + in
> all cases is that there must be a common frame. Hence, the
> following is an
> error:
>
> ( i. 2 2 ) + (i. 3 3 )
> |length error
>
> However, in:
> http://www.jsoftware.com/help/jforc/loopless_code_i_verbs_have
> _r.htm#_Toc141157993
>
> Henry demonstrates:
>
> ( i. 2 2 ) , (i. 3 3 )
> 0 1 0
> 2 3 0
> 0 1 2
> 3 4 5
> 6 7 8
>
> and obviously the requirement for common prefix is not met.
>
> So the question becomes: what is the general algorithm for dyadic verb
> application? Which verb, "+" or "," is closer to the general
> algorithm? How
> and where are "hooks" inserted into this algorithm so that
> the algorithm can
> be "jettisoned" in favor of behavior peculiar to a particular verb?
>
> Just FYI, the algorithm for dyadic "+" (which I thought was
> the general
> dyadic application algorithm) is coded starting on line 112 here -
> http://hg.metaperl.com/redick?f=8d2f0d91211b;file=scheme/dyads
> /dyad-apply.scm;style=gitweb
>
> ... it works for all examples in J for C. But obviously it
> blows up when
> dyadic "," is passed to it. So the goal is to make changes to get both
> working and a generic dyadic application algorithm with
> proper callouts to
> respect certain verb peculiarities.
>
> --
> View this message in context:
> http://www.nabble.com/J-for-C---generic-dyad-application-versu
> s-verb-specific-tf4871837s24193.html#a13940484
> Sent from the J General mailing list archive at Nabble.com.
>
> ----------------------------------------------------------------------
> For information about J forums see
> http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm