IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo function

prefix_product

def prefix_product(a: IntTuple) -> IntTuple

Compute the exclusive prefix product of an IntTuple.

This is a convenience wrapper that initializes the prefix product with 1.

Args:

  • โ€‹a (IntTuple): The input IntTuple to compute the prefix product for.

Returns:

IntTuple: A new IntTuple containing the exclusive prefix product of the input.

def prefix_product(a: IntTuple, init: Int) -> IntTuple

Compute the exclusive prefix product of an IntTuple with an initial value.

This function delegates to the implementation in prefix_product2.

Args:

  • โ€‹a (IntTuple): The input IntTuple to compute the prefix product for.
  • โ€‹init (Int): The initial value(s) for the prefix product, defaults to 1.

Returns:

IntTuple: A new IntTuple containing the exclusive prefix product of the input.

Was this page helpful?