> From: Matthew Brand
> 
> By the way, the problem for me arises because of the way I am appending
> data in a loop. Is there a better way to do this rather than , ,:  
> followed by }. at the end?
> 
>    $ example ''
> 1 2 3
>    example =: 3 : 0
> output =. ''
> for_i. i. y do.
> output =. output , ,: i. 2 3
> end.
> }. output
> )
> 
>    $ example 2 NB. what I want...
> 2 2 3
>    $ example 1 NB. Not what I want, I want 2 3
> 1 2 3

This is perhaps a bit nicer. Saves you dropping the first item each time, but 
still have to handle the special case where there is only one item.

   example =: 3 : 0
output =. 0 2 3$''
for_i. i. y do.
output =. output , i. 2 3
end.
{.^:(1 = #) output
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to