Hello Arie;

This elegant solution relies on ". of any list of spaces matching 0#0 instead of a VALUE ERROR. Perhaps this should be included in the documentation, since spaces are not a verb, adverb nor conjunction.

This ((0#0)-: ".' ') is my J nugget of the day.

Arie Groeneveld wrote:


 +/,.&.": 10 3 112 16 7
22


Dan Bron schreef:
I wrote:
 usual metrics apply:  novelty, brevity,  velocity, and parsimony.

I'm most interested in an elegant way to rephrase sum-of-the-digits:

       +/@:,@:(#.^:_1)

Can you come up with a better way?  Example:

       10 +/@:,@:(#.^:_1) 10 3 112 16 7     22

-Dan

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


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


--
------------------------------------------------------------------------
|\/| Randy A MacDonald       | APL: If you can say it, it's done.. (ram)
|/\| ramacd <at> nbnet.nb.ca |
|\ |                         | The only real problem with APL is that
BSc(Math) UNBF'83            | it is "still ahead of its time."
Sapere Aude                  |     - Morten Kromberg
Natural Born APL'er          |
-----------------------------------------------------(INTP)----{ gnat }-



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

Reply via email to