SPVM::I...LongList(3)
π SPVM::Immutable::LongList β the manual page, but make it make sense
Okay bestie, so this page is SPVM::Immutable::LongList(3) from the user-contributed Perl docs, and it's literally all about one thing: an immutable long array. Iconic. Let's get into it. π¦
β¨ Name β¨
SPVM::Immutable::LongList β an immutable long array. That's the whole vibe. Once it's made, it's made. No take-backs, no edits, periodt. π
πΈ Description πΈ
The Immutable::LongList class has methods to manipulate an immutable long array. Lowkey the chillest class in the whole ecosystem β it just holds your longs and refuses to change. Main character energy fr fr. π
π Usage π
Here's the whole group chat in action:
use Immutable::LongList;
# Create a long list
my $list = Immutable::LongList->new;
my $list = Immutable::LongList->new([(long)1, 2, 3]);
# Create a long list with array length
my $list = Immutable::LongList->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;
Like, that's it. That's the whole API and it ate. π
π§ Fields π§
π length
has length : ro int;
Gets the length field. Read-only, so don't even think about touching it. π
This field is the length of the elements of the list. Simple as that. β¨
β Class Methods β
π new
static method new : Immutable::LongList ($array : long[] = undef);
Create a new Immutable::LongList object using new_len. Yes, it delegates. She's efficient like that. π«Ά
The passed length to new_len is the length of the array. If the array is undef, the length is 0. No array? No problem. Zero vibes, but valid ones. π
The elements of the array are copied to the elements of the the created array. (Yes, the original says "the the". We keep the the. Preserving history. π)
Examples:
my $list = Immutable::LongList->new;
my $list = Immutable::LongList->new([(long)1, 2, 3]);
π new_len
static method new_len : Immutable::LongList ($length : int);
Creates a new Immutable::LongList object with $length. You tell it how long, it gives you the list. Slay. β¨
Exceptions:
$lengthmust be greater than or equal to0. Otherwise an exception is thrown. So like, negative lengths? Not today, bestie. π«
π₯ Instance Methods π₯
π get
method get : long ($index : int);
Gets the element of the position of $index. Very "give me the thing at this spot" of it. π―
If $index is a netative value, $index is set to length plus $index. (Yeah, the manpage says "netative" β we're keeping the typo, it's canon now. π) So you can index from the end like a cool person. π
Exceptions:
$indexmust be greater than or equal to0. Otherwise an exception is thrown. π$indexmust be less than the length of$list. Otherwise an exception is thrown. Don't go out of bounds, it's embarrassing. π
π¦ to_array
method to_array : long[] ();
Converts the list to an array. Glow-up complete β the list becomes an array and honestly? Both are valid. πβ
π Copyright & License π
Copyright (c) 2023 Yuki Kimoto
MIT License
Ngl, MIT License is the "yes bestie, do whatever, just give credit" of licenses. Iconic and permissive. π«Ά
And that's the tea! π΅ Mwah, thanks for reading, bestie β per the footer this was perl v5.42.2, dated 2026-02-03, on the SPVM::I...LongList(3) page. Go forth and build immutable long arrays, you gorgeous genius. πβ¨π
π¦ 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