code: def categorical_like(x, p):
      R
  
      p = np.atleast_2d(p)
      if np.any(abs(np.sum(p, 1) - 1) > 0.0001):
          print_("Probabilities in categorical_like sum to", np.sum(p, 1))
      return flib.categorical(np.array(x).astype(int), p)
docs: R"""
      Categorical log-likelihood. The most general discrete distribution.
  
      .. math::  f(x=i \mid p) = p_i
  
      for :math:`i \in 0 \ldots k-1`.
  
      :Parameters:
        - `x` : [int] :math:`x \in 0\ldots k-1`
        - `p` : [float] :math:`p > 0`, :math:`\sum p = 1`