SPVM::I...oatList(3)
β¨ SPVM::Immutable::FloatList β Immutable float Array β¨
Okay bestie, so this is a page from the User Contributed Perl Documentation (iykyk, the perl gang said "we'll host it"), and the star of the show is SPVM::Immutable::FloatList. Let's get into it π
π¦ NAME
SPVM::Immutable::FloatList β an immutable float array, periodt. Once it's built, it does not change. That's the whole vibe π
πΈ DESCRIPTION
The Immutable::FloatList class has methods to manipulate an immutable float array. That's it, that's the girlboss job description π
β USAGE
Here's how you actually use her, no cap:
use Immutable::FloatList;
# Create a float list
my $list = Immutable::FloatList->new;
my $list = Immutable::FloatList->new([(float)1, 2, 3]);
# Create a float list with array length
my $list = Immutable::FloatList->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;
Create it, check its length, grab an element, turn it back into an array β iconic little routine honestly π«Ά
π§ FIELDS
π length
has length : ro int;
Gets the "length" field. This field is the length of the elements of the list. Read-only, so don't even think about setting it yourself π
π CLASS METHODS
π new
static method new : Immutable::FloatList ($array : float[] = undef);
Create a new Immutable::FloatList 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 created array β so your original array stays untouched, we love a copy that minds its business β¨
Examples:
my $list = Immutable::FloatList->new;
my $list = Immutable::FloatList->new([(float)1, 2, 3]);
π new_len
static method new_len : Immutable::FloatList ($length : int);
Creates a new Immutable::FloatList object with $length.
Careful bestie:$lengthmust be greater than or equal to0. Otherwise an exception is thrown π No negative lengths, that's not a thing and the class will absolutely call you out on it.
π INSTANCE METHODS
π¦ get
method get : float ($index : int);
Gets the element of the position of $index.
If $index is a negative value, $index is set to "length" plus $index. So yeah, negative indexing is a whole thing here, work it π
Exceptions:
$indexmust be greater than or equal to0. Otherwise an exception is thrown.$indexmust be less than the length of$list.
So basically: stay in bounds, or catch an exception. The math checks out and the class is not flexible about it fr fr π€
π₯ to_array
method to_array : float[] ();
Converts the list to an array. Simple, clean, slay.
π COPYRIGHT & LICENSE
Copyright (c) 2023 Yuki Kimoto
MIT License
And that's the whole page, bestie β thanks for reading, mwah π
This one was served up by perl v5.42.2, dated 2026-02-03, and it goes by SPVM::I...oatList(3) in the catalog β go off, you little truncated beauty β¨π«Ά
π¦ 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