NAME ^

src/classes/CardinalArray.pir - Cardinal CardinalArray class and related functions Stolen from Rakudo

Methods ^

get_string() (vtable method)

Return the elements of the list concatenated.

to_s() (method)

Return a CardinalString representing the Array.

clone() (vtable method)

Clones the list.

clear() (method)

Removes all elements from the array.

ACCEPTS(topic)

elems()

Return the number of elements in the list.

sort()

Return a sorted copy of the list

uniq(...)

include?(ELEMENT)

Return true if self contains ELEMENT

unshift(ELEMENTS)

Prepends ELEMENTS to the front of the list.

keys()

Returns a CardinalArray containing the keys of the CardinalArray.

values()

Returns a CardinalArray containing the values of the CardinalArray.

shift()

Shifts the first item off the list and returns it.

pop()

Treats the list as a stack, popping the last item off the list and returning it.

push(ELEMENTS)

Treats the list as a stack, pushing ELEMENTS onto the end of the list. Returns the new length of the list.

join(SEPARATOR)

Returns a string comprised of all of the list, separated by the string SEPARATOR. Given an empty list, join returns the empty string. SEPARATOR is an optional parameter

reverse()

Returns a list of the elements in revese order.

reverse!()

Reverses a list in place. Destructive update. Returns self.

delete()

Deletes the given element from the CardinalArray, replacing them with Undef. Returns the item if found, otherwise returns the result of running the block if passed, otherwise returns nil.

exists(INDEX)

Checks to see if the specified index or indices have been assigned to. Returns a Bool value.

kv()

pairs()

grep(...)

first(...)

first(...)

each(block)

Run block once for each item in self, with the item passed as an arg.

collect(block)

Run block once for each item in self, with the item passed as an arg. Creates a new Array containing the results and returns it.

flatten

 recursively flatten any inner arrays into a single outer array
size

Retrieve the number of elements in self

length

Retrieve the number of elements in self

at(index)

    Retrieve element from position C<index>.
slice

Retrieve the number of elements in self

zip

The zip operator.

Functions ^

list(...)

Build a CardinalArray from its arguments.

infix:,(...)

Operator form for building a list from its arguments.

infix:Z(...)

The zip operator.

infix:X(...)

The non-hyper cross operator.

infix:min(...)

The min operator.

infix:max(...)

The max operator.

reverse(LIST)

Returns the elements of LIST in the opposite order.


parrot