On Thu, Aug 13, 2009 at 7:49 AM, John
Randall<[email protected]> wrote:
> Dan Bron wrote:
>>> Suppose I have some data, and some default values to
>>> use in case there is no data:
>>> data =. a:,(1;2;3),a:,(3;2)
>>> fill =. 10 20 30 40 50 60 70
>>> The result I want is:
>>> 10;1;2;3;50;3;2
>>
>> I prefer the mask}data,:fill idiom:
>>
>> (10;1;2;3;50;3;2) -: (data=a:)}data ,: <"0 fill
...
>
> And I like the selection vector approach: sv {"_1 x,.y .
>
> (10;1;2;3;50;3;2)-:(data=a:) {"_1 data,.<"0 fill
...
And I prefer the arithmetic approach
(10;1;2;3;50;3;2) -: <"0 ({.&> data) + fill * data=a:
1
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm