> On 3 May 2014 14:22, Alex Giannakopoulos <[email protected]> wrote:
>> OK, but can't see which part of the docs clarifies that.

Alex, the dictionary link that R.E. Boss shared,
http://www.jsoftware.com/help/dictionary/d630n.htm, concisely
documents that behavior. I agree it's somewhat confusing.

It's also covered in the new vocabulary more explicitly:
http://www.jsoftware.com/jwiki/Vocabulary/ampm

One of the keys to understanding this is being able to recognize what
x,m,v,u,y are. It probably belongs on the NewVoc glossary page,
http://www.jsoftware.com/jwiki/Vocabulary/AbsolutelyEssentialTerms

One of the better descriptions of x,m,v,u,y,etc I've seen can be found
in the J Brief Reference: http://www.jsoftware.com/books/pdf/brief.pdf

"Noun arguments to adverbs and conjunctions may be specified by m on
the left and n on the right. Verb
arguments are u and v and the derived functions use x and y to denote
their arguments."

x,y = arguments
u,v = verbs
m,n = nouns

Reading the bond dictionary page again, we see the dyadic definition is:

x m&v y ↔ m&v^:x y
x u&n y ↔ u&n^:x y

Looking at the sin definition:
sin=: 1&o.

m is 1
v is o.

That would fall under the first case, x m&v y ↔ m&v^:x y

Substituting in, we see that:

 (4 sin 1) -: ((1&o.^:4) 1)
1

Here's another way to spot the difference:

Let's start by looking a the difference between m&v and u&n

NB. m v y <->
(3&^) 2 NB.  3^2, m&v, square 3
9

] m v y [ (m =. 3) [ (v=. ^) [ (y =. 2)
9

NB. y u n
(^&3) 2 NB. 2^3, u&n, cube 2
8

] y u n [ (y =. 2) [ (u=. ^) [ (n =. 3)
8


Now applying it dyadically:

2 (3&^) 1 NB. m&v 1
27

((3&^)^:2) 1
27

3^3^1
27

NB. execute m v twice
] (m v (m v y)) [ (m =. 3) [ (v=. ^) [ (y =. 1)
27


2 (^&3) 1 NB. u&n, cube
1

((^&3)^:2) 1
1

NB. execute y u twice
] (y u (y u n)) [ (y =. 1) [ (u=. ^) [ (n =. 3)
1

I find the letters m,n,u,v,y,x confusing. My best mnemonic is:

I can remember n = noun. The letter before it (m) is also a noun
I can remember v = verb. The letter before if (v) is also a verb
I can remember y = is the last argument. The letter before it is x (left side)

Hope this helps
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to