I find Viktor’s question hard to answer.  We can model, if I am not mistaken, 
the expected behavior of m...@.v explicitly as:

Ag2=. 2 : 0
  m...@.(v y) y
:
  x m...@.(x v y) y
)

In my experience this kind of explicit definitions are the most difficult to 
code tacitly.  I also think  that it is possible to write tacitly and adverb 
Ag2 so that (m`v) Ag2 would be equivalent to the expected m...@.v but it would 
not be straightforward (generating within its own atomic representation).  What 
I do not know, is how to construct conjunctions tacitly; so, I will be awaiting 
to see what Dan might have up his sleeve.




________________________________
From: Dan Bron <j...@bron.us>
To: Programming forum <programming@jsoftware.com>
Sent: Sat, November 21, 2009 3:02:07 PM
Subject: Re: [Jprogramming] Wrong agenda?

>  The problem: is there any way (i.e tacit/implicit) to model the dyadic
>  case of the expected m...@.v ?  

There is a way to model the entire desired behavior of agenda, for both
derived monads and derived dyads.  To wit:

    agenda  =: conjunction define
        if. verb = nc{.;:'v' do.
            m...@.(  v y) y 
        else. 
            m...@.n 
        end.
    :
        if. verb = nc{.;:'v' do.
            x m...@.(x v y) y
        else. 
            m...@.n
        end.
    )

or, perhaps with more fidelity,

    agenda2  =: conjunction define
        if. verb = nc{.;:'v' do.  
            fp =. adverb def ' ''('' , '')'' ,~ 5!:6{.;: ''u'' 'NB.  Fully
parenthesize
            txtV    =.  v fp                                  NB.  Selection 
verb
as text
            txtM    =.  m fp                                  NB.  Gerund as 
text
            txtMonad =.  '  ', txtM , '@.(  ', txtV ,' y) y '  NB.  Monad as 
text
            txtDyad  =.  ' x ', txtM , '@.(x ', txtV ,' y) y '  NB.  Dyad as 
text
            3 : (  txtMonad ; ':' ; txtDyad )  
        else. 
            m...@.n 
        end.
    )

.  

Of course, this is explicit, and you asked for tacit/implicit.  Now, in old
versions of J there were specific, supported rules for deriving a
conjunction tacitly.  Those rules were removed in J5.  However, I recently
(relativly speaking) discovered that there might be a different path to
this goal (defining tacit conjunctions).  But I'm still not certain of it.

What I am certain of, is that it's possible to tacitly define adverb,
which, given an argument, itself derives another adverb, which, given an
argument derives the "end target" (be that a verb, noun, or even another
adverb, ad infinitum).  This allows us to tacitly define an adverb that is
functionally equivalent to a conjunction; it takes two arguments to
produce a verb (or whatever), which operates as usual.  

Of course, with this type of entity, both arguments to the "conjunction"
would appear on the left (seriatim), as opposed to a true conjunction,
which has one argument on the left and another on the right.  But
depending on your needs, that may be a minor syntactic issue. 

I have some ideas of how we might use this pattern to define a tacit agenda
with the desired properties; but the fact that all 3 or 4 arguments
(gerund, selection verb, and argument(s) to the derived verb) are required
simultaneously might present a hurdle.

However, if you're interested, I could give you some pointers.

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

Reply via email to