Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!mach1!torn!cs.utexas.edu!sdd.hp.com!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!jato!csi!sam
From: sam@csi.jpl.nasa.gov (Sam Sirlin)
Subject: Re: reassigning rows
Message-ID: <1993Feb27.004420.7485@csi.jpl.nasa.gov>
Originator: sam@kalessin
Sender: usenet@csi.jpl.nasa.gov (Network Noise Transfer Service)
Nntp-Posting-Host: kalessin
Organization: Jet Propulsion Laboratory, Pasadena, CA
References:  <abalje47.730654189@uther>
Date: Sat, 27 Feb 1993 00:44:20 GMT
Lines: 24


In article <abalje47.730654189@uther>, abalje47@uther.calvin.edu (Alan Baljeu) writes:
|> A short while ago, there was a discussion about using amend to reassign
|> elements in the table. There was also some mention about doing the same with
|> rows, but I don't recall any verbs presented to do that.  Can anyone present
|> such a thing?

Start with a function like index that gets the right indexes for
ammend given the way you'd rather write them:
   index=. ($@])#.[
which I use like this:
   x (i&index y) } y
(x is the replacement, i the index array, y the given array).

You can make it more specific pretty easily. Here's a no-thinking way
to assign rows of a matrix:
   x ( (|: rowi,: i. 1}. $y)&index y) } y
(rowi now is the appropritate set of rows). This doesn't generalize to
higher order arrays though...

-- 
Sam Sirlin
Jet Propulsion Laboratory         sam@kalessin.jpl.nasa.gov

