try SumOfFact^:3 [169 169
R.E. Boss > From: [email protected] > To: [email protected] > Date: Thu, 4 Sep 2014 20:55:31 +0200 > Subject: [Jprogramming] repeated applications of a verb > > I'm working on PE#74, which asks for the sum of the factorials of the digits > in a number > (i.e. if the number is 169 then it asks for 1!+6!+9!). > > I wrote this verb that performs the required operation: > SumOfFact=: 3 : 0 > +/!"."0@": y > ) > It works perfectly, but now I need to reiterate it to produce a chain like > 169 -> 363601 -> 1454 -> 169,so I tried: > SumOfFact^:3 169 > > But instead of working as I hoped it simply writes "SumOfFact^:3 169" as > output. > > What am I doing wrong and how am I supposed to repeatedly apply a verb to an > argument? > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
