How about

([ [^:(0...@]) ".)"1

Henry Rich

On 1/11/2011 10:46 AM, richard.vaug...@us.thewg.com wrote:
> I need a simple utility that will return the numeric value represented by
> a string y, following the rules of dyadic ". except returning the scalar x
> if y is empty.  This should be fast since it is to be applied under>  to
> large arrays of boxed strings whose exact format cannot be controlled.  I
> have observed that if y is preceded by a TAB the result of ". is
> unchanged, and if y is a TAB alone the result is x; therefore adding a TAB
> before (each) y seems to do the trick.  But this is not documented in the
> Vocabulary.  Can I trust this behaviour to continue in future editions of
> J?
>
> Adding a space would seem more natural but ". treats y that is all spaces
> like an empty vector.  Best would be if the left argument to ". had an
> optional second element, specifying the exact number of elements to be
> returned in each row, or default 0 for the present behaviour.  Then I
> could force an empty y to receive the padding value 0{x.
>
> Thanks,
>
> Richard Vaughan
> This message is intended only for the addressee and may contain information 
> that is confidential or privileged. Unauthorized use is strictly prohibited 
> and may be unlawful. If you are not the intended recipient, or the person 
> responsible for delivering to the intended recipient, you should not read, 
> copy, disclose or otherwise use this message, except for the purpose of 
> delivery to the addressee. If you have received this email in error, please 
> delete and advise the IT Security department at info...@thewg.com immediately.
>
> Please consider the environment before printing this e-mail.
> ----------------------------------------------------------------------
> 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