code: def combs(a, r):
      
      # Special-case for 0-length combinations
      if r == 0:
          return np.asarray([])
  
      a = np.asarray(a)
      data_type = a.dtype if r == 0 else np.dtype([('', a.dtype)] * r)
      b = np.fromiter(combinations(a, r), data_type)
      return b.view(a.dtype).reshape(-1, r)
docs: NumPy implementation of ``itertools.combinations``.
  
      Return successive ``r``-length combinations of elements in the array ``a``.
  
      Args:
          a (np.ndarray): The array from which to get combinations.
          r (int): The length of the combinations.
  
      Returns:
          np.ndarray: An array of combinations.