Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!cs.utexas.edu!sun-barr!ames!haven.umd.edu!socrates!socrates!rockwell
From: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Subject: Re: Selective assignment (was Re: J is NOT APL)
In-Reply-To: emclean@sfsuvax1.sfsu.edu's message of Fri, 29 Jan 1993 23:39:43 GMT
Message-ID: <ROCKWELL.93Feb1092820@socrates.umd.edu>
Sender: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Reply-To: moth@firefly.com
Organization: Traveller
References: <1993Jan26.184600.24394@csi.jpl.nasa.gov> <1993Jan27.094037.13820@csus.edu>
	<1993Jan27.221845.11152@csi.jpl.nasa.gov>
	<1993Jan29.233943.5662@csus.edu>
Date: Mon, 1 Feb 1993 14:28:20 GMT
Lines: 36

Sam Sirlin:
.  >   index=. ($@])#.[

Emmett McLean:
.   Lets look at two real cases :
.
.     x0 =. 100 
.     i0 =. 0 2
.     y0 =. i. 3 3
.     x0 (i0 index y0) } y0
.  0 1 100
.  3 4   5
.  6 7   8
...
.
.      And :
...
.     i1 =. 0 6
.     x0 (i1 index y0) } y0
.    0 1 2
.    3 4 5
.  100 7 8
.
.     For the example x0, i0, and y0 your method works nicely. Unfort-
.     unately, for the example of x0, i1, and y0 it also works nicely!

try
  index=. [ { i.@$@]

[Aside, I'm somewhat embarrassed to notice that my earlier posts on
this thread were somewhat out-of-touch with the current state of J.
I'd not read Emmett McLean's original post in the thread -- seeing a J
form I was not familiar with, I sent the thing to the printer for
later review.  Kindly ignore rash statements in earlier posts?  Tks.]

Raul
