fromx=: 1 : '(m,~]) {~ i...@#@] i. ['

   3 1 4 1 5 9 'X' fromx 'abcdef'
dbebfX

   3 1 4 1 5 9 (_1) fromx i.6 4
12 13 14 15
 4  5  6  7
16 17 18 19
 4  5  6  7
20 21 22 23
_1 _1 _1 _1

Handling of negative indices left as an exercise for the reader.



----- Original Message -----
From: "Alan K. Stebbens" <[email protected]>
Date: Thursday, September 3, 2009 7:50
Subject: Re: [Jchat] wishlist adverb: ignore indices
To: Chat forum <[email protected]>

> On Sep 3, 2009, at 3:34 AM, Raul Miller wrote:
> 
> > I often wish that I had an adverb which would let me index beyond
> > array boundaries (getting fill elements).  I expect that 
> this would
> > also work on verbs based on intervals (such as dyads using \ 
> and some
> > dyads using ;.), extending their boundaries in a reasonable fashion.
> 
> In most OO languages, it's possible to override the standard 
> indexing  
> to accomplish specific requirements as needed for a given matrix-
> like,  
> array-like or hash-like object, including defining a "fill" 
> attribute,  
> and indexing semantics.
> 
> What is the comparable J method for accomplishing this?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to