Implement an API for probability distributions
Ruby, 103

u=b=-&gt;*a{a}
o=-&gt;f,d{d[2]?(p=o[0,d[0]])*o[f,d[1]]+(1-p)*o[f,d[2]]:(f&lt;a=d[0])?1:(f&gt;b=d[1])?0:(b-f)/(b-a)}


Defines three lambdas, u, b, and o. u and b just create two-element and three-element arrays respectively. o assumes a two-element array is a uniform distribution and a three-element one is a blend of three distributions. In the latter case it calls itself recursively.