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
> 1
>
> (10;1;2;3;50;3;2) -: data (a:={.)`]}@:(,: <"0) fill
> 1
>
And I like the selection vector approach: sv {"_1 x,.y .
(10;1;2;3;50;3;2)-:(data=a:) {"_1 data,.<"0 fill
1
(10;1;2;3;50;3;2)-:data ((a:=[) {"_1 (,.<"0)) fill
1
Best wishes,
John
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm