Site under construction! :3

Array (arr) ξ―‚

Propertiesξ―‚

lengthξ―‚

1.0.0 Integer

Returns the length of the array as an int.

Methodsξ―‚

all(func: function = (el => el)) -> bool ξ―‚

1.0.0 Boolean

Returns true only if all elements of the array return true when passed as an argument into func, else it returns false.

Pigeonξ―‚
arr = [0, 1, 2, 3, 4]
arr.all((el => el > 3))  # false

any(func: function = (el => el)) -> bool ξ―‚

1.0.0 Boolean

Returns true if any element of the array returns true when passed as a arguments into func, else it returns false.

Pigeonξ―‚
arr = [0, 1, 2, 3, 4]
arr.any((el => el > 3))  # true

combine(*arrays: array, allow_duplicates: bool = true) -> array ξ―‚

1.0.0 Array

Combines the elements of arrays into the instance array.

Pigeonξ―‚
arr1 = [1, 2, 3]
arr2 = [3, 4, 5]
x = array.combine(arr1, arr2)  # [1, 2, 3, 3, 4, 5]

contains(element: any) -> bool ξ―‚

1.0.0 Boolean

Returns true if the array contains at least one element that is equal to element, else it returns false.

Pigeonξ―‚
arr = ["a", "b", "c", "a", "b", "a"]
arr.contains("d")  # false

count(condition: any) -> int ξ―‚

1.0.0 Integer

Returns the number of elements in the array that match condition.

Pigeonξ―‚
arr = ["a", "b", "c", "a", "b", "a"]
arr.count("a")  # 3

extend(*arrays: array, allow_duplicates: bool = true) -> none ξ―‚

1.0.0 None

Combines the elements of arrays into the instance array.

Pigeonξ―‚
arr1 = [1, 2, 3]
arr2 = [3, 4, 5]
arr1.extend(arr2)  # arr1 = [1, 2, 3, 3, 4, 5]

filter(func: function = (el => el)) -> none ξ―‚

1.0.0 None

Removes all elements of the instance array which do not return true when passed as arguments into func

Pigeonξ―‚
arr = ["a", true, 0, "b", 2, ["c", "d"]]
arr.filter((el => type(el) is string))  # arr = ["a", "b"]

find(func: function = (el => el)) -> any ξ―‚

1.0.0 Any

Returns the first element of the instance array returns true when passed as an argument into func.

Pigeonξ―‚
arr = ["a", true, 0, "b", 2, ["c", "d"]]
x = arr.find((el => type(el) is string))  # "a"

find_all(func: function = (el => el)) -> generator[any] ξ―‚

1.0.0 Generator

Returns a generator of all the elements of the instance array which return true when passed as a arguments into func.

Pigeonξ―‚
arr = ["a", true, 0, "b", 2, ["c", "d"]]
items = arr.find_all((el => type(el) is string))
next(items)  # a
next(items)  # b
next(items)  # undefined

flatten() -> none ξ―‚

1.0.0 None

Modifies the instance array so that all nested array items are de-nested and lie "flat" with all other elements. Empty arrays are ignored.

Pigeonξ―‚
arr = ["a", ["b", none], ["c", [[], "d"]]]
arr.flatten()  # ["a", "b", none, "c", "d"]

index(condition: any) -> int ξ―‚

1.0.0 Integer

Returns the index of the first element in the instance array that satisfy condition.

Pigeonξ―‚
arr = ["a", true, 0, "b", 2, ["c", "d"]]
x = arr.index((el => type(el) is string))  # 0

index_all(condition: any) -> generator[int] ξ―‚

1.0.0 Generator

Returns a generator of the indices of all elements in the instance array that satisfy condition.

Pigeonξ―‚
arr = ["a", true, 0, "b", 2, ["c", "d"]]
indices = arr.index_all((el => type(el) is string))
next(indices)  # 0
next(indices)  # 3
next(indices)  # undefined

insert(element: any, index: index) -> none ξ―‚

1.0.0 None

Inserts element at position index.

Pigeonξ―‚
arr = [0, 1, 2, 3, 4]
arr.insert("a", 2)  # arr = [0, 1, "a", 2, 3, 4]

join(separator: str = "") -> str ξ―‚

1.0.0 String

Returns the contents of the array concatenated as a string, separated by the string separator.

Pigeonξ―‚
arr = ["a", "b", "c", "d"]
x = arr.join("-")  # "a-b-c-d"

map(func: function) -> none ξ―‚

1.0.0 None

Maps each item of the instance array to the returned array by passing them as arguments into func.

Pigeonξ―‚
arr = [0, 1, 2, 3, 4]
arr.map((el => el * 2))  # arr = [0, 2, 4, 6, 8]

pop(index: index = -1) -> any ξ―‚

1.0.0 Any

Removes (pops) and returns the element at position index of the instance array.

Pigeonξ―‚
arr = [0, 1, 2, 3, 4]
x = arr.pop()  # 4
print(arr)  # [0, 1, 2, 3]

push(element: any) -> none ξ―‚

1.0.0 None

Appends (pushes) element to the end of the instance array.

Pigeonξ―‚
arr = [0, 1, 2, 3, 4]
arr.push(5)
print(arr)  # [0, 1, 2, 3, 4, 5]

remove(element: any) -> none ξ―‚

1.0.0 None

Removes the first element of the instance array that is equal to element.

Pigeonξ―‚
arr = ["a", "b", "c", "a", "a"]
arr.remove("a")
print(arr)  # ["b", "c", "a", "a"]

remove_all(element: any) -> none ξ―‚

1.0.0 None

Removes all elements of the instance array that are equal to element.

Pigeonξ―‚
arr = ["a", "b", "c", "a", "a"]
arr.remove_all("a")
print(arr)  # ["b", "c"]

reverse() -> none ξ―‚

1.0.0 None

Reverses the order of elements in the instance array.

Pigeonξ―‚
arr = [0, 1, 2, 3, 4]
arr.reverse()  # arr = [4, 3, 2, 1, 0]

replace(condition: any, content: any) -> none ξ―‚

TODO

sort(key: any = none, descending: bool = false) -> none ξ―‚

1.0.0 None

Sorts the array in the order specified by key.

By default, this sorts numbers by value, and strings alphabetically.

Pigeonξ―‚
arr = [3, 1, 4, 2, 0]
arr.sort()  # arr = [0, 1, 2, 3, 4]