I would use Chris Burke's inverse base solution, which is antibase with
the required number of "base".  However, let's also remember 1j2&#
inserts two fills between each character, answering question 2.  I use
it to prepare Jumble puzzles for printing.


   datatype secret
literal

   > type <'secret'
noun

   jumble =: 1j1 # cryptogram

   cryptogram =: Alpha_j_&$: : (((mix@[ , ]) i. ]) { [ , ])&toupper

   mix =: {~ # ? #         NB. Ignore "no letter stands for itself"

   jumble secret
A H H   E U H G A   A H   E H W V J ? 

   #jumble secret
38
   #secret
19

On Mon, 2011-03-21 at 20:38 +0800, [email protected]
wrote:
> Date: Mon, 21 Mar 2011 10:55:44 +0400
> From: Jabran Noor <[email protected]>
> Subject: [Jprogramming] Adding up digits in a long number
> To: [email protected]
> Message-ID:
>         <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> I want to add up the digits in a long 50-digit number.
> 
> Specifically, my question is
> 
> 1. How to convert a number into a string... e.g. convert
> 12324343456456 into
> a text format. I understand that using *":* works
> 2. Now, in the output from 1, I want to insert a blank space between
> each
> letter. I am struggling to do that. I tried reshaping etc but not
> getting
> the desired results. What is one single verb which will do the trick
> for me. 

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

Reply via email to