Common Uses

Default x

One-liner

   v=: 4 : 'x+y'
   v
4 : 'x+y'
   (1&$:) : v
1&$: :v
   (1&$:) : v f.
1&$: :(4 : 'x+y')

Multi-liner

   w=: 4 : 0
  a=. y
  x+a
)

   (1&$:) : w f.
1&$: :(4 : 0)
  a=. y
  x+a
)

Attaching Rank

Separate and common monad/dyad ranks

   ((1&$:)"1) : (w"0) f.  NB. both ranks
1&$:"1 :(4 : 0"0)
  a=. y
  x+a
)

Common rank and separate rank

   w1=: (1&$:) : w"0 f.
   w1
1&$: :(4 : 0)"0
  a=. y
  x+a
)
   w2=: (1&$:) : (w"0) f.
   w2
1&$: :(4 : 0"0)
  a=. y
  x+a
)
   w1 b.0
0 0 0
   w2 b.0
_ 0 0

Attaching Other Conjunctions

Explicit conjunction provides just an ordinary J expression, which can be combined with other conjunctions and trains

Attaching each

   u=. 3 : 'y+1'&.>
   u i.3
+-+-+-+
|1|2|3|
+-+-+-+

Uncommon Uses

Double Explicit

   z2=: 3 : 0"0 : (4 : 0"0)
a=.y
x+y
)
a=.y
y+1
)
   z2
3 : 0"0 :(4 : 0"0)
a=.y
x+y
)
a=.y
y+1
)

Simultaneous Assignment

Compound declaration can be used in many cases, such as simultaneous assignment

   '`a b c'=: (4 :0)`(4 :0)`(4 :0)
x+y
)
x-y
)
x*y
)
   a
4 : 'x*y'
   b
4 : 'x-y'
   c
4 : 'x+y'

See Also

OlegKobchenko/Explicit Definitions (last edited 2010-08-14 03:40:19 by AndrewNikitin)