It is actually pretty easy to add functions at runtime: closures are there just
for that! :) Of course, not actual new functions, but still parametrized family
of functions.
What I would like to do is just being able to manipulate random variables in
the natural way. My ideal library would be usable like this:
var rng = ...
let
a = uniform(-10, 10)
b = gaussian(mean = 0, stddev = 2)
c = abs(a + b)
echo rng.mean(c)
echo rng.sample(c)
For this to work I have to lift unary (`abs`) and binary (`+`) functions to
distributions and so on.
Syntactic sugar aside, it is just what is called the probability monad in other
programming languages