On Sat, Aug 21, 2010 at 7:21 AM, Viktor Cerovski
<[email protected]> wrote:
> Well known efficient representation of polynomial assuming
> right-to-left order of evaluation is:
>
> c1+x*c2+x*c3+x*c4+...+x*cn === (+ x * ])/ c === (+ x&*)/ c
>
> We can define an adverb P that does this kind of computation:
>
> P=:(&*)(+`)(`:6)/
>
> 1 2 3 P
> (+ 1 2 3&*)/
>
> 1 2 3 P 1 2 3 4
> 10 49 142
Or we could use a verb:
1 2 3 (#."0 _ |.) 1 2 3 4
10 49 142
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm