Skip to main content

struct

ListLiteral

The type of a literal heterogenous list expression.

A list consists of zero or more values, separated by commas.

Parameters

  • *Ts (CollectionElement): The type of the elements.

Fields

  • storage (Tuple[Ts]): The underlying storage for the list.

Implemented traits

AnyType, CollectionElement, Copyable, Movable, Sized

Methods

__init__

__init__(inout self: Self, /, *args: *Ts)

Construct the list literal from the given values.

Args:

  • *args (*Ts): The init values.

__len__

__len__(self: Self) -> Int

Get the list length.

Returns:

The length of this ListLiteral.

get

get[i: Int, T: CollectionElement](self: Self) -> $1

Get a list element at the given index.

Parameters:

  • i (Int): The element index.
  • T (CollectionElement): The element type.

Returns:

The element at the given index.