NAME
HAMT::Set::Transient - a set opened for a batch of updates
VERSION
Version 0.03
SYNOPSIS
use HAMT::Set;
my $s = HAMT::Set->new('a');
my $t = $s->transient;
$t->add("member$_") for 1 .. 100_000;
$t->remove('a');
my $s2 = $t->persistent;
$s->count; # 1: the set it was opened from is unchanged
$s2->count; # 100000
DESCRIPTION
A HAMT::Set that is changed in place for a while, and then closed into an ordinary set that never changes again. It is to a set what HAMT::Map::Transient is to a map, and that page says when one is worth using.
It is made by "transient" in HAMT::Set. The set it was opened from is not affected by anything done to it, and neither is any other transient opened from the same set.
"add" and "remove" return the transient itself and do not warn in void context. A transient has no members, each, union, intersect, difference or equals: call "persistent" first.
METHODS
add
$t->add($member);
$t->add(@members)->add($another);
Adds the members to the transient and returns the transient.
remove
$t->remove($member);
$t->remove(@members);
Removes the members from the transient and returns the transient. One that is not there is ignored.
has
if ($t->has($member)) { ... }
True when it is a member.
count
my $n = $t->count;
The number of members.
persistent
my $s = $t->persistent;
An ordinary set holding what the transient holds, of the class of the set the transient was opened from. This does not copy anything.
The transient is closed by it. Every method called on a closed transient dies with this transient is closed.
THREADS
A transient belongs to the interpreter that made it and is not inherited by a new thread.
AUTHOR
LNATION, <email at lnation.org>
BUGS
Please report any bugs or feature requests to bug-hamt at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=HAMT.
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION.
This is free software, licensed under the Artistic License 2.0.