I have a problem similar to the one shown below.
Both the verbs g and h depend on calculating f first so this seems like an
inefficient way of doing it where f produces only nonnegative integers from
its argument.
Is there a better approach?

   g=:,:f
   h=:*@f
   f=: 3&|   NB. not the real f, but f is more compute heavy
   3 : '(h y)}g y' i.10   NB. an example calculation
0 1 2 3 1 2 6 1 2 9
   ]`h`g } i. 10          NB. another "tacit" calculation
0 1 2 3 1 2 6 1 2 9



-- 
(B=) <-----my sig
Brian Schott
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to