If your non empty items are sorted, as in mylist, than you could use

   max=:[:{.\:~

   max 'a';''
+-+
|a|
+-+

   (max@,)/\ mylist
+-+-+-+--+--+---+---+---+---+
|a|a|a|bb|bb|ccc|ccc|ccc|ccc|
+-+-+-+--+--+---+---+---+---+


R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:programming-
> [EMAIL PROTECTED] Namens R.E. Boss
> Verzonden: dinsdag 5 februari 2008 12:18
> Aan: 'Programming forum'
> Onderwerp: RE: [Jprogramming] populating a list of boxed strings
> 
>    [EMAIL PROTECTED](a:-:])/\ mylist
> +-+-+-+--+--+---+---+---+---+
> |a|a|a|bb|bb|ccc|ccc|ccc|ccc|
> +-+-+-+--+--+---+---+---+---+
> 
> 
> R.E. Boss
> 
> > -----Oorspronkelijk bericht-----
> > Van: [EMAIL PROTECTED] [mailto:programming-
> > [EMAIL PROTECTED] Namens [EMAIL PROTECTED]
> > Verzonden: dinsdag 5 februari 2008 12:03
> > Aan: [email protected]
> > Onderwerp: [Jprogramming] populating a list of boxed strings
> >
> > 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
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to