Newsgroups:   comp.lang.apl
Path: utzoo!censor!geac!itcyyz!yrloc!intern
From:         loc@tmsoft.UUCP (Leigh Clayton)
Subject:      Indexed assignment in J
Message-ID: <1991Jan10.174836.27468@yrloc.ipsa.reuter.COM>
Sender: intern@yrloc.ipsa.reuter.COM (Intern via QUADRAM)
X-Telephone:  +1 (416) 364-5361 Fax +1 (416) 364-2910 Telex 0622259
Organization: Reuter:file Ltd.
X-Mail:       1900/2 First Canadian Place, Toronto, Canada, M5X 1E3
Date:         10 Jan 91 17:34:20 UT

 Another message from rbe@yrloc.ipsa.reuter.com (Bob Bernecky).

>no. 4831177 filed 17.02.55  thu 10 jan 1991
>from rbe@ipsa
>to   loc@ipsa
>cc   clapl
>subj merging in J
>
>@transferred from ipsa  no. 4665548 filed 17.02.52  thu 10 jan 1991
>
>One way to get the effect of x[i]?k in j is to use merge:
>
>x =. k i{x
>
>That is, merge the elements of k into positions i of x, and
>assign the resulting array back into x. It is essentially a
>functional form of indexed assignment, witut the side effect
>which is present in APL of destroying the original array.
>
>The justification for making catenate work along the first axis
>is that you only then need one functional form, comma, rather than
>comma, comma-bar, and comma with bracket axis operator. The use
>of rank reduces the number of primitives needed, simplifies the
>teaching and use of the language, and unifies the treatment of
>operations along other axes, by use of the rank adverb.
>
>Generally:
>
>APL           J
>
>x,y           x,"1 y
>x?y           x,y
>x,[k]y        x,"k y
>
>where k is origin 0.
>
>There is another way to do the merge, but I can't seem to make it work
>in my version of J. Bob
>

-----------------------------------------------------------
- Men argue, Nature acts                       /Voltaire  -
-----------------------------------------------------------
loc@tmsoft.UUCP   (Leigh Clayton)   uunet!mnetor!tmsoft!loc
