Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!boingo.med.jhu.edu!haven!ni.umd.edu!uc780.umd.edu!cs450a03 From: cs450a03@uc780.umd.edu Newsgroups: comp.lang.apl Subject: RE: J and nested vectors Message-ID: <22MAR91.00311616@uc780.umd.edu> Date: 22 Mar 91 00:31:16 GMT References: <27567@uflorida.cis.ufl.EDU> Sender: usenet@ni.umd.edu (USENET News System) Organization: The University of Maryland University College Lines: 34 Nntp-Posting-Host: uc780.umd.edu Since no responses have reached my site yet, I guess I'll field this one... Ken Block writes: >I am under the impression that J does not have nested vectors. >Is this true? Not really >How could I do something like the following apl: >x function foreach ((1 2 3) (5 6 7) (1 2 5) (2 3 4)) The function part might be written as f &. > if you wanted to deal with it as a nested array. Note that you could also convert that thing to a matrix, and use f " 1 with no loss in information or functionality. &. by the way means "use the function on the right as a pre-processor (and it's inverse as a post-processor) for the function on the left." The granularity is determined by the granularity of the "function on the right". So (f) would get evaluated once for the array 1 2 3, another time for the array 5 6 7, and so on. " means simply, apply the function (on the left) using on arrays of rank n (the number on the right). So you get a foreach type operation that's useful on regular arrays. To construct the nested array, you could write: 1 2 3; 5 6 7; 1 2 5; 2 3 4 Grab a copy of J and try it out. Personally, I prefer answering questions of people who are stuck than I do people who've never even gotten that far. Raul Rockwell