Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!utcsri!rpi!usc.edu!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!csus.edu!sfsuvax1.sfsu.edu!emclean
From: emclean@sfsuvax1.sfsu.edu (Emmett McLean)
Subject: Re: Selective assignment "It ain't so..."
Message-ID: <1993Feb3.034055.12287@csus.edu>
Sender: news@csus.edu
Organization: San Francisco State University
References: <1993Jan27.094037.13820@csus.edu> <1993Jan27.221845.11152@csi.jpl.nasa.gov> <1535@kepler1.rentec.com>
Date: Wed, 3 Feb 1993 03:40:55 GMT
Lines: 39

In article <1535@kepler1.rentec.com> andrew@rentec.com (Andrew Mullhaupt) writes:
>J forces a copy every time you need to modify an element of an aggregate?
>This is pretty damaging to one's performance if this is true. 
>Say it ain't so, Joe...
>
  "It ain't so..." Or rather, if it is so, could someone explain it 
  to me, I think I demonstrate it is not (so) in the next few lines 
  from an interactive session.

   NB. load selectiveAssign
   0!:3 <'A.js'
   NB. spaced needed to create a table with 100 rows and
   NB. 100 columns with each entry equal to 1000 is :
   7!:2 'a =. 100 100 $ 1000'
40408
   NB. space used to use Emmett's selectiveAssign on a is :
   7!:2 'a =. a selectiveAssign (2 1 ; 1000)'
81848
   NB. space used to used to do Sam's selective assignment is:
   7!:2 'a =. 1000 (21) } a'
41048
 So when Sam writes :
>
>>Good idea. What I meant is that there is no way to change a part of an
>>existing structure, though you can make an ammended copy. I've heard
>>functional justifications for the restriction, but still miss
>>reassignment. I use it all the time in APL, for setting up arrays
>>with a given simple pattern and then changing parts for special cases.
>
  I think he means there is no way to change part of an existing
  structure using a verb whose syntax is like selectiveAssign
  (or like his wish verb thing) and not make a copy of the structure. 

  But as I demonstrated, using the indigenous ammend without boxing
  (as in Sam's and Raul's methods) does not require an additional copying.

  Suddenly I'm not so crazy about my verb selectiveAssign -:)

  Emmett, 
