Finance Combinators[S. Peyton Jones and J.M. Eber, ``How to write a financial contract'', in The Fun of Programming, ed Gibbons and de Moor, Palgrave Macmillan 2003]
(zero) | a contract that has no rights |
and no obligations | |
(one k) | one unit of currency k |
c | you immediately acquire contract c |
(give c) | to give a contract c to another party; |
like negation | |
(at t c) | if you acquire contract c before time t, |
it becomes effective at time t | |
(truncate t c) | contract c ceases to exist after time t |
(and c1 c2) | both contracts c1 and c2 |
(or c1 c2) | your choice of contracts c1 and c2 |
(cond b c1 c2) | you acquire contract c1 |
if the observable b is true, | |
else you acquire c2 | |
(scale o c) | multiply contract c by observable o |
(when b c) | you must acquire contract c |
when b becomes true | |
(but worthless if b can never be true) | |
(anytime b c) | you may acquire contract c |
any time b becomes true | |
(until b c) | is like contract c but must be abandoned |
when b becomes true | |