June Kim wrote:
>
> 1) Could you come up with more elegant, efficient solutions?

I think generating functions are better:

ppr=: +//.@(*/)
f=:13 : '+/(->.-:#y){. ppr/(1-y),.y'
pr1=:21 # 0.7
pr2=:0.95 0.95 0.90 0.90 0.80

   f pr1
0.97361
   f pr2
0.992945

Best wishes,

John


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to