IMO one should avoid the combination of @. and / Apart from that /\ is mostly a lot less efficient than /\.&.|. see JforC http://www.jsoftware.com/help/jforc/performance_measurement__tip.htm#_Toc141 158211 5 ts '[EMAIL PROTECTED](a:-:])/\ y'[y=:1e3$mylist 0.71863934 90880
5 ts '[EMAIL PROTECTED](a:-:[)/\. &.|. y' 0.0015836337 231040 ([EMAIL PROTECTED](a:-:[)/\. &.|. -:[EMAIL PROTECTED](a:-:])/\) y 1 But your solution is definitely faster and leaner. 5 ts '(a:&~: (#;[EMAIL PROTECTED] # #) ]) y' 0.0002314237 15808 ([EMAIL PROTECTED](a:-:[)/\. &.|. -:(a:&~: (#;[EMAIL PROTECTED] # #) ])) y 1 N.B. your second solution (a:&~: (#;.1@(1&,)@[ # a:,#) ])&.(a:&,) mylist ++-+-+-+--+--+---+---+---+---+ ||a|a|a|bb|bb|ccc|ccc|ccc|ccc| ++-+-+-+--+--+---+---+---+---+ R.E. Boss > -----Oorspronkelijk bericht----- > Van: [EMAIL PROTECTED] [mailto:programming- > [EMAIL PROTECTED] Namens Raul Miller > Verzonden: dinsdag 5 februari 2008 14:01 > Aan: Programming forum > Onderwerp: Re: [Jprogramming] populating a list of boxed strings > > If you do not mind losing any leading sequence > of a: another approach would be: > (a:&~: (#;[EMAIL PROTECTED] # #) ]) mylist > > If you do mind, you might use: > (a:&~: (#;.1@(1&,)@[ # a:,#) ])&.(a:&,) mylist > > I believe that either of these would be faster, for large > sequences, than the other proposed alternatives. > (But I have not actually bothered to test, so I > might be wrong.) > > -- > Raul > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
