Create an R function which behaves like the probability mass function (PMF)
of a given ddf distribution.
Details
The probability mass function \(p_X\) of a discrete random variable \(X\) is given by $$p_X(x) = \mathbb{P}[X = x],$$ where \(\mathbb{P}\) is the probability operator.
Examples
# Get probability of 5 in a geometric distribution
pmf(geometric(0.4))(5)
#> [1] 0.031104
