I'm a J beginner with the following (little) problem:
I have a list of boxed strings, and many of them are empty; for example:

   ] mylist=. 'a';'';'';'bb';'';'ccc';'';'';''
+-+++--++---++++
|a|||bb||ccc||||
+-+++--++---++++

I'm looking for verb that fills empty boxes with the content of the previous 
box. My actual solution is:

   (4 : 'if. a:-:y do. x else. y end.') /\ mylist
+-+-+-+--+--+---+---+---+---+
|a|a|a|bb|bb|ccc|ccc|ccc|ccc|
+-+-+-+--+--+---+---+---+---+

which is what I want, but I think there is something simpler, avoiding use of 
"if".

Regards,
Lorenzo
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to