NAME

Zuzu::Value::Array - runtime value class for array values

DESCRIPTION

Wraps runtime array values and provides truthiness semantics for collections.

INHERITANCE

Inherits from Moo::Object.

ROLES

None.

ATTRIBUTES

items

Type: ArrayRef.

Ordered array elements (expressions or runtime values).

METHODS

new

Constructs and returns a new instance of this class.

is_truthy

Returns this runtime value's truthiness in ZuzuScript.

push

Appends one or more items and returns this array.

pop

Removes and returns the final item.

unshift

Prepends one or more items and returns this array.

shift

Removes and returns the first item.

clear

Removes all items and returns this array.

length

Returns the number of items.

map

Returns a new array by mapping each element through a callback.

grep

Returns a new array with elements where callback is true.

any

Returns true if any element satisfies the callback.

all

Returns true if all elements satisfy the callback.

first

Returns the first matching element or undef when none match.

remove

Removes elements where callback returns true.

contains

Returns true when the array contains a matching value.

to_Set

Returns a new set with type-aware unique values from this array.

to_Bag

Returns a new bag containing this array's values.

empty

Returns true when the array has no items.

SEE ALSO

Subclasses: none in this distribution.

COPYRIGHT AND LICENCE

Zuzu::Value::Array 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.