You cannot always break down j as shown. digits is the proverb for a hook. In the hook, "."0 is the dyadic numbers. The original sentence evaluates "."0 as the monad do at rank 0. digits happens to work because the digits from formatting a number are necessarily valid. Literal data distinguishes these:

   digits=:"."0 ":

   "."0 ": '123'
1 2 3

   digits '123'
|domain error: digits
|       digits'123'


>Date: Wed, 28 May 2014 23:48:31 +0800
>From: Rob Hodgkinson <[email protected]>
>To: [email protected]
>Subject: Re: [Jprogramming] Project Euler 16, J vs Haskell
>Message-ID: <[email protected]>
>Content-Type: text/plain; charset=windows-1252
>
>Jon, a brief note on your point re readability ? you can always break J down as follows if you require;
>
>   +/ "."0 ": !100x        NB. From Roger
>648
>
>   sum=:+/
>   digits=:"."0 ":
>   factorial=:!
>   sum digits factorial 100x
>648
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to