Devon, this is exactly what I was hoping for! Catalogue (monadic {) is what
I was missing. Bravo!
I had seen catalogue but hadn't realized its usefulness for such a context
as this.

In JfC, Henry writes, under Modification in Place, "Profligacy with memory
bandwidth reaches an
extreme with dyad m} : even if y is huge and only one atom is modified, the
whole y must be copied
to produce the result.  Sometimes this can be a noticeable drag on
performance.  To help out in
those cases, the interpreter recognizes the specific forms

name =. x m} name
name =: x m} name
name =. name , x
name =: name , x

and executes the modification in place, i. e. without creating a new copy of
name .  For the
modification to be in-place, there must be nothing else in the sentence
either before or after the
form shown above, and the two appearances of name must be identical.  x and
m may be any
expressions that evaluate to nouns."

So the interpreter wouldn't recognize your occurrence as you have written
it?

And, Raul, you wrote "I think you are asking about } but, depending on what
you are really looking
for, you have more options." I was asking about }, but would be interested
in other ways. Devon's
is fine, but it's not as concise as I was used to in APL.

Many thanks to you both.

Graham 
 
On Fri, 26 Oct 2007 18:02:02 -0400 Devon McCormick wrote:
> 
> Graham,
> 
> since you supplied no example, I'm guessing at what you want.  Maybe
something like this?
> 
>    mat=. 10 10$0
>    ]mat=. (9+ix{mat) ix}mat [ ix=. {(2+i.4);(3+i.6)
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 9 9 9 9 9 9 0
> 0 0 0 9 9 9 9 9 9 0
> 0 0 0 9 9 9 9 9 9 0
> 0 0 0 9 9 9 9 9 9 0
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
>    ]mat=. (99+ix{mat) ix}mat [ ix=. {(1+i.7);(3+i.2)
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 99 99 0 0 0 0 0
> 0 0 0 108 108 9 9 9 9 0
> 0 0 0 108 108 9 9 9 9 0
> 0 0 0 108 108 9 9 9 9 0
> 0 0 0 108 108 9 9 9 9 0
> 0 0 0 99 99 0 0 0 0 0
> 0 0 0 99 99 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 
> Regards,
> 
> Devon
> 
> On 10/26/07, Graham Parkhouse <[EMAIL PROTECTED]> wrote:
> >
> > In APL by writing a loop containing
> >
> >       matrix[i1;12]+ <- submatrix
> >
> > I can build a matrix from a number of contributing submatrices. What 
> > is a neat equivalent phrase in J?
> >
> > Thanks in anticipation!
> >
> > Graham Parkhouse
> >
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> 
> 
> 
> -- 
> Devon McCormick, CFA
> ^me^ at acm.
> org is my
> preferred e-mail
> 
> 
> ------------------------------


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to