10&#.^:_1 -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Alex Gian Sent: Friday, August 13, 2010 4:07 PM To: Programming forum Subject: [Jprogramming] Splitting an integer into its digits
This is a fairly common requirement, especially in mathematical puzzles or, for example, in regard to oddities like "happy numbers", and so on. There are two possible approaches, either the Perl-like conversion to a string which is then split or "exploded", or the more common repeated integer division. What would be considered a good, efficient J implementation, forgoing explicit loops, etc? Basically I'm looking for a verb "explode" which will return a string comprising the digits of a positive integer. I am still pretty much learning J, so a few hints rather than a full, exhaustive solution would be appreciated. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
