Tagged: Coding

Interlude: Schönfinkeling for R

Schönfinkel takes a function in A x B -> C. It returns one of type A -> B -> C.

Schönfinkel = function(f) {
function(x) {function (y) f(x,y)}
}

unSchönfinkel does the reverse:

unSchönfinkel = function(f) {
function(x,y) f(x)(y)
}

And an example:

> add = function(x,y) x+y
>
> succ = Schönfinkel(add)(1)
> succ(2)
[1] 3
>
> unSchönfinkel(Schönfinkel(add))(1,2)
[1] 3

Can’t be hard to generalise this.

The sexy Goldman Sachs code

“… there is a danger that somebody who knew how to use this program could use it to manipulate markets in unfair ways.”

See here:

Apparently the code stolen by Sergey Aleynikov is over here (not checked and dunno if anyone has UPDATE seems just to be open source stuff).