Hello Raul;

My apologies.  I forgot the original formula was not using Iverson 
precedence rules.  Your gerund reduction is a very J like way of solving it.

Raul Miller wrote:
> On Wed, Apr 28, 2010 at 7:30 AM, Joe Bohart <[email protected]> wrote:
>   
>> ExpectedVolatility = (A + B) * C + D
>>
>> so super simple problem reduction:
>> data =: 1 2 3 4
>> goal (non j notation): (1+2)*3 + 4
>>     
>
> If I understand you correctly, you want:
>    ((A+B)*C)+D
> or
>    ((1+2)*3)+4
> 13
> or
>    4+(3*(2+1))
> 13
>
> But, in J, parenthesis around the right argument
> for a verb are almost always unnecessary, so
>    4+3*2+1
> 13
>
> And that is probably what you were looking for.
>
> Nevertheless, I am tempted to carry this a bit further:
>    +`*`+/4 3 2 1
> 13
>
> Or, if you want the data in its original organization:
>    expe=: +`*`+/@|.
>    expe 1 2 3 4
> 13
>
> Perhaps some of this will have helped.
>
>   
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to