On Thu, Sep 3, 2009 at 1:59 PM, Dan Bron<[email protected]> wrote:
> Raul wrote:
>>  Sadly, no.
>
> It'd be easier to design this adverb if you posted an example of how it'd
> be used, with inputs and outputs.

I thought I had:

pad=: adverb define
 adj1=: <.m%2
 adj2=: m-1
 (-@(adj2 + ]) {. (adj1 + ]) {. [) (#m) {. $
)

  5 5 pad i. 3 3
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 1 2 0 0
0 0 3 4 5 0 0
0 0 6 7 8 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0

But that just shows how I want the padding to
work, and does not actually implement a padded
operation.  So, here is a padded operation

padded=:conjunction define
  u;.n y
:
  x u;.n x pad y
)

Example use
   3 3 <padded _3 i.4 4

FYI,

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

Reply via email to