SPVM::I...oatList(3)

πŸ“¦ version 0.990125, in alpine 3.24

✨ 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: $length must be greater than or equal to 0. 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:

  • $index must be greater than or equal to 0. Otherwise an exception is thrown.
  • $index must 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 (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