On Wed, Oct 24, 2012 at 10:24 PM, Linda Alvord <lindaalv...@verizon.net> wrote:
> You say below:
>
> "Anyways, I'm having a problem with "I was told that I was using  & 
> dyadically so it was compose." because & in =&{: is compose but not because & 
> was being used dyadically."
>
> Isn't   =&{: B  a case where  &  is compose, and the expression  =&{: is 
> applied monadically to  B ?

Yes, exactly -- this is a "compose" case for & which is applied monadically.

> I am also enjoying your recent attempt at writing a definition for  &

Thank you,

-- 
Raul

> Linda
>
> -----Original Message-----
> From: programming-boun...@forums.jsoftware.com 
> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul Miller
> Sent: Wednesday, October 24, 2012 3:23 PM
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] stitching matrices
>
> On Wed, Oct 24, 2012 at 3:27 AM, Linda Alvord <lindaalv...@verizon.net> wrote:
>> m&v y ↔ m v y    This is the definition of bond (monadic)
>>
>> u&v y ↔ u v y . This is the definition of compose (dyadic)
>>
>>
>> =&{:  is the definition which I used earlier as  =&{: B
>>
>> I was told that I was using  &  dyadically so it was compose.
>
> We need to be careful about using the word "it" in learning contexts.
> Also, J grammar is regular, so we need to be very careful when describing the 
> use of that grammar.
>
> In J, "dyad" refers to the combining definition (usually of a verb, since 
> verbs have two definitions), while "monad" refers to the non-combining 
> definition (usually of a verb...)
>
> Anyways, I'm having a problem with "I was told that I was using  & dyadically 
> so it was compose." because & in =&{: is compose but not because & was being 
> used dyadically.
>
> The & itself is used dyadically in =&{: and in 1&+ and in *&2 but only one of 
> those is compose.  And all three of those derived verbs have both monadic and 
> dyadic definitions.  Instead "compose" would be because both arguments to & 
> were verbs.  (Which was probably the intent of the "it was compose" sentence, 
> but the words were wrong for
> me.)
>
> It might be interesting to write a J conjunction which acts like &
>
> ampersand=:2 :0
>   NB. monad
>   select. #.*nc;:'u v'
>     case. 0 do. assert. 0 NB. invalid
>     case. 1 do. m v y  NB. left bond
>     case. 2 do. y u n  NB. right bond
>     case. 3 do. ([: u v)"v y NB. compose monad
>   end.
> :
>   NB. dyad (combining form)
>   select. #.*nc;:'u v'
>     case. 0 do. assert. 0 NB. invalid
>     case. 1 do. (m ampersand v)^:x y NB. left bond
>     case. 2 do. (u ampersand n)^:x y NB. right bond
>     case. 3 do. x (([: v [) u ([: v ]))"v y NB. compose dyad
>   end.
> )
>
> Note that I would need to introduce another level of abstraction if I wanted 
> an immediate syntactic warning for the invalid case.
>
> amp=:2 :0
>   select. #.*nc;:'u v'
>     case. 0 do. assert. 0 NB. invalid
>     case. 1;2;3 do. u ampersand v
>   end.
> )
>
> Note also that this implementation displays differently from the builtin (for 
> the cases where the resulting derived verb is not used to generate a result). 
>  But unless I have made an error these will function the same way the built 
> in works.
>
> I hope this helps,
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> 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