[Jprogramming] Function programming
Ralph G Selfridge
selfrid at cns.ufl.edu
Fri Mar 2 10:24:54 HKT 2007
Yes, that is the way I thought of to get to tacit, but the line gets very
long, and I would argue excessively cumbersome. I'll see if I can pullit
over and compare run times.
On Thu, 1 Mar 2007, Raul Miller wrote:
> On 2/28/07, Ralph G Selfridge <selfrid at cns.ufl.edu> wrote:
>> In the argument about tacit or explicit I offer the following verb, comes
>> from a Black-Scholes algorithm. Lets assume we have the verb cndn. I won't
>> claim I can't make this tacit, I will claim it won't be easy and or
>> readable and far more work than I think its worth. And I doubt it will run
>> any faster.
>>
>> bsn=: 3 : 0
>> 's x t r v'=.y
>> |(s,x*^-r*t)-/ .*cndn 1 _1*/~((^.s%x)+t*r(+,-)-:*:v)%v*%:t
>> )
>
> That's not very fun without the surrounding context (definition of
> cndn and sample arguments).
>
> That said, a literal translation seems completely straightforward
> (but not as concise):
>
> '`s x t r v'=: (0{::])`(1{::])`(2{::])`(3{::])`(4{::])
> bsn=: [:|(s,x*[:^[:-r*t)-/.*[:cndn 1
> _1*/~(([:^.s%x)+t*r(+,-)[:-:[:*:v)%v*[:%:t
>
> That said, both versions of bsn use 'x' in a fashion that's likely to
> confuse someone. But, at least with the tacit form it's trivial to
> eliminate from the definition:
>
> bsn=: bsn f.
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
More information about the Programming
mailing list