[Jprogramming] Function programming
Raul Miller
rauldmiller at gmail.com
Fri Mar 2 04:16:39 HKT 2007
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
More information about the Programming
mailing list