pass `fn` to `mean`

so that it works with toFunction