Newsgroups: comp.lang.apl
Path: utzoo!utgpu!watserv1!watmath!ljdickey
From: ljdickey@watmath.waterloo.edu (L.J.Dickey)
Subject: Re: J and nested vectors
Message-ID: <1991Mar22.140620.3809@watmath.waterloo.edu>
Keywords: J
Organization: University of Waterloo
References: <27567@uflorida.cis.ufl.EDU>
Date: Fri, 22 Mar 1991 14:06:20 GMT
Lines: 71

In article <27567@uflorida.cis.ufl.EDU> krb@uflorida.cis.ufl.EDU (Ken Block) writes:
>I am under the impression that J does not have nested vectors.
>Is this true?

J has "boxed" vectors.  The idea is similar, but with box, (given by "<"),
scalars are not a special case, as with nested arrays.

Here is a session script:

   sum =. +/
   avg =. sum % #
   data =. 1 2 3; 5 6 7; 1 2 5; 2 3 4 5 6
   data
+-----+-----+-----+---------+
|1 2 3|5 6 7|1 2 5|2 3 4 5 6|
+-----+-----+-----+---------+
   sum &. > data
+-+--+-+--+
|6|18|8|20|
+-+--+-+--+
   avg &. > data
+-+-+-------+-+
|2|6|2.66667|4|
+-+-+-------+-+

   n234 =. 100 200 +/ 10 20 30 +/ 1 2 3 4
   n234
111 112 113 114
121 122 123 124
131 132 133 134

211 212 213 214
221 222 223 224
231 232 233 234


   sum n234
322 324 326 328
342 344 346 348
362 364 366 368
   avg n234
161 162 163 164
171 172 173 174
181 182 183 184


   sum "1 n234
450 490 530
850 890 930
   avg "1 n234
112.5 122.5 132.5
212.5 222.5 232.5


   sum "2 n234
363 366 369 372
663 666 669 672
   avg "2 n234
121 122 123 124
221 222 223 224


I hope this helps.

Lee Dickey

-- 
Prof L.J. Dickey, Faculty of Mathematics, U of Waterloo, Canada N2L 3G1
	Internet:	ljdickey@watmath.waterloo.edu
	UUCP:		ljdickey@watmath.UUCP	..!uunet!watmath!ljdickey
	X.400:		ljdickey@watmath.UWaterloo.ca
