builtin_list
Module
Implements the ListLiteral class.
These are Mojo built-ins, so you don’t need to import them.
ListLiteral
The type of a literal heterogenous list expression.
A list consists of zero or more values, separated by commas.
Parameters:
- Ts (
*AnyType
): The type of the elements.
Fields:
- storage (
!pop.pack<Ts>
): The underlying storage for the list.
Functions:
__init__
__init__(args: !pop.pack<Ts>) -> Self
Construct the list literal from the given values.
Args:
- args (
!pop.pack<Ts>
): The init values.
Returns:
The constructed ListLiteral.
__len__
__len__(self: Self) -> Int
Get the list length.
Returns:
The length of this ListLiteral.
get
get[i: Int, T: AnyType](self: Self) -> T
Get a list element at the given index.
Parameters:
- i (
Int
): The element index. - T (
AnyType
): The element type.
Returns:
The element at the given index.