Just in case you have overlooked the possibility:

   3 * = i.4
3 0 0 0
0 3 0 0
0 0 3 0
0 0 0 3

Or
   3(* =@i.)4
3 0 0 0
0 3 0 0
0 0 3 0
0 0 0 3

Thanks,

-- 
Raul


On Sat, Jun 29, 2019 at 11:38 PM Daniel Eklund <doekl...@gmail.com> wrote:
>
> Hey all,
>
> I am posting a long email as I am hoping to understand from the collective
> wisdom here.  Apologies if this was somewhere in the archives but I have
> not been able to find it.
>
> I’m trying to understand the subtleties in binding conjunctions via tacit
> forks (or anything tacit).  My fumbling has proved mildly
> counter-intuitive, and I’m hoping someone here can point me in the right
> direction and/or confirm my conclusions are directionally correct.
>
> Problem:  I want to create a verb that allows be to create an identity
> matrix filled with a numeral (filled-noun) like:
>
>  1 Myverb 4
>
> 1 0 0 0
>
> 0 1 0 0
>
> 0 0 1 0
>
> 0 0 0 1
>
> Or
>
> 2 Myverb 4
>
> 2 0 0 0
>
> 0 2 0 0
>
> 0 0 2 0
>
> 0 0 0 2
>
> I know there are many ways to do this and the point of the task is purely
> for me to experiment with tacit composition.
>
> I found, quite easily I could do
>
>    ({.&1) 5
>
> 1 0 0 0 0
>
> And therefore
>
>    4 4    $ ({.&1) 5
>
> 1 0 0 0
>
> 0 1 0 0
>
> 0 0 1 0
>
> 0 0 0 1
>
> Which leads me to
>
>    (2&#@:<:    $ {.&1) 5
>
> 1 0 0 0
>
> 0 1 0 0
>
> 0 0 1 0
>
> 0 0 0 1
>
> Using a monadic fork.
>
> But now I want to pass the bound noun to Take ( {. ) so that it’s not just
> hard-coded as a ‘1’ and thus need a dyadic fork.
>
> I stumbled into something that works but left me with questions (notice I
> had to switch sides for dimension and the filler-noun):
>
>    Myverb =:      2&#@:<:@:[ $     {.&]
>
>
>
>    5 Myverb 3   NB. The 5 is the shape of the square, and
>
>                         NB.     the ‘3’ is the filler (the opposite of what
> I wanted originally)
>
> 3 0 0 0
>
> 0 3 0 0
>
> 0 0 3 0
>
> 0 0 0 3
>
> The right-verb in the fork seems to be where I had a problem truly
> understanding.  Given that the above works, I thought that swapping the
> SameLeft verb and the SameRight verb _should_ give me the following that
> works
>
>       Myverb   =: 2&#@:<:@:[     $ {.&]
>
>       Myverb2 =:      2&#@:<:@:] $     {.&[ NB. Just swapping the ‘]’ and
> the ‘[‘
>
> But it gives me weird results.
>
>    3 Myverb2 5
>
> 5 0 0 5
>
> 0 0 5 0
>
> 0 5 0 0
>
> 5 0 0 5
>
> I think I was able to figure it out by realizing that in the phrase
>
>     {.&[
>
> The ‘leftness’ of the SameLeft verb binds overrides the syntactic
> suggestion that the input will be bound to the right, and thus
>
>    3  {.&[  5
>
> 5 0 0
>
> Gets reshaped into the matrix I did not want.  Given that, I can finally do:
>
>       Myverb3 =:      2&#@:<:@:] $     {.~&[
>
>    _1 Myverb3 5
>
> _1  0 0  0
>
>  0 _1  0 0
>
>  0  0 _1  0
>
>  0  0 0 _1
>
> By commuting the right verb in the fork.
>
> As I was concentrating just on the conjunction I got the following results,
> and think I understand, but would appreciate confirmation, a pat on the
> back, or further readings:
>
>     ({.&[)  5 NB.  Experiment (A)
>
> 5
>
>     ({.&])  5 NB.  Experiment (B)
>
> 5
>
>    3 ({.&])  5 NB. Experiment (C)
>
> 5 0 0
>
>    3 ({.&[)  5 NB. Experiment (D)
>
> 5 0 0
>
>    5 ({.&)          NB. Experiment (E)
>
> {.&5
>
>    ({.&) 5          NB. Experiment (F)
>
> |syntax error
>
>    5 (&{.)           NB. Experiment (G)
>
> 5&{.
>
>     (&{.)  5   NB. Experiment (H)
>
> |syntax error
>
>
> Summary:
>
> In experiment (A) the monadic application turns the SameLeft into Same
> which feeds its results (via compose) to Head and resolves to {. 5  and
> thus 5.
>
> In experiment (B) the same thing occurs except it is SameRight into Same.
>
> In experiment ( C) with a dyadic invocation, the SameRight’s ‘rightness’
> binds the 5 to the right side, and  3 is fed as the left argument to as it
> should.
>
> In experiment (D) with a dyadic invocation, the SameLeft’s ‘leftness’ binds
> the 3 to the left side of the argument (despite it looking like it is bound
> on the right -- it is helpful now to understand ampersand as ‘compose’ and
> not ‘bind) and the results are the same as experiment (C ).
>
> In experiment (E) the conjuctive fragment (no SameRight or SameLeft) has
> become an _adverb_ and thus seeks to the bind to the left -- and produces a
> verb with a noun bound to the right.  NB. I was really confused when I saw
> that this parsed.
>
> In experiment (F) I proved to myself that the fragment without the
> SameRight or SameLeft was just a naked adverb because I got a syntactic
> error as an adverb resolves to the left.
>
> In experiment (G) I moved the ampersand around on the fragment and saw that
> now the ampersand was ‘respecting’ the direction of binding (binding on the
> left instead of the right as in experiment (E)).  This also continued the
> evidence that the fragment was an adverb.
>
> Experiment (H) cemented my belief that either fragment   (&{.) or ({.&) are
> induced adverbs.
>
> Anyways, thank you for reading and I hope for some feedback.  In all of the
> above, I think experiment D crystalizes the source of my initial (and
> long-lasting) confusion, hopefully now resolved.
>
> Thank you
>
> Daniel Eklund
> ----------------------------------------------------------------------
> 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