SPVM::I...IntList(3)
π NAME π
SPVM::Immutable::IntList β Immutable int Array.
Welcome, bestie! You're on the SPVM::Immutable::IntList(3) manual page β a User Contributed Perl Documentation situation, and the header does SPVM::I...IntList(3) because truncation ate, honestly? iconic. β¨
πΈ DESCRIPTION πΈ
The Immutable::IntList class has methods to manipulate an immutable int array. It's giving "no mutation, no drama" energy. π
β¨ USAGE β¨
Okay bestie, here's the whole vibe:
use Immutable::IntList;
# Create a int list
my $list = Immutable::IntList->new;
my $list = Immutable::IntList->new([(int)1, 2, 3]);
# Create a int list with array length
my $list = Immutable::IntList->new_len(10);
# Get list length
my $length = $list->length;
# Get value.
my $element = $list->get(2);
# Convert list to array.
my $array = $list->to_array;
π FIELDS π
length
has length : ro int;
Gets the "length" field. This field is the length of the elements of the list. Slay. π«Ά
π¦ CLASS METHODS π¦
new
static method new : Immutable::IntList ($array : int[] = undef);
Create a new Immutable::IntList object using new_len.
The passed length to new_len is the length of the array. If the array is undef, the length is 0.
The elements of the array are copied to the elements of the the created array β double the and all, because we don't erase the lore. π
Examples:
my $list = Immutable::IntList->new;
my $list = Immutable::IntList->new([(int)1, 2, 3]);
new_len
static method new_len : Immutable::IntList ($length : int);
Creates a new Immutable::IntList object with $length. Constructor energy, periodt. π
Exceptions:
$lengthmust be greater than or equal to0.
π INSTANCE METHODS π
get
method get : int ($index : int);
Gets the element of the position of $index.
If $index is a netative value, $index is set to length plus $index.
Exceptions:
$indexmust be greater than or equal to0.$indexmust be less than the length of$list.
to_array
method to_array : int[] ();
Converts the list to an array. Lowkey the most satisfying glow-up. π¦
π COPYRIGHT & LICENSE π
Copyright (c) 2023 Yuki Kimoto
MIT License
and that's the whole page, bestie π«Ά β source/version: perl v5.42.2, date: 2026-02-03. bye, love you, go build something iconic π
β¨
π¦ where this page comes from
- alpine 3.24: spvm-doc 0.990125-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms