That's the idea - we have to break this down to its primitive constitutents: where "primitive" explicitly means that numerical values can only be combined with - + * % and | . So yes, we'd have to use your named hornersRule or some named equivalent in place of p. . If we permit p., we might as well permit #. and t. and so on .. all the way back up to ^ .
----- Original Message --------------- Subject: Re: [Jprogramming] Power for the powerless From: David Lambert <[email protected]> Date: Tue, 05 Aug 2014 10:52:07 -0400 To: [email protected] Restricting against p. is too much constraint. p. *must* be implemented with Horner's rule. If not, hornersRule =: [: +`*/ [: }. [: , ,.~ assert (-.+:8?@#0) (hornersRule -: p.) 3 > Date: Tue, 5 Aug 2014 09:49:40 -0400 > From: Dan Bron<[email protected]> > To:[email protected] > Subject: Re: [Jprogramming] Power for the powerless > Message-ID: <PC1993201408050949400080597fc8b8@DNYCW000013> > Content-Type: text/plain; charset=iso-8859-1 > > Raul wrote: >> > A really simple approach would be to use T. >> > pow=: ^ T. 99 > First: probably a better name for your function is "exp" instead of "pow" > ("exp" is a monad related to the dyad "pow" by fixing its left argument to > 1x1). > > But certainly exp is a welcome improvement over my formulation, with a > couple caveats. Specifically, even if we write off the presence of the > primitive ^ in ^T.99 as permissible due to the use-mention distinction, > the result of T., as you point out: > >> > gives you a polynomial expression > i.e., is an expression involving p., which is not one of the specifically > enumerated operations. More problematic, it has an implicit use of ^ (the > DoJ explicitly defines x p. y as +/x*y^i.#x). This is why I explicitly > excluded T.'s ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
