Hi all,

Reading through Roger's essay on the key adverb
(http://www.jsoftware.com/jwiki/Essays/Key), I thought it might be
useful to add a demonstration of the f//./ usage (found, for example
in Eugene McDonnell's discussion in "At Work and Play in the Fields of
J", http://www.jsoftware.com/papers/eem/AWPFJ/10.htm)?

Recreating the data in the current example,

   y =. 6 5 9 2 4 9 0 7 0 4 6 8 3 8 1 2 8 0 0 2
   a =. 4.6 5.5 7.9 5.2 5.4 3.9 6 5.7 6 9.4 4.6 7.8 1.3 1.8 5.1 9.2 7.8 6 9 6.2

the following equivalences could be demonstrated,

   (~.y) ,: y +//. a
  6   5    9    2    4  0   7    8   3   1
9.2 5.5 11.8 20.6 14.8 27 5.7 17.4 1.3 5.1
   (~.y) ,: +//./ y,:a
  6   5    9    2    4  0   7    8   3   1
9.2 5.5 11.8 20.6 14.8 27 5.7 17.4 1.3 5.1

and perhaps broken down a little (without the nub of y lamination) to
show what's going on more clearly:

   y +//. a
9.2 5.5 11.8 20.6 14.8 27 5.7 17.4 1.3 5.1
   +//./ y,:a
9.2 5.5 11.8 20.6 14.8 27 5.7 17.4 1.3 5.1

It might also be worth pointing out that f//./ is handy when you have
a matrix rather than two vectors.

Best,
M
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to