Index   <<   >>

Variations on a theme by comma

In APL the comma is buttressed by appendages, an integer or real number encased in brackets, to convey the ideas of adjoinging along a certain axis, or laminating a new axis after an old one. In default, mere dyad comma signifies adjoining along a trailing axis.

In J these ideas are separated. Dyad comma still signifies adjoining along a terminal axis, but this is now the leading, and not the trailing axis, and in fact the definition of dyad comma is to append items. J’s two new primitive dyads append (x ,. y) and laminate (x ,: y) help to clarify this situation.

   a=.4 4$'readbonywakeruth'
   b=.'beat'
   c=.'cal'

   a,b
read
bony
wake
ruth
beat
   b,.a
bread
ebony
awake
truth
   b,:c
beat
cal 

The forms ,/ and ,./ provide useful results.

   z
 abcde
 fghij

 klmno
 pqrst

 uvwxy
 z0123

   ,/z
 abcde
 fghij
 klmno
 pqrst
 uvwxy
 z0123

   ,./z
 abcde klmno uvwxy
 fghij pqrst z0123

   $z  NB. note leading blank in each row
3 2 6