Skip to content

Latest commit

 

History

History
485 lines (344 loc) · 6.29 KB

library_reference.md

File metadata and controls

485 lines (344 loc) · 6.29 KB

methods

List

List[T]

push

List#push(element: T) -> Void

pushes an element at the end of the list

pop

List#pop() -> T

pops the last element of the list, undefined behavior for empty lists

length

List#length() -> Int

insert

List#insert(element: T, index: Int) -> Void

remove

List#remove(element: T) -> Void

remove_at

List#remove_at(index: Int) -> Void

slice

List#slice(from: Int, to: Int) -> List[T]

slice_from

List#slice_from(from: Int) -> List[T]

slice_to

List#slice_to(to: Int) -> List[T]

map

List#map(f: Function[T, Z]) -> List[Z]

filter

List#filter(f: Function[T, Boolean]) -> List[T]

reduce

List#reduce(f: Function[T, Z, Z], initial: Z) -> Z

any?

List#any?(f: Function[T, Boolean]) -> Boolean

all?

List#all?(f: Function[T, Boolean]) -> Boolean

sort

List#sort() -> Void

sorts in place

Dictionary

Dictionary[K, V]

length

Dictionary#length() -> Int

contains?

Dictionary#contains?(element: T) -> Boolean

keys

Dictionary#keys() -> List[K]

values

Dictionary#values() -> List[V]

present?

Dictionary#present?() -> Boolean

empty?

Dictionary#empty?() -> Boolean

Set[T]

length

Set#length() -> Int

contains?

Set#contains?(element: T) -> Boolean

union

Set#union(right: Set[T]) -> Set[T]

intersection

Set#intersection(right: Set[T]) -> Set[T]

present?

Set#present?() -> Boolean
Set#empty?() -> Boolean

Tuple[T1, T2..]

length

Tuple#length() -> Int

Array[T, length]

length

Array#length() -> Int

String

substr

String#substr(from: Int, to: Int) -> String

substr_from

String#substr_from(from: Int) -> String

substr_to

String#substr_to(to: Int) -> String

length

String#length() -> Int

concat

String#concat(value: String) -> String

find

String#find(element: String) -> Int

count

String#count(element: String) -> Int

partition

String#partition(on: String) -> Tuple[String, String]

split

String#split(delimiter: String) -> List[String]

trim

String#trim() -> String

reversed

String#reversed() -> String

center

String#center(count: Int, fill: String) -> String

present?

String#present?() -> Boolean

empty?

String#empty?() -> Boolean

to_int

String#to_int() -> Int

pad_left

String#pad_left(count: Int, fill: String) -> String

pad_right

String#pad_right(count: Int, fill: String) -> String

Int

to_int

Int#to_int() -> Int

to_float

Int#to_float() -> Float

functions

math

Currently just several methods, add more in future versions and investigate edge cases

ln

ln(x: Number) -> Float

the natural logarithm of x

log

log(x: Number, base: Number) -> Float

cos

cos(x: Number) -> Float

the cosine of x

tan

tan(x: Number) -> Float

the tangent

sin

sin(x: Number) -> Float

io

display

display(*args: Any) -> Void

writes the contents to STDOUT using the native print function. display is the only pseudo function accepting a variable number of args

read

read() -> String

reads a line from STDIN

system

args

args() -> List[String]

returns a list with all the command line args

arg_count

arg_count() -> Int

returns the number of command line args (including the filename)

index

index(a: Int) -> String

a-th command arg, 1-based indexing(filename is 0)