This results in e.g. (ignoring a better expression in J):
p1=. +/ x * xi{((>:{.xi)+#y){.y
as complicated as mine I think:
p1=. +/ x * xi{y,0$~+/ny<: xi
Raul Miller schreef:
> On Mon, Jan 5, 2009 at 8:29 AM, Aai <[email protected]> wrote:
>
>> Is there a better way for the filling zeros?
>>
>
> 7 {. 1 2 3
> 1 2 3 0 0 0 0
>
> Or, for a more complicated case:
>
> 1j2 1j3 1 # 4 5 6
> 4 0 0 5 0 0 0 6
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm