diff --git a/src/icepool/population/die.py b/src/icepool/population/die.py index 1cd311d0..c42760cc 100644 --- a/src/icepool/population/die.py +++ b/src/icepool/population/die.py @@ -734,8 +734,8 @@ def _sum_cache(self) -> MutableMapping[int, 'Die']: def _sum_all(self, rolls: int, /) -> 'Die': """Roll this `Die` `rolls` times and sum the results. - The sum is computed one at a time, with the new item on the right, - similar to `functools.reduce()`. + The sum is computed one at a time, with each additional item on the + right, similar to `functools.reduce()`. If `rolls` is negative, roll the `Die` `abs(rolls)` times and negate the result. @@ -761,7 +761,11 @@ def _sum_all(self, rolls: int, /) -> 'Die': return result def __matmul__(self: 'Die[int]', other) -> 'Die': - """Roll the left `Die`, then roll the right `Die` that many times and sum the outcomes.""" + """Roll the left `Die`, then roll the right `Die` that many times and sum the outcomes. + + The sum is computed one at a time, with each additional item on the + right, similar to `functools.reduce()`. + """ if isinstance(other, icepool.AgainExpression): return NotImplemented other = implicit_convert_to_die(other) @@ -780,7 +784,11 @@ def __matmul__(self: 'Die[int]', other) -> 'Die': return icepool.Die(data) def __rmatmul__(self, other: 'int | Die[int]') -> 'Die': - """Roll the left `Die`, then roll the right `Die` that many times and sum the outcomes.""" + """Roll the left `Die`, then roll the right `Die` that many times and sum the outcomes. + + The sum is computed one at a time, with each additional item on the + right, similar to `functools.reduce()`. + """ if isinstance(other, icepool.AgainExpression): return NotImplemented other = implicit_convert_to_die(other)