On Sat, 2010-08-28 at 12:00 +0800, [email protected]
wrote:
> Message: 6
> Date: Sat, 28 Aug 2010 03:51:36 +0100
> From: Alex Gian <[email protected]>
> Subject: Re: [Jprogramming] Splitting an integer into its digits
> To: Programming forum <[email protected]>
> Message-ID: <1282963896.4959.20.ca...@headhoncho>
...
> 

Hooks are shorter.  You'll have to learn them if only to read another's
code.  For the monads:

digits =. 10x&#.inv   NB. !8 9 are floats (fully represented, not
actually a problem)
> digits =. 10&#.inv  NB.  No probs here

(! + ])  identical to   (+~ !)  and by commuting +, equivalent to  (+ !)
> fp1 =. ! + ]        NB.  I think that's fine too

> spsum =. +/ @ fp1 @ digits  NB.  Works... BUT...

(] = spsum)   identical to   (= spsum)
> special=. ]=spsum

> (#~ special) >:i.1000000  NB. That's the idea, but it's wrong


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

Reply via email to