Set::S...:Valued(3pm)

πŸ“¦
version 1.29 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Set::S...:Valued πŸ’–

ok so bestie, this is the manpage for Set::Scalar::Valued (yes the header abbreviates it, it's giving mysterious but it's literally just Set::Scalar::Valued, part of the User Contributed Perl Documentation situation) β€” it's a Perl module and it's lowkey iconic. sit down, hydrate, let's go 🫢


✨ NAME ✨

Set::Scalar::Valued β€” valued sets πŸ’…


🌸 SYNOPSIS 🌸

    use Set::Scalar::Valued;
    $s = Set::Scalar::Valued->new;
    $s->insert(a => 12, 'b c' => $d);
    $s->delete('b c' => $d);
    $t = Set::Scalar->new(x => $y, y => $z);

see how every member gets to bring a lil plus-one value along?? that's the whole vibe πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so valued sets are an extension of the traditional set concept, no cap. in a regular set a member just... exists. in a valued set, the member also has a distinct value attached to it. think of it as a traditional set and a Perl hash had a baby and the baby ate πŸ’–

the methods are the same as for the traditional Set::Scalar, with one lil twist: when you're creating (new()) or modifying (insert(), delete(), invert()), you have to supply twice the number of arguments β€” the member-value pairs, instead of just the members. periodt.

⚠️ okay important, bestie, read this twice: in the current implementation of delete(), the value half is unused β€” the deletion happens by the member. so the value you pass in is just... there, vibing, doing nothing. in a future implementation this behavior may change so that the value matters too. so don't build your whole personality on the value being ignored, iykyk πŸ‘€

there are a couple of additional methods, and they're honestly the moment:

    %ve = $s->valued_members;

which returns the member-value pairs, and

    @v  = $s->values;

which returns just the values β€” and listen, they come back in the same order as the members() method would return the members, so the alignment stays cute and correct ✨

and

    $v  = $s->value($member);

which returns the value of the member. yes, one member, one value, very demure, very mindful 🌸

last thing, the display format of a valued set: it's the member-value pairs separated by " => ", the pairs separated by ", ", and the whole thing enclosed in curly brackets {}. so it's giving hash-but-make-it-a-set and honestly? obsessed πŸ’œ


πŸ‘‘ AUTHOR πŸ‘‘

Jarkko Hietaniemi <jhi@iki.fi> β€” legend behavior fr fr 🫢


and that's the whole page, bestie!! this was Set::S...:Valued(3pm) from perl v5.34.0, dated 2022-06-17, brought to you by User Contributed Perl Documentation. go forth and value your members πŸ’–βœ¨πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from