NAME
Zuzu::Value::Bag - runtime value class for bag values
DESCRIPTION
Wraps runtime bag values that keep duplicates without ordering guarantees.
INHERITANCE
Inherits from Moo::Object.
ROLES
None.
ATTRIBUTES
items
Type: ArrayRef.
Bag members, including duplicate entries.
METHODS
add
Adds one or more members.
remove
Removes a single matching member, if present.
remove_first
Alias for remove.
contains
Returns true when the bag contains a matching value.
to_Array
Returns this bag as an array value.
to_Set
Returns this bag as a set value.
map
Returns a new bag by mapping each member through a callback.
grep
Returns a new bag 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 member count.
empty
Returns true when the bag has no members.
clear
Removes all members from the bag.
is_truthy
Returns this runtime value's truthiness in ZuzuScript.
COPYRIGHT AND LICENCE
Zuzu::Value::Bag 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.