NAME

Zuzu::Value::Set - runtime value class for set values

DESCRIPTION

Wraps runtime set values and enforces uniqueness for added elements.

INHERITANCE

Inherits from Moo::Object.

ROLES

None.

ATTRIBUTES

items

Type: ArrayRef.

Unique set members stored in insertion order for predictable iteration.

METHODS

add

Adds one or more members and keeps only unique values.

remove

Removes all occurrences of the provided member.

contains

Returns true when the set contains a matching value.

to_Bag

Returns a bag containing this set's members.

map

Returns a new set by mapping each member through a callback.

grep

Returns a new set containing members where callback is true.

any

Returns true if any member satisfies the callback.

all

Returns true if all members satisfy the callback.

first

Returns the first matching member or undef when none match.

remove_if

Removes members where callback returns true.

length

Returns the current number of members.

empty

Returns true when the set has no members.

clear

Removes all members from the set.

to_Array

Returns this set as an array value.

is_truthy

Returns this runtime value's truthiness in ZuzuScript.

COPYRIGHT AND LICENCE

Zuzu::Value::Set is copyright Toby Inkster.

It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.