Thanks Dan and Devon,

Give me - er, hum - a "moment" to digest it!

Raul I'm not following you here, I understand ": is "default format"
though not to sure how it's used.   <":  just boxes the integer unsplit.

Not to worry though, DAn and Devon's answers have given me more than
enough food for thought.

Thanks all
 

On Fri, 2010-08-13 at 16:23 -0400, Devon McCormick wrote:
> NB. For
>    nums=. 0 1 11 101 1234
> NB. Convert to character:
>    ":&.>nums
> +-+-+--+---+----+
> |0|1|11|101|1234|
> +-+-+--+---+----+
> 
> NB. So
> 
>    (<'0123456789')i.&.>":&.>nums
> +-+-+---+-----+-------+
> |0|1|1 1|1 0 1|1 2 3 4|
> +-+-+---+-----+-------+
> 
> NB. or
> 
>     ".&>&.>":&.>nums
> +-+-+---+-----+-------+
> |0|1|1 1|1 0 1|1 2 3 4|
> +-+-+---+-----+-------+
> 
> 
> On Fri, Aug 13, 2010 at 4:06 PM, Alex Gian <[email protected]>wrote:
> 
> > 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

Reply via email to