Further shorten docs
This commit is contained in:
parent
9a3162633d
commit
899e2cd3f1
@ -41,7 +41,6 @@ Information about Tomo's built-in types can be found here:
|
|||||||
### `ask`
|
### `ask`
|
||||||
Gets a line of user input text with a prompt.
|
Gets a line of user input text with a prompt.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func ask(prompt:Text, bold:Bool = yes, force_tty:Bool = yes -> Void)
|
func ask(prompt:Text, bold:Bool = yes, force_tty:Bool = yes -> Void)
|
||||||
```
|
```
|
||||||
@ -72,7 +71,6 @@ something went wrong (e.g. the user hit `Ctrl-D`).
|
|||||||
### `exit`
|
### `exit`
|
||||||
Exits the program with a given status and optionally prints a message.
|
Exits the program with a given status and optionally prints a message.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func ask(message:Text? = !Text, status:Int32 = 1[32] -> Void)
|
func ask(message:Text? = !Text, status:Int32 = 1[32] -> Void)
|
||||||
```
|
```
|
||||||
@ -95,7 +93,6 @@ exit(status=1, "Goodbye forever!")
|
|||||||
### `say`
|
### `say`
|
||||||
Prints a message to the console.
|
Prints a message to the console.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func say(text:Text, newline:Bool = yes -> Void)
|
func say(text:Text, newline:Bool = yes -> Void)
|
||||||
```
|
```
|
||||||
@ -117,7 +114,6 @@ say("world!")
|
|||||||
### `sleep`
|
### `sleep`
|
||||||
Pause execution for a given number of seconds.
|
Pause execution for a given number of seconds.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func sleep(seconds: Num -> Void)
|
func sleep(seconds: Num -> Void)
|
||||||
```
|
```
|
||||||
@ -137,7 +133,6 @@ sleep(1.5)
|
|||||||
### `fail`
|
### `fail`
|
||||||
Prints a message to the console, aborts the program, and prints a stack trace.
|
Prints a message to the console, aborts the program, and prints a stack trace.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func fail(message:Text -> Abort)
|
func fail(message:Text -> Abort)
|
||||||
```
|
```
|
||||||
@ -157,7 +152,6 @@ fail("Oh no!")
|
|||||||
### `now`
|
### `now`
|
||||||
Gets the current time. This is an alias for `Moment.now()`.
|
Gets the current time. This is an alias for `Moment.now()`.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func now(->Moment)
|
func now(->Moment)
|
||||||
```
|
```
|
||||||
|
@ -262,7 +262,6 @@ variable or dereference a heap pointer, it may trigger copy-on-write behavior.
|
|||||||
### `binary_search`
|
### `binary_search`
|
||||||
Performs a binary search on a sorted array.
|
Performs a binary search on a sorted array.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func binary_search(arr: [T], by: func(x,y:&T->Int32) = T.compare -> Int)
|
func binary_search(arr: [T], by: func(x,y:&T->Int32) = T.compare -> Int)
|
||||||
```
|
```
|
||||||
@ -294,7 +293,6 @@ place where it would be found if it were inserted and the array were sorted.
|
|||||||
### `by`
|
### `by`
|
||||||
Creates a new array with elements spaced by the specified step value.
|
Creates a new array with elements spaced by the specified step value.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func by(arr: [T], step: Int -> [T])
|
func by(arr: [T], step: Int -> [T])
|
||||||
```
|
```
|
||||||
@ -316,7 +314,6 @@ A new array with every `step`-th element from the original array.
|
|||||||
### `clear`
|
### `clear`
|
||||||
Clears all elements from the array.
|
Clears all elements from the array.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func clear(arr: @[T] -> Void)
|
func clear(arr: @[T] -> Void)
|
||||||
```
|
```
|
||||||
@ -336,7 +333,6 @@ Nothing.
|
|||||||
### `counts`
|
### `counts`
|
||||||
Counts the occurrences of each element in the array.
|
Counts the occurrences of each element in the array.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func counts(arr: [T] -> {T,Int})
|
func counts(arr: [T] -> {T,Int})
|
||||||
```
|
```
|
||||||
@ -357,7 +353,6 @@ A table mapping each element to its count.
|
|||||||
### `find`
|
### `find`
|
||||||
Finds the index of the first occurrence of an element (if any).
|
Finds the index of the first occurrence of an element (if any).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func find(arr: [T], target: T -> Int?)
|
func find(arr: [T], target: T -> Int?)
|
||||||
```
|
```
|
||||||
@ -382,7 +377,6 @@ The index of the first occurrence or `!Int` if not found.
|
|||||||
### `first`
|
### `first`
|
||||||
Find the index of the first item that matches a predicate function (if any).
|
Find the index of the first item that matches a predicate function (if any).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func first(arr: [T], predicate: func(item:&T -> Bool) -> Int)
|
func first(arr: [T], predicate: func(item:&T -> Bool) -> Int)
|
||||||
```
|
```
|
||||||
@ -408,7 +402,6 @@ item matches.
|
|||||||
### `from`
|
### `from`
|
||||||
Returns a slice of the array starting from a specified index.
|
Returns a slice of the array starting from a specified index.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func from(arr: [T], first: Int -> [T])
|
func from(arr: [T], first: Int -> [T])
|
||||||
```
|
```
|
||||||
@ -430,7 +423,6 @@ A new array starting from the specified index.
|
|||||||
### `has`
|
### `has`
|
||||||
Checks if the array has any elements.
|
Checks if the array has any elements.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func has(arr: [T] -> Bool)
|
func has(arr: [T] -> Bool)
|
||||||
```
|
```
|
||||||
@ -452,7 +444,6 @@ func has(arr: [T] -> Bool)
|
|||||||
Removes and returns the top element of a heap or `none` if the array is empty.
|
Removes and returns the top element of a heap or `none` if the array is empty.
|
||||||
By default, this is the *minimum* value in the heap.
|
By default, this is the *minimum* value in the heap.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func heap_pop(arr: @[T], by: func(x,y:&T->Int32) = T.compare -> T?)
|
func heap_pop(arr: @[T], by: func(x,y:&T->Int32) = T.compare -> T?)
|
||||||
```
|
```
|
||||||
@ -478,7 +469,6 @@ The removed top element of the heap or `none` if the array is empty.
|
|||||||
Adds an element to the heap and maintains the heap property. By default, this
|
Adds an element to the heap and maintains the heap property. By default, this
|
||||||
is a *minimum* heap.
|
is a *minimum* heap.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func heap_push(arr: @[T], item: T, by=T.compare -> Void)
|
func heap_push(arr: @[T], item: T, by=T.compare -> Void)
|
||||||
```
|
```
|
||||||
@ -501,7 +491,6 @@ Nothing.
|
|||||||
### `heapify`
|
### `heapify`
|
||||||
Converts an array into a heap.
|
Converts an array into a heap.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func heapify(arr: @[T], by: func(x,y:&T->Int32) = T.compare -> Void)
|
func heapify(arr: @[T], by: func(x,y:&T->Int32) = T.compare -> Void)
|
||||||
```
|
```
|
||||||
@ -524,7 +513,6 @@ Nothing.
|
|||||||
### `insert`
|
### `insert`
|
||||||
Inserts an element at a specified position in the array.
|
Inserts an element at a specified position in the array.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func insert(arr: @[T], item: T, at: Int = 0 -> Void)
|
func insert(arr: @[T], item: T, at: Int = 0 -> Void)
|
||||||
```
|
```
|
||||||
@ -555,7 +543,6 @@ Nothing.
|
|||||||
### `insert_all`
|
### `insert_all`
|
||||||
Inserts an array of items at a specified position in the array.
|
Inserts an array of items at a specified position in the array.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func insert_all(arr: @[T], items: [T], at: Int = 0 -> Void)
|
func insert_all(arr: @[T], items: [T], at: Int = 0 -> Void)
|
||||||
```
|
```
|
||||||
@ -588,7 +575,6 @@ Removes and returns an item from the array. If the given index is present in
|
|||||||
the array, the item at that index will be removed and the array will become one
|
the array, the item at that index will be removed and the array will become one
|
||||||
element shorter.
|
element shorter.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func pop(arr: &[T], index: Int = -1 -> T?)
|
func pop(arr: &[T], index: Int = -1 -> T?)
|
||||||
```
|
```
|
||||||
@ -620,7 +606,6 @@ otherwise the item at the given index.
|
|||||||
### `random`
|
### `random`
|
||||||
Selects a random element from the array.
|
Selects a random element from the array.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func random(arr: [T], rng: RNG = random -> T)
|
func random(arr: [T], rng: RNG = random -> T)
|
||||||
```
|
```
|
||||||
@ -642,7 +627,6 @@ A random element from the array.
|
|||||||
### `remove_at`
|
### `remove_at`
|
||||||
Removes elements from the array starting at a specified index.
|
Removes elements from the array starting at a specified index.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func remove_at(arr: @[T], at: Int = -1, count: Int = 1 -> Void)
|
func remove_at(arr: @[T], at: Int = -1, count: Int = 1 -> Void)
|
||||||
```
|
```
|
||||||
@ -671,7 +655,6 @@ arr:remove_at(2, count=2)
|
|||||||
### `remove_item`
|
### `remove_item`
|
||||||
Removes all occurrences of a specified item from the array.
|
Removes all occurrences of a specified item from the array.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func remove_item(arr: @[T], item: T, max_count: Int = -1 -> Void)
|
func remove_item(arr: @[T], item: T, max_count: Int = -1 -> Void)
|
||||||
```
|
```
|
||||||
@ -700,7 +683,6 @@ arr:remove_item(20, max_count=1)
|
|||||||
### `reversed`
|
### `reversed`
|
||||||
Returns a reversed slice of the array.
|
Returns a reversed slice of the array.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func reversed(arr: [T] -> [T])
|
func reversed(arr: [T] -> [T])
|
||||||
```
|
```
|
||||||
@ -722,7 +704,6 @@ A slice of the array with elements in reverse order.
|
|||||||
Selects a sample of elements from the array, optionally with weighted
|
Selects a sample of elements from the array, optionally with weighted
|
||||||
probabilities.
|
probabilities.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func sample(arr: [T], count: Int, weights: [Num]? = ![Num], rng: RNG = random -> [T])
|
func sample(arr: [T], count: Int, weights: [Num]? = ![Num], rng: RNG = random -> [T])
|
||||||
```
|
```
|
||||||
@ -757,7 +738,6 @@ A list of sampled elements from the array.
|
|||||||
### `shuffle`
|
### `shuffle`
|
||||||
Shuffles the elements of the array in place.
|
Shuffles the elements of the array in place.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func shuffle(arr: @[T], rng: RNG = random -> Void)
|
func shuffle(arr: @[T], rng: RNG = random -> Void)
|
||||||
```
|
```
|
||||||
@ -778,7 +758,6 @@ Nothing.
|
|||||||
### `shuffled`
|
### `shuffled`
|
||||||
Creates a new array with elements shuffled.
|
Creates a new array with elements shuffled.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func shuffled(arr: [T], rng: RNG = random -> [T])
|
func shuffled(arr: [T], rng: RNG = random -> [T])
|
||||||
```
|
```
|
||||||
@ -800,7 +779,6 @@ A new array with shuffled elements.
|
|||||||
### `slice`
|
### `slice`
|
||||||
Returns a slice of the array spanning the given indices (inclusive).
|
Returns a slice of the array spanning the given indices (inclusive).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func slice(arr: [T], from: Int, to: Int -> [T])
|
func slice(arr: [T], from: Int, to: Int -> [T])
|
||||||
```
|
```
|
||||||
@ -828,7 +806,6 @@ second-to-last, and so on.
|
|||||||
### `sort`
|
### `sort`
|
||||||
Sorts the elements of the array in place in ascending order (small to large).
|
Sorts the elements of the array in place in ascending order (small to large).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func sort(arr: @[T], by=T.compare -> Void)
|
func sort(arr: @[T], by=T.compare -> Void)
|
||||||
```
|
```
|
||||||
@ -857,7 +834,6 @@ arr:sort(func(a,b:&Int): a:abs() <> b:abs())
|
|||||||
### `sorted`
|
### `sorted`
|
||||||
Creates a new array with elements sorted.
|
Creates a new array with elements sorted.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
sorted(arr: [T], by=T.compare -> [T])
|
sorted(arr: [T], by=T.compare -> [T])
|
||||||
```
|
```
|
||||||
@ -883,7 +859,6 @@ A new array with sorted elements.
|
|||||||
### `to`
|
### `to`
|
||||||
Returns a slice of the array from the start of the original array up to a specified index (inclusive).
|
Returns a slice of the array from the start of the original array up to a specified index (inclusive).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
to(arr: [T], last: Int -> [T])
|
to(arr: [T], last: Int -> [T])
|
||||||
```
|
```
|
||||||
@ -908,7 +883,6 @@ A new array containing elements from the start up to the specified index.
|
|||||||
### `unique`
|
### `unique`
|
||||||
Returns a Set that contains the unique elements of the array.
|
Returns a Set that contains the unique elements of the array.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
unique(arr: [T] -> {T})
|
unique(arr: [T] -> {T})
|
||||||
```
|
```
|
||||||
|
@ -14,7 +14,6 @@ Converts a string representation of a boolean value into a boolean. Acceptable
|
|||||||
boolean values are case-insensitive variations of `yes`/`no`, `y`/`n`,
|
boolean values are case-insensitive variations of `yes`/`no`, `y`/`n`,
|
||||||
`true`/`false`, `on`/`off`.
|
`true`/`false`, `on`/`off`.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func parse(text: Text -> Bool?)
|
func parse(text: Text -> Bool?)
|
||||||
```
|
```
|
||||||
|
@ -140,7 +140,6 @@ can be called either on the type itself: `Int.sqrt(x)` or as a method call:
|
|||||||
### `abs`
|
### `abs`
|
||||||
Calculates the absolute value of an integer.
|
Calculates the absolute value of an integer.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func abs(x: Int -> Int)
|
func abs(x: Int -> Int)
|
||||||
```
|
```
|
||||||
@ -163,7 +162,6 @@ Computes the binomial coefficient of the given numbers (the equivalent of `n`
|
|||||||
choose `k` in combinatorics). This is equal to `n:factorial()/(k:factorial() *
|
choose `k` in combinatorics). This is equal to `n:factorial()/(k:factorial() *
|
||||||
(n-k):factorial())`.
|
(n-k):factorial())`.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func choose(n: Int, k: Int -> Int)
|
func choose(n: Int, k: Int -> Int)
|
||||||
```
|
```
|
||||||
@ -187,7 +185,6 @@ The binomial coefficient, equivalent to the number of ways to uniquely choose
|
|||||||
Returns the given number clamped between two values so that it is within
|
Returns the given number clamped between two values so that it is within
|
||||||
that range.
|
that range.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func clamped(x, low, high: Int -> Int)
|
func clamped(x, low, high: Int -> Int)
|
||||||
```
|
```
|
||||||
@ -210,7 +207,6 @@ The first argument clamped between the other two arguments.
|
|||||||
### `factorial`
|
### `factorial`
|
||||||
Computes the factorial of an integer.
|
Computes the factorial of an integer.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func factorial(n: Int -> Text)
|
func factorial(n: Int -> Text)
|
||||||
```
|
```
|
||||||
@ -231,7 +227,6 @@ The factorial of the given integer.
|
|||||||
### `format`
|
### `format`
|
||||||
Formats an integer as a string with a specified number of digits.
|
Formats an integer as a string with a specified number of digits.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func format(i: Int, digits: Int = 0 -> Text)
|
func format(i: Int, digits: Int = 0 -> Text)
|
||||||
```
|
```
|
||||||
@ -253,7 +248,6 @@ A string representation of the integer, padded to the specified number of digits
|
|||||||
### `hex`
|
### `hex`
|
||||||
Converts an integer to its hexadecimal representation.
|
Converts an integer to its hexadecimal representation.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func hex(i: Int, digits: Int = 0, uppercase: Bool = yes, prefix: Bool = yes -> Text)
|
func hex(i: Int, digits: Int = 0, uppercase: Bool = yes, prefix: Bool = yes -> Text)
|
||||||
```
|
```
|
||||||
@ -283,7 +277,6 @@ getting an incorrect answer are astronomically small (on the order of 10^(-30)).
|
|||||||
See [the GNU MP docs](https://gmplib.org/manual/Number-Theoretic-Functions#index-mpz_005fprobab_005fprime_005fp)
|
See [the GNU MP docs](https://gmplib.org/manual/Number-Theoretic-Functions#index-mpz_005fprobab_005fprime_005fp)
|
||||||
for more details.
|
for more details.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func is_prime(x: Int, reps: Int = 50 -> Bool)
|
func is_prime(x: Int, reps: Int = 50 -> Bool)
|
||||||
```
|
```
|
||||||
@ -313,7 +306,6 @@ answer are astronomically small (on the order of 10^(-30)).
|
|||||||
See [the GNU MP docs](https://gmplib.org/manual/Number-Theoretic-Functions#index-mpz_005fprobab_005fprime_005fp)
|
See [the GNU MP docs](https://gmplib.org/manual/Number-Theoretic-Functions#index-mpz_005fprobab_005fprime_005fp)
|
||||||
for more details.
|
for more details.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func next_prime(x: Int -> Int)
|
func next_prime(x: Int -> Int)
|
||||||
```
|
```
|
||||||
@ -334,7 +326,6 @@ The next prime number greater than `x`.
|
|||||||
### `octal`
|
### `octal`
|
||||||
Converts an integer to its octal representation.
|
Converts an integer to its octal representation.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func octal(i: Int, digits: Int = 0, prefix: Bool = yes -> Text)
|
func octal(i: Int, digits: Int = 0, prefix: Bool = yes -> Text)
|
||||||
```
|
```
|
||||||
@ -358,7 +349,6 @@ The octal string representation of the integer.
|
|||||||
Return an iterator that counts infinitely from the starting integer (with an
|
Return an iterator that counts infinitely from the starting integer (with an
|
||||||
optional step size).
|
optional step size).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func onward(first: Int, step: Int = 1 -> Text)
|
func onward(first: Int, step: Int = 1 -> Text)
|
||||||
```
|
```
|
||||||
@ -384,7 +374,6 @@ for i in 5:onward():
|
|||||||
### `parse`
|
### `parse`
|
||||||
Converts a text representation of an integer into an integer.
|
Converts a text representation of an integer into an integer.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func parse(text: Text -> Int?)
|
func parse(text: Text -> Int?)
|
||||||
```
|
```
|
||||||
@ -425,7 +414,6 @@ answer are astronomically small (on the order of 10^(-30)).
|
|||||||
See [the GNU MP docs](https://gmplib.org/manual/Number-Theoretic-Functions#index-mpz_005fprobab_005fprime_005fp)
|
See [the GNU MP docs](https://gmplib.org/manual/Number-Theoretic-Functions#index-mpz_005fprobab_005fprime_005fp)
|
||||||
for more details.
|
for more details.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func prev_prime(x: Int -> Int)
|
func prev_prime(x: Int -> Int)
|
||||||
```
|
```
|
||||||
@ -446,7 +434,6 @@ The previous prime number less than `x`.
|
|||||||
### `sqrt`
|
### `sqrt`
|
||||||
Calculates the square root of an integer.
|
Calculates the square root of an integer.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func sqrt(x: Int -> Int)
|
func sqrt(x: Int -> Int)
|
||||||
```
|
```
|
||||||
@ -470,7 +457,6 @@ The integer part of the square root of `x`.
|
|||||||
Returns an iterator function that iterates over the range of numbers specified.
|
Returns an iterator function that iterates over the range of numbers specified.
|
||||||
Iteration is assumed to be nonempty and
|
Iteration is assumed to be nonempty and
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func to(first: Int, last: Int, step : Int? = none:Int -> func(->Int?))
|
func to(first: Int, last: Int, step : Int? = none:Int -> func(->Int?))
|
||||||
```
|
```
|
||||||
|
@ -100,7 +100,6 @@ affected by leap seconds. For this reason, `after()` takes an argument,
|
|||||||
`timezone` which is used to determine in which timezone the offsets should be
|
`timezone` which is used to determine in which timezone the offsets should be
|
||||||
calculated.
|
calculated.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func after(moment: Moment, seconds : Num = 0.0, minutes : Num = 0.0, hours : Num = 0.0, days : Int = 0, weeks : Int = 0, months : Int = 0, years : Int = 0, timezone : Text? = !Text -> Moment)
|
func after(moment: Moment, seconds : Num = 0.0, minutes : Num = 0.0, hours : Num = 0.0, days : Int = 0, weeks : Int = 0, months : Int = 0, years : Int = 0, timezone : Text? = !Text -> Moment)
|
||||||
```
|
```
|
||||||
@ -131,7 +130,6 @@ A new `Moment` offset by the given amount.
|
|||||||
Return a text representation of the moment using the `"%F"` format
|
Return a text representation of the moment using the `"%F"` format
|
||||||
specifier, which gives the date in `YYYY-MM-DD` form.
|
specifier, which gives the date in `YYYY-MM-DD` form.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func date(moment: Moment, timezone : Text? = !Text -> Text)
|
func date(moment: Moment, timezone : Text? = !Text -> Text)
|
||||||
```
|
```
|
||||||
@ -153,7 +151,6 @@ The date in `YYYY-MM-DD` format.
|
|||||||
### `day_of_month`
|
### `day_of_month`
|
||||||
Return the integer day of the month (1-31).
|
Return the integer day of the month (1-31).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func day_of_month(moment: Moment, timezone : Text? = !Text -> Int)
|
func day_of_month(moment: Moment, timezone : Text? = !Text -> Int)
|
||||||
```
|
```
|
||||||
@ -176,7 +173,6 @@ The day of the month as an integer (1-31).
|
|||||||
Return the integer day of the week (1-7), where 1 = Sunday, 2 = Monday,
|
Return the integer day of the week (1-7), where 1 = Sunday, 2 = Monday,
|
||||||
3 = Tuesday, 4 = Wednesday, 5 = Thursday, 6 = Friday, 7 = Saturday.
|
3 = Tuesday, 4 = Wednesday, 5 = Thursday, 6 = Friday, 7 = Saturday.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func day_of_week(moment: Moment, timezone : Text? = !Text -> Int)
|
func day_of_week(moment: Moment, timezone : Text? = !Text -> Int)
|
||||||
```
|
```
|
||||||
@ -198,7 +194,6 @@ The day of the week as an integer (1-7).
|
|||||||
### `day_of_year`
|
### `day_of_year`
|
||||||
Return the integer day of the year (1-366, including leap years).
|
Return the integer day of the year (1-366, including leap years).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func day_of_year(moment: Moment, timezone : Text? = !Text -> Int)
|
func day_of_year(moment: Moment, timezone : Text? = !Text -> Int)
|
||||||
```
|
```
|
||||||
@ -223,7 +218,6 @@ options, return a text representation of the given date in the given format. If
|
|||||||
`timezone` is specified, use that timezone instead of the current local
|
`timezone` is specified, use that timezone instead of the current local
|
||||||
timezone.
|
timezone.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func format(moment: Moment, format: Text = "%Y-%m-%dT%H:%M:%S%z", timezone : Text? = !Text -> Text)
|
func format(moment: Moment, format: Text = "%Y-%m-%dT%H:%M:%S%z", timezone : Text? = !Text -> Text)
|
||||||
```
|
```
|
||||||
@ -247,7 +241,6 @@ Nothing.
|
|||||||
Return a moment object that represents the same moment in time as
|
Return a moment object that represents the same moment in time as
|
||||||
the given UNIX epoch timestamp (seconds since January 1, 1970 UTC).
|
the given UNIX epoch timestamp (seconds since January 1, 1970 UTC).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func from_unix_timestamp(timestamp: Int64 -> Moment)
|
func from_unix_timestamp(timestamp: Int64 -> Moment)
|
||||||
```
|
```
|
||||||
@ -269,7 +262,6 @@ Get the local timezone's name (e.g. `America/New_York` or `UTC`. By default,
|
|||||||
this value is read from `/etc/localtime`, however, this can be overridden by
|
this value is read from `/etc/localtime`, however, this can be overridden by
|
||||||
calling `Moment.set_local_timezone(...)`.
|
calling `Moment.set_local_timezone(...)`.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func get_local_timezone(->Text)
|
func get_local_timezone(->Text)
|
||||||
```
|
```
|
||||||
@ -290,7 +282,6 @@ The name of the current local timezone.
|
|||||||
### `hour`
|
### `hour`
|
||||||
Return the hour of the day as an integer (1-24).
|
Return the hour of the day as an integer (1-24).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func hour(moment: Moment, timezone : Text? = !Text -> Int)
|
func hour(moment: Moment, timezone : Text? = !Text -> Int)
|
||||||
```
|
```
|
||||||
@ -312,7 +303,6 @@ The hour of the day as an integer (1-24).
|
|||||||
### `hours_till`
|
### `hours_till`
|
||||||
Return the number of hours until a given moment.
|
Return the number of hours until a given moment.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func hours_till(moment: Moment, then:Moment -> Num)
|
func hours_till(moment: Moment, then:Moment -> Num)
|
||||||
```
|
```
|
||||||
@ -335,7 +325,6 @@ the_future := now():after(hours=1, minutes=30)
|
|||||||
### `minute`
|
### `minute`
|
||||||
Return the minute of the day as an integer (0-59).
|
Return the minute of the day as an integer (0-59).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func minute(moment: Moment, timezone : Text? = !Text -> Int)
|
func minute(moment: Moment, timezone : Text? = !Text -> Int)
|
||||||
```
|
```
|
||||||
@ -357,7 +346,6 @@ The minute of the hour as an integer (0-59).
|
|||||||
### `minutes_till`
|
### `minutes_till`
|
||||||
Return the number of minutes until a given moment.
|
Return the number of minutes until a given moment.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func minutes_till(moment: Moment, then:Moment -> Num)
|
func minutes_till(moment: Moment, then:Moment -> Num)
|
||||||
```
|
```
|
||||||
@ -380,7 +368,6 @@ the_future := now():after(minutes=1, seconds=30)
|
|||||||
### `month`
|
### `month`
|
||||||
Return the month of the year as an integer (1-12).
|
Return the month of the year as an integer (1-12).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func month(moment: Moment, timezone : Text? = !Text -> Int)
|
func month(moment: Moment, timezone : Text? = !Text -> Int)
|
||||||
```
|
```
|
||||||
@ -402,7 +389,6 @@ The month of the year as an integer (1-12).
|
|||||||
### `nanosecond`
|
### `nanosecond`
|
||||||
Return the nanosecond of the second as an integer (0-999,999,999).
|
Return the nanosecond of the second as an integer (0-999,999,999).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func nanosecond(moment: Moment, timezone : Text? = !Text -> Int)
|
func nanosecond(moment: Moment, timezone : Text? = !Text -> Int)
|
||||||
```
|
```
|
||||||
@ -426,7 +412,6 @@ Return a new `Moment` object representing the given time parameters expressed
|
|||||||
in local time. This function is the same as calling `Moment` directly as a
|
in local time. This function is the same as calling `Moment` directly as a
|
||||||
constructor.
|
constructor.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func new(year : Int, month : Int, day : Int, hour : Int = 0, minute : Int = 0, second : Num = 0.0 -> Moment)
|
func new(year : Int, month : Int, day : Int, hour : Int = 0, minute : Int = 0, second : Num = 0.0 -> Moment)
|
||||||
```
|
```
|
||||||
@ -461,7 +446,6 @@ integer, an error will be raised.
|
|||||||
Get a `Moment` object representing the current date and time. This function
|
Get a `Moment` object representing the current date and time. This function
|
||||||
is the same as the global function `now()`.
|
is the same as the global function `now()`.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func now(->Moment)
|
func now(->Moment)
|
||||||
```
|
```
|
||||||
@ -483,7 +467,6 @@ Returns a `Moment` object representing the current date and time.
|
|||||||
Return a new `Moment` object parsed from the given string in the given format,
|
Return a new `Moment` object parsed from the given string in the given format,
|
||||||
or `none` if the value could not be successfully parsed.
|
or `none` if the value could not be successfully parsed.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func parse(text: Text, format: Text = "%Y-%m-%dT%H:%M:%S%z" -> Moment?)
|
func parse(text: Text, format: Text = "%Y-%m-%dT%H:%M:%S%z" -> Moment?)
|
||||||
```
|
```
|
||||||
@ -512,7 +495,6 @@ If the text was successfully parsed according to the given format, return a
|
|||||||
Return a plain English textual representation of the approximate time difference
|
Return a plain English textual representation of the approximate time difference
|
||||||
between two `Moment`s. For example: `5 minutes ago` or `1 day later`
|
between two `Moment`s. For example: `5 minutes ago` or `1 day later`
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func relative(moment: Moment, relative_to : Moment = Moment.now(), timezone : Text? = !Text -> Text)
|
func relative(moment: Moment, relative_to : Moment = Moment.now(), timezone : Text? = !Text -> Text)
|
||||||
```
|
```
|
||||||
@ -544,7 +526,6 @@ ago"`, while moments in the future will have the suffix `" later"`.
|
|||||||
### `second`
|
### `second`
|
||||||
Return the second of the minute as an integer (0-59).
|
Return the second of the minute as an integer (0-59).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func second(moment: Moment, timezone : Text? = !Text -> Int)
|
func second(moment: Moment, timezone : Text? = !Text -> Int)
|
||||||
```
|
```
|
||||||
@ -566,7 +547,6 @@ The second of the hour as an integer (0-59).
|
|||||||
### `seconds_till`
|
### `seconds_till`
|
||||||
Return the number of seconds until a given moment.
|
Return the number of seconds until a given moment.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func seconds_till(moment: Moment, then:Moment -> Num)
|
func seconds_till(moment: Moment, then:Moment -> Num)
|
||||||
```
|
```
|
||||||
@ -593,7 +573,6 @@ timezone for performing calculations and constructing `Moment` objects from
|
|||||||
component parts. It's also used as the default way that `Moment` objects are
|
component parts. It's also used as the default way that `Moment` objects are
|
||||||
converted to text.
|
converted to text.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func set_local_timezone(timezone : Text? = !Text -> Void)
|
func set_local_timezone(timezone : Text? = !Text -> Void)
|
||||||
```
|
```
|
||||||
@ -615,7 +594,6 @@ Moment.set_local_timezone("America/Los_Angeles")
|
|||||||
### `time`
|
### `time`
|
||||||
Return a text representation of the time component of the given moment.
|
Return a text representation of the time component of the given moment.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func time(moment: Moment, seconds : Bool = no, am_pm : Bool = yes, timezone : Text? = !Text -> Text)
|
func time(moment: Moment, seconds : Bool = no, am_pm : Bool = yes, timezone : Text? = !Text -> Text)
|
||||||
```
|
```
|
||||||
@ -648,7 +626,6 @@ moment := Moment(2024, 9, 29, hours=13, minutes=59, seconds=30)
|
|||||||
Get the UNIX timestamp of the given moment (seconds since the UNIX epoch:
|
Get the UNIX timestamp of the given moment (seconds since the UNIX epoch:
|
||||||
January 1, 1970 UTC).
|
January 1, 1970 UTC).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func unix_timestamp(moment:Moment->Int64)
|
func unix_timestamp(moment:Moment->Int64)
|
||||||
```
|
```
|
||||||
|
49
docs/nums.md
49
docs/nums.md
@ -172,7 +172,6 @@ called either on the type itself: `Num.sqrt(x)` or as a method call:
|
|||||||
### `abs`
|
### `abs`
|
||||||
Calculates the absolute value of a number.
|
Calculates the absolute value of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func abs(n: Num -> Num)
|
func abs(n: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -193,7 +192,6 @@ The absolute value of `n`.
|
|||||||
### `acos`
|
### `acos`
|
||||||
Computes the arc cosine of a number.
|
Computes the arc cosine of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func acos(x: Num -> Num)
|
func acos(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -214,7 +212,6 @@ The arc cosine of `x` in radians.
|
|||||||
### `acosh`
|
### `acosh`
|
||||||
Computes the inverse hyperbolic cosine of a number.
|
Computes the inverse hyperbolic cosine of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func acosh(x: Num -> Num)
|
func acosh(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -235,7 +232,6 @@ The inverse hyperbolic cosine of `x`.
|
|||||||
### `asin`
|
### `asin`
|
||||||
Computes the arc sine of a number.
|
Computes the arc sine of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func asin(x: Num -> Num)
|
func asin(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -256,7 +252,6 @@ The arc sine of `x` in radians.
|
|||||||
### `asinh`
|
### `asinh`
|
||||||
Computes the inverse hyperbolic sine of a number.
|
Computes the inverse hyperbolic sine of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func asinh(x: Num -> Num)
|
func asinh(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -277,7 +272,6 @@ The inverse hyperbolic sine of `x`.
|
|||||||
### `atan`
|
### `atan`
|
||||||
Computes the arc tangent of a number.
|
Computes the arc tangent of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func atan(x: Num -> Num)
|
func atan(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -298,7 +292,6 @@ The arc tangent of `x` in radians.
|
|||||||
### `atan2`
|
### `atan2`
|
||||||
Computes the arc tangent of the quotient of two numbers.
|
Computes the arc tangent of the quotient of two numbers.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func atan2(x: Num, y: Num -> Num)
|
func atan2(x: Num, y: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -320,7 +313,6 @@ The arc tangent of `x/y` in radians.
|
|||||||
### `atanh`
|
### `atanh`
|
||||||
Computes the inverse hyperbolic tangent of a number.
|
Computes the inverse hyperbolic tangent of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func atanh(x: Num -> Num)
|
func atanh(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -341,7 +333,6 @@ The inverse hyperbolic tangent of `x`.
|
|||||||
### `cbrt`
|
### `cbrt`
|
||||||
Computes the cube root of a number.
|
Computes the cube root of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func cbrt(x: Num -> Num)
|
func cbrt(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -362,7 +353,6 @@ The cube root of `x`.
|
|||||||
### `ceil`
|
### `ceil`
|
||||||
Rounds a number up to the nearest integer.
|
Rounds a number up to the nearest integer.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func ceil(x: Num -> Num)
|
func ceil(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -384,7 +374,6 @@ The smallest integer greater than or equal to `x`.
|
|||||||
Returns the given number clamped between two values so that it is within
|
Returns the given number clamped between two values so that it is within
|
||||||
that range.
|
that range.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
clamped(x, low, high: Num -> Num)
|
clamped(x, low, high: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -407,7 +396,6 @@ The first argument clamped between the other two arguments.
|
|||||||
### `copysign`
|
### `copysign`
|
||||||
Copies the sign of one number to another.
|
Copies the sign of one number to another.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func copysign(x: Num, y: Num -> Num)
|
func copysign(x: Num, y: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -429,7 +417,6 @@ A number with the magnitude of `x` and the sign of `y`.
|
|||||||
### `cos`
|
### `cos`
|
||||||
Computes the cosine of a number (angle in radians).
|
Computes the cosine of a number (angle in radians).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func cos(x: Num -> Num)
|
func cos(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -450,7 +437,6 @@ The cosine of `x`.
|
|||||||
### `cosh`
|
### `cosh`
|
||||||
Computes the hyperbolic cosine of a number.
|
Computes the hyperbolic cosine of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func cosh(x: Num -> Num)
|
func cosh(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -471,7 +457,6 @@ The hyperbolic cosine of `x`.
|
|||||||
### `erf`
|
### `erf`
|
||||||
Computes the error function of a number.
|
Computes the error function of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func erf(x: Num -> Num)
|
func erf(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -492,7 +477,6 @@ The error function of `x`.
|
|||||||
### `erfc`
|
### `erfc`
|
||||||
Computes the complementary error function of a number.
|
Computes the complementary error function of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func erfc(x: Num -> Num)
|
func erfc(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -513,7 +497,6 @@ The complementary error function of `x`.
|
|||||||
### `exp`
|
### `exp`
|
||||||
Computes the exponential function \( e^x \) for a number.
|
Computes the exponential function \( e^x \) for a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func exp(x: Num -> Num)
|
func exp(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -534,7 +517,6 @@ The value of \( e^x \).
|
|||||||
### `exp2`
|
### `exp2`
|
||||||
Computes \( 2^x \) for a number.
|
Computes \( 2^x \) for a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func exp2(x: Num -> Num)
|
func exp2(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -555,7 +537,6 @@ The value of \( 2^x \).
|
|||||||
### `expm1`
|
### `expm1`
|
||||||
Computes \( e^x - 1 \) for a number.
|
Computes \( e^x - 1 \) for a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func expm1(x: Num -> Num)
|
func expm1(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -576,7 +557,6 @@ The value of \( e^x - 1 \).
|
|||||||
### `fdim`
|
### `fdim`
|
||||||
Computes the positive difference between two numbers.
|
Computes the positive difference between two numbers.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func fdim(x: Num, y: Num -> Num)
|
func fdim(x: Num, y: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -600,7 +580,6 @@ fd
|
|||||||
### `floor`
|
### `floor`
|
||||||
Rounds a number down to the nearest integer.
|
Rounds a number down to the nearest integer.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func floor(x: Num -> Num)
|
func floor(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -621,7 +600,6 @@ The largest integer less than or equal to `x`.
|
|||||||
### `format`
|
### `format`
|
||||||
Formats a number as a text with a specified precision.
|
Formats a number as a text with a specified precision.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func format(n: Num, precision: Int = 0 -> Text)
|
func format(n: Num, precision: Int = 0 -> Text)
|
||||||
```
|
```
|
||||||
@ -643,7 +621,6 @@ A text representation of the number with the specified precision.
|
|||||||
### `hypot`
|
### `hypot`
|
||||||
Computes the Euclidean norm, \( \sqrt{x^2 + y^2} \), of two numbers.
|
Computes the Euclidean norm, \( \sqrt{x^2 + y^2} \), of two numbers.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func hypot(x: Num, y: Num -> Num)
|
func hypot(x: Num, y: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -665,7 +642,6 @@ The Euclidean norm of `x` and `y`.
|
|||||||
### `isfinite`
|
### `isfinite`
|
||||||
Checks if a number is finite.
|
Checks if a number is finite.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func isfinite(n: Num -> Bool)
|
func isfinite(n: Num -> Bool)
|
||||||
```
|
```
|
||||||
@ -688,7 +664,6 @@ func isfinite(n: Num -> Bool)
|
|||||||
### `isinf`
|
### `isinf`
|
||||||
Checks if a number is infinite.
|
Checks if a number is infinite.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func isinf(n: Num -> Bool)
|
func isinf(n: Num -> Bool)
|
||||||
```
|
```
|
||||||
@ -711,7 +686,6 @@ func isinf(n: Num -> Bool)
|
|||||||
### `j0`
|
### `j0`
|
||||||
Computes the Bessel function of the first kind of order 0.
|
Computes the Bessel function of the first kind of order 0.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func j0(x: Num -> Num)
|
func j0(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -732,7 +706,6 @@ The Bessel function of the first kind of order 0 of `x`.
|
|||||||
### `j1`
|
### `j1`
|
||||||
Computes the Bessel function of the first kind of order 1.
|
Computes the Bessel function of the first kind of order 1.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func j1(x: Num -> Num)
|
func j1(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -753,7 +726,6 @@ The Bessel function of the first kind of order 1 of `x`.
|
|||||||
### `log`
|
### `log`
|
||||||
Computes the natural logarithm (base \( e \)) of a number.
|
Computes the natural logarithm (base \( e \)) of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func log(x: Num -> Num)
|
func log(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -774,7 +746,6 @@ The natural logarithm of `x`.
|
|||||||
### `log10`
|
### `log10`
|
||||||
Computes the base-10 logarithm of a number.
|
Computes the base-10 logarithm of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func log10(x: Num -> Num)
|
func log10(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -795,7 +766,6 @@ The base-10 logarithm of `x`.
|
|||||||
### `log1p`
|
### `log1p`
|
||||||
Computes \( \log(1 + x) \) for a number.
|
Computes \( \log(1 + x) \) for a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func log1p(x: Num -> Num)
|
func log1p(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -816,7 +786,6 @@ The value of \( \log(1 + x) \).
|
|||||||
### `log2`
|
### `log2`
|
||||||
Computes the base-2 logarithm of a number.
|
Computes the base-2 logarithm of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func log2(x: Num -> Num)
|
func log2(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -837,7 +806,6 @@ The base-2 logarithm of `x`.
|
|||||||
### `logb`
|
### `logb`
|
||||||
Computes the binary exponent (base-2 logarithm) of a number.
|
Computes the binary exponent (base-2 logarithm) of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func logb(x: Num -> Num)
|
func logb(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -858,7 +826,6 @@ The binary exponent of `x`.
|
|||||||
### `mix`
|
### `mix`
|
||||||
Interpolates between two numbers based on a given amount.
|
Interpolates between two numbers based on a given amount.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func mix(amount: Num, x: Num, y: Num -> Num)
|
func mix(amount: Num, x: Num, y: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -885,7 +852,6 @@ Checks if two numbers are approximately equal within specified tolerances. If
|
|||||||
two numbers are within an absolute difference or the ratio between the two is
|
two numbers are within an absolute difference or the ratio between the two is
|
||||||
small enough, they are considered near each other.
|
small enough, they are considered near each other.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func near(x: Num, y: Num, ratio: Num = 1e-9, min_epsilon: Num = 1e-9 -> Bool)
|
func near(x: Num, y: Num, ratio: Num = 1e-9, min_epsilon: Num = 1e-9 -> Bool)
|
||||||
```
|
```
|
||||||
@ -915,7 +881,6 @@ func near(x: Num, y: Num, ratio: Num = 1e-9, min_epsilon: Num = 1e-9 -> Bool)
|
|||||||
### `nextafter`
|
### `nextafter`
|
||||||
Computes the next representable value after a given number towards a specified direction.
|
Computes the next representable value after a given number towards a specified direction.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func nextafter(x: Num, y: Num -> Num)
|
func nextafter(x: Num, y: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -937,7 +902,6 @@ The next representable value after `x` in the direction of `y`.
|
|||||||
### `parse`
|
### `parse`
|
||||||
Converts a text representation of a number into a floating-point number.
|
Converts a text representation of a number into a floating-point number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func parse(text: Text -> Num?)
|
func parse(text: Text -> Num?)
|
||||||
```
|
```
|
||||||
@ -961,7 +925,6 @@ as a number.
|
|||||||
### `rint`
|
### `rint`
|
||||||
Rounds a number to the nearest integer, with ties rounded to the nearest even integer.
|
Rounds a number to the nearest integer, with ties rounded to the nearest even integer.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func rint(x: Num -> Num)
|
func rint(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -984,7 +947,6 @@ The nearest integer value of `x`.
|
|||||||
### `round`
|
### `round`
|
||||||
Rounds a number to the nearest whole number integer.
|
Rounds a number to the nearest whole number integer.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func round(x: Num -> Num)
|
func round(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -1007,7 +969,6 @@ The nearest integer value of `x`.
|
|||||||
### `scientific`
|
### `scientific`
|
||||||
Formats a number in scientific notation with a specified precision.
|
Formats a number in scientific notation with a specified precision.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func scientific(n: Num, precision: Int = 0 -> Text)
|
func scientific(n: Num, precision: Int = 0 -> Text)
|
||||||
```
|
```
|
||||||
@ -1029,7 +990,6 @@ A text representation of the number in scientific notation with the specified pr
|
|||||||
### `significand`
|
### `significand`
|
||||||
Extracts the significand (or mantissa) of a number.
|
Extracts the significand (or mantissa) of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func significand(x: Num -> Num)
|
func significand(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -1050,7 +1010,6 @@ The significand of `x`.
|
|||||||
### `sin`
|
### `sin`
|
||||||
Computes the sine of a number (angle in radians).
|
Computes the sine of a number (angle in radians).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func sin(x: Num -> Num)
|
func sin(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -1071,7 +1030,6 @@ The sine of `x`.
|
|||||||
### `sinh`
|
### `sinh`
|
||||||
Computes the hyperbolic sine of a number.
|
Computes the hyperbolic sine of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func sinh(x: Num -> Num)
|
func sinh(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -1092,7 +1050,6 @@ The hyperbolic sine of `x`.
|
|||||||
### `sqrt`
|
### `sqrt`
|
||||||
Computes the square root of a number.
|
Computes the square root of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func sqrt(x: Num -> Num)
|
func sqrt(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -1113,7 +1070,6 @@ The square root of `x`.
|
|||||||
### `tan`
|
### `tan`
|
||||||
Computes the tangent of a number (angle in radians).
|
Computes the tangent of a number (angle in radians).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func tan(x: Num -> Num)
|
func tan(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -1134,7 +1090,6 @@ The tangent of `x`.
|
|||||||
### `tanh`
|
### `tanh`
|
||||||
Computes the hyperbolic tangent of a number.
|
Computes the hyperbolic tangent of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func tanh(x: Num -> Num)
|
func tanh(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -1155,7 +1110,6 @@ The hyperbolic tangent of `x`.
|
|||||||
### `tgamma`
|
### `tgamma`
|
||||||
Computes the gamma function of a number.
|
Computes the gamma function of a number.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func tgamma(x: Num -> Num)
|
func tgamma(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -1176,7 +1130,6 @@ The gamma function of `x`.
|
|||||||
### `trunc`
|
### `trunc`
|
||||||
Truncates a number to the nearest integer towards zero.
|
Truncates a number to the nearest integer towards zero.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func trunc(x: Num -> Num)
|
func trunc(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -1199,7 +1152,6 @@ The integer part of `x` towards zero.
|
|||||||
### `y0`
|
### `y0`
|
||||||
Computes the Bessel function of the second kind of order 0.
|
Computes the Bessel function of the second kind of order 0.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func y0(x: Num -> Num)
|
func y0(x: Num -> Num)
|
||||||
```
|
```
|
||||||
@ -1220,7 +1172,6 @@ The Bessel function of the second kind of order 0 of `x`.
|
|||||||
### `y1`
|
### `y1`
|
||||||
Computes the Bessel function of the second kind of order 1.
|
Computes the Bessel function of the second kind of order 1.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func y1(x: Num -> Num)
|
func y1(x: Num -> Num)
|
||||||
```
|
```
|
||||||
|
@ -68,7 +68,6 @@ intended. Paths can be created from text with slashes using
|
|||||||
Appends the given text to the file at the specified path, creating the file if
|
Appends the given text to the file at the specified path, creating the file if
|
||||||
it doesn't already exist. Failure to write will result in a runtime error.
|
it doesn't already exist. Failure to write will result in a runtime error.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func append(path: Path, text: Text, permissions: Int32 = 0o644[32] -> Void)
|
func append(path: Path, text: Text, permissions: Int32 = 0o644[32] -> Void)
|
||||||
```
|
```
|
||||||
@ -91,7 +90,6 @@ Nothing.
|
|||||||
Appends the given bytes to the file at the specified path, creating the file if
|
Appends the given bytes to the file at the specified path, creating the file if
|
||||||
it doesn't already exist. Failure to write will result in a runtime error.
|
it doesn't already exist. Failure to write will result in a runtime error.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func append_bytes(path: Path, bytes: [Byte], permissions: Int32 = 0o644[32] -> Void)
|
func append_bytes(path: Path, bytes: [Byte], permissions: Int32 = 0o644[32] -> Void)
|
||||||
```
|
```
|
||||||
@ -113,7 +111,6 @@ Nothing.
|
|||||||
### `base_name`
|
### `base_name`
|
||||||
Returns the base name of the file or directory at the specified path.
|
Returns the base name of the file or directory at the specified path.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func base_name(path: Path -> Text)
|
func base_name(path: Path -> Text)
|
||||||
```
|
```
|
||||||
@ -135,7 +132,6 @@ The base name of the file or directory.
|
|||||||
Returns an iterator that can be used to iterate over a file one line at a time,
|
Returns an iterator that can be used to iterate over a file one line at a time,
|
||||||
or returns a null value if the file could not be opened.
|
or returns a null value if the file could not be opened.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func by_line(path: Path -> func(->Text?)?)
|
func by_line(path: Path -> func(->Text?)?)
|
||||||
```
|
```
|
||||||
@ -165,7 +161,6 @@ for line in (/dev/stdin):by_line()!:
|
|||||||
### `children`
|
### `children`
|
||||||
Returns a list of children (files and directories) within the directory at the specified path. Optionally includes hidden files.
|
Returns a list of children (files and directories) within the directory at the specified path. Optionally includes hidden files.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func children(path: Path, include_hidden=no -> [Path])
|
func children(path: Path, include_hidden=no -> [Path])
|
||||||
```
|
```
|
||||||
@ -188,7 +183,6 @@ A list of paths for the children.
|
|||||||
Creates a new directory at the specified path with the given permissions. If
|
Creates a new directory at the specified path with the given permissions. If
|
||||||
any of the parent directories do not exist, they will be created as needed.
|
any of the parent directories do not exist, they will be created as needed.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func create_directory(path: Path, permissions=0o755[32] -> Void)
|
func create_directory(path: Path, permissions=0o755[32] -> Void)
|
||||||
```
|
```
|
||||||
@ -209,7 +203,6 @@ Nothing.
|
|||||||
### `exists`
|
### `exists`
|
||||||
Checks if a file or directory exists at the specified path.
|
Checks if a file or directory exists at the specified path.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func exists(path: Path -> Bool)
|
func exists(path: Path -> Bool)
|
||||||
```
|
```
|
||||||
@ -230,7 +223,6 @@ func exists(path: Path -> Bool)
|
|||||||
### `extension`
|
### `extension`
|
||||||
Returns the file extension of the file at the specified path. Optionally returns the full extension.
|
Returns the file extension of the file at the specified path. Optionally returns the full extension.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func extension(path: Path, full=yes -> Text)
|
func extension(path: Path, full=yes -> Text)
|
||||||
```
|
```
|
||||||
@ -260,7 +252,6 @@ no file extension.
|
|||||||
### `files`
|
### `files`
|
||||||
Returns a list of files within the directory at the specified path. Optionally includes hidden files.
|
Returns a list of files within the directory at the specified path. Optionally includes hidden files.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func files(path: Path, include_hidden=no -> [Path])
|
func files(path: Path, include_hidden=no -> [Path])
|
||||||
```
|
```
|
||||||
@ -289,7 +280,6 @@ specific details:
|
|||||||
choices of patterns.
|
choices of patterns.
|
||||||
- The shell-style syntax `**` for matching subdirectories is not supported.
|
- The shell-style syntax `**` for matching subdirectories is not supported.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func glob(path: Path -> [Path])
|
func glob(path: Path -> [Path])
|
||||||
```
|
```
|
||||||
@ -325,7 +315,6 @@ A list of file paths that match the glob.
|
|||||||
### `is_directory`
|
### `is_directory`
|
||||||
Checks if the path represents a directory. Optionally follows symbolic links.
|
Checks if the path represents a directory. Optionally follows symbolic links.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func is_directory(path: Path, follow_symlinks=yes -> Bool)
|
func is_directory(path: Path, follow_symlinks=yes -> Bool)
|
||||||
```
|
```
|
||||||
@ -350,7 +339,6 @@ func is_directory(path: Path, follow_symlinks=yes -> Bool)
|
|||||||
### `is_file`
|
### `is_file`
|
||||||
Checks if the path represents a file. Optionally follows symbolic links.
|
Checks if the path represents a file. Optionally follows symbolic links.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func is_file(path: Path, follow_symlinks=yes -> Bool)
|
func is_file(path: Path, follow_symlinks=yes -> Bool)
|
||||||
```
|
```
|
||||||
@ -375,7 +363,6 @@ func is_file(path: Path, follow_symlinks=yes -> Bool)
|
|||||||
### `is_socket`
|
### `is_socket`
|
||||||
Checks if the path represents a socket. Optionally follows symbolic links.
|
Checks if the path represents a socket. Optionally follows symbolic links.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func is_socket(path: Path, follow_symlinks=yes -> Bool)
|
func is_socket(path: Path, follow_symlinks=yes -> Bool)
|
||||||
```
|
```
|
||||||
@ -397,7 +384,6 @@ func is_socket(path: Path, follow_symlinks=yes -> Bool)
|
|||||||
### `is_symlink`
|
### `is_symlink`
|
||||||
Checks if the path represents a symbolic link.
|
Checks if the path represents a symbolic link.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func is_symlink(path: Path -> Bool)
|
func is_symlink(path: Path -> Bool)
|
||||||
```
|
```
|
||||||
@ -418,7 +404,6 @@ func is_symlink(path: Path -> Bool)
|
|||||||
### `parent`
|
### `parent`
|
||||||
Returns the parent directory of the file or directory at the specified path.
|
Returns the parent directory of the file or directory at the specified path.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func parent(path: Path -> Path)
|
func parent(path: Path -> Path)
|
||||||
```
|
```
|
||||||
@ -440,7 +425,6 @@ The path of the parent directory.
|
|||||||
Reads the contents of the file at the specified path or a null value if the
|
Reads the contents of the file at the specified path or a null value if the
|
||||||
file could not be read.
|
file could not be read.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func read(path: Path -> Text?)
|
func read(path: Path -> Text?)
|
||||||
```
|
```
|
||||||
@ -466,7 +450,6 @@ raised.
|
|||||||
Reads the contents of the file at the specified path or a null value if the
|
Reads the contents of the file at the specified path or a null value if the
|
||||||
file could not be read.
|
file could not be read.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func read_bytes(path: Path -> [Byte]?)
|
func read_bytes(path: Path -> [Byte]?)
|
||||||
```
|
```
|
||||||
@ -491,7 +474,6 @@ returned.
|
|||||||
### `relative`
|
### `relative`
|
||||||
Returns the path relative to a given base path. By default, the base path is the current directory.
|
Returns the path relative to a given base path. By default, the base path is the current directory.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func relative(path: Path, relative_to=(./) -> Path)
|
func relative(path: Path, relative_to=(./) -> Path)
|
||||||
```
|
```
|
||||||
@ -513,7 +495,6 @@ The relative path.
|
|||||||
### `remove`
|
### `remove`
|
||||||
Removes the file or directory at the specified path. A runtime error is raised if something goes wrong.
|
Removes the file or directory at the specified path. A runtime error is raised if something goes wrong.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func remove(path: Path, ignore_missing=no -> Void)
|
func remove(path: Path, ignore_missing=no -> Void)
|
||||||
```
|
```
|
||||||
@ -534,7 +515,6 @@ Nothing.
|
|||||||
### `resolved`
|
### `resolved`
|
||||||
Resolves the absolute path of the given path relative to a base path. By default, the base path is the current directory.
|
Resolves the absolute path of the given path relative to a base path. By default, the base path is the current directory.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func resolved(path: Path, relative_to=(./) -> Path)
|
func resolved(path: Path, relative_to=(./) -> Path)
|
||||||
```
|
```
|
||||||
@ -559,7 +539,6 @@ The resolved absolute path.
|
|||||||
### `subdirectories`
|
### `subdirectories`
|
||||||
Returns a list of subdirectories within the directory at the specified path. Optionally includes hidden subdirectories.
|
Returns a list of subdirectories within the directory at the specified path. Optionally includes hidden subdirectories.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func subdirectories(path: Path, include_hidden=no -> [Path])
|
func subdirectories(path: Path, include_hidden=no -> [Path])
|
||||||
```
|
```
|
||||||
@ -584,7 +563,6 @@ A list of subdirectory paths.
|
|||||||
### `unique_directory`
|
### `unique_directory`
|
||||||
Generates a unique directory path based on the given path. Useful for creating temporary directories.
|
Generates a unique directory path based on the given path. Useful for creating temporary directories.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func unique_directory(path: Path -> Path)
|
func unique_directory(path: Path -> Path)
|
||||||
```
|
```
|
||||||
@ -611,7 +589,6 @@ Writes the given text to the file at the specified path, creating the file if
|
|||||||
it doesn't already exist. Sets the file permissions as specified. If the file
|
it doesn't already exist. Sets the file permissions as specified. If the file
|
||||||
writing cannot be successfully completed, a runtime error is raised.
|
writing cannot be successfully completed, a runtime error is raised.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func write(path: Path, text: Text, permissions=0o644[32] -> Void)
|
func write(path: Path, text: Text, permissions=0o644[32] -> Void)
|
||||||
```
|
```
|
||||||
@ -635,7 +612,6 @@ Writes the given bytes to the file at the specified path, creating the file if
|
|||||||
it doesn't already exist. Sets the file permissions as specified. If the file
|
it doesn't already exist. Sets the file permissions as specified. If the file
|
||||||
writing cannot be successfully completed, a runtime error is raised.
|
writing cannot be successfully completed, a runtime error is raised.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func write(path: Path, bytes: [Byte], permissions=0o644[32] -> Void)
|
func write(path: Path, bytes: [Byte], permissions=0o644[32] -> Void)
|
||||||
```
|
```
|
||||||
@ -659,7 +635,6 @@ Writes the given text to a unique file path based on the specified path. The
|
|||||||
file is created if it doesn't exist. This is useful for creating temporary
|
file is created if it doesn't exist. This is useful for creating temporary
|
||||||
files.
|
files.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func write_unique(path: Path, text: Text -> Path)
|
func write_unique(path: Path, text: Text -> Path)
|
||||||
```
|
```
|
||||||
@ -687,7 +662,6 @@ Writes the given bytes to a unique file path based on the specified path. The
|
|||||||
file is created if it doesn't exist. This is useful for creating temporary
|
file is created if it doesn't exist. This is useful for creating temporary
|
||||||
files.
|
files.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func write_unique_bytes(path: Path, bytes: [Byte] -> Path)
|
func write_unique_bytes(path: Path, bytes: [Byte] -> Path)
|
||||||
```
|
```
|
||||||
|
@ -31,7 +31,6 @@ This documentation provides details on RNG functions available in the API.
|
|||||||
### `bool`
|
### `bool`
|
||||||
Generate a random boolean value with a given probability.
|
Generate a random boolean value with a given probability.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func bool(rng: RNG, p: Num = 0.5 -> Bool)
|
func bool(rng: RNG, p: Num = 0.5 -> Bool)
|
||||||
```
|
```
|
||||||
@ -57,7 +56,6 @@ func bool(rng: RNG, p: Num = 0.5 -> Bool)
|
|||||||
### `byte`
|
### `byte`
|
||||||
Generate a random byte with uniform probability.
|
Generate a random byte with uniform probability.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func byte(rng: RNG -> Byte)
|
func byte(rng: RNG -> Byte)
|
||||||
```
|
```
|
||||||
@ -78,7 +76,6 @@ A random byte (0-255).
|
|||||||
### `bytes`
|
### `bytes`
|
||||||
Generate an array of uniformly random bytes with the given length.
|
Generate an array of uniformly random bytes with the given length.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func bytes(rng: RNG, count: Int -> [Byte])
|
func bytes(rng: RNG, count: Int -> [Byte])
|
||||||
```
|
```
|
||||||
@ -101,7 +98,6 @@ An array of length `count` random bytes with uniform random distribution (0-255)
|
|||||||
Return a copy of a random number generator. This copy will be a parallel version of
|
Return a copy of a random number generator. This copy will be a parallel version of
|
||||||
the given RNG with its own internal state.
|
the given RNG with its own internal state.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func copy(rng: RNG -> RNG)
|
func copy(rng: RNG -> RNG)
|
||||||
```
|
```
|
||||||
@ -129,7 +125,6 @@ A copy of the given RNG.
|
|||||||
### `int`, `int64`, `int32`, `int16`, `int8`
|
### `int`, `int64`, `int32`, `int16`, `int8`
|
||||||
Generate a random integer value with the given range.
|
Generate a random integer value with the given range.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func int(rng: RNG, min: Int, max: Int -> Int)
|
func int(rng: RNG, min: Int, max: Int -> Int)
|
||||||
func int64(rng: RNG, min: Int64 = Int64.min, max: Int64 = Int64.max -> Int)
|
func int64(rng: RNG, min: Int64 = Int64.min, max: Int64 = Int64.max -> Int)
|
||||||
@ -157,7 +152,6 @@ is greater than `max`, an error will be raised.
|
|||||||
### `new`
|
### `new`
|
||||||
Return a new random number generator.
|
Return a new random number generator.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func new(seed: [Byte] = (/dev/urandom):read_bytes(40)! -> RNG)
|
func new(seed: [Byte] = (/dev/urandom):read_bytes(40)! -> RNG)
|
||||||
```
|
```
|
||||||
@ -181,7 +175,6 @@ A new random number generator.
|
|||||||
### `num`, `num32`
|
### `num`, `num32`
|
||||||
Generate a random floating point value with the given range.
|
Generate a random floating point value with the given range.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func num(rng: RNG, min: Num = 0.0, max: Num = 1.0 -> Int)
|
func num(rng: RNG, min: Num = 0.0, max: Num = 1.0 -> Int)
|
||||||
func num32(rng: RNG, min: Num = 0.0_f32, max: Num = 1.0_f32 -> Int)
|
func num32(rng: RNG, min: Num = 0.0_f32, max: Num = 1.0_f32 -> Int)
|
||||||
@ -206,7 +199,6 @@ A floating point number uniformly chosen from the range `[min, max]`
|
|||||||
### `set_seed`
|
### `set_seed`
|
||||||
Set the seed for an RNG.
|
Set the seed for an RNG.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func set_seed(rng: RNG, seed: [Byte])
|
func set_seed(rng: RNG, seed: [Byte])
|
||||||
```
|
```
|
||||||
|
11
docs/sets.md
11
docs/sets.md
@ -90,7 +90,6 @@ iterating over any of the new values.
|
|||||||
### `add`
|
### `add`
|
||||||
Adds an item to the set.
|
Adds an item to the set.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func add(set:{T}, item: T -> Void)
|
func add(set:{T}, item: T -> Void)
|
||||||
```
|
```
|
||||||
@ -111,7 +110,6 @@ Nothing.
|
|||||||
### `add_all`
|
### `add_all`
|
||||||
Adds multiple items to the set.
|
Adds multiple items to the set.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func add_all(set:@{T}, items: [T] -> Void)
|
func add_all(set:@{T}, items: [T] -> Void)
|
||||||
```
|
```
|
||||||
@ -132,7 +130,6 @@ Nothing.
|
|||||||
### `clear`
|
### `clear`
|
||||||
Removes all items from the set.
|
Removes all items from the set.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func clear(set:@{T} -> Void)
|
func clear(set:@{T} -> Void)
|
||||||
```
|
```
|
||||||
@ -152,7 +149,6 @@ Nothing.
|
|||||||
### `has`
|
### `has`
|
||||||
Checks if the set contains a specified item.
|
Checks if the set contains a specified item.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func has(set:{T}, item:T -> Bool)
|
func has(set:{T}, item:T -> Bool)
|
||||||
```
|
```
|
||||||
@ -174,7 +170,6 @@ func has(set:{T}, item:T -> Bool)
|
|||||||
### `is_subset_of`
|
### `is_subset_of`
|
||||||
Checks if the set is a subset of another set.
|
Checks if the set is a subset of another set.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func (set: {T}, other: {T}, strict: Bool = no -> Bool)
|
func (set: {T}, other: {T}, strict: Bool = no -> Bool)
|
||||||
```
|
```
|
||||||
@ -197,7 +192,6 @@ func (set: {T}, other: {T}, strict: Bool = no -> Bool)
|
|||||||
### `is_superset_of`
|
### `is_superset_of`
|
||||||
Checks if the set is a superset of another set.
|
Checks if the set is a superset of another set.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func is_superset_of(set:{T}, other: {T}, strict: Bool = no -> Bool)
|
func is_superset_of(set:{T}, other: {T}, strict: Bool = no -> Bool)
|
||||||
```
|
```
|
||||||
@ -217,7 +211,6 @@ func is_superset_of(set:{T}, other: {T}, strict: Bool = no -> Bool)
|
|||||||
### `overlap`
|
### `overlap`
|
||||||
Creates a new set with items that are in both the original set and another set.
|
Creates a new set with items that are in both the original set and another set.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func overlap(set:{T}, other: {T} -> {T})
|
func overlap(set:{T}, other: {T} -> {T})
|
||||||
```
|
```
|
||||||
@ -239,7 +232,6 @@ A new set containing only items present in both sets.
|
|||||||
### `remove`
|
### `remove`
|
||||||
Removes an item from the set.
|
Removes an item from the set.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func remove(set:@{T}, item: T -> Void)
|
func remove(set:@{T}, item: T -> Void)
|
||||||
```
|
```
|
||||||
@ -260,7 +252,6 @@ Nothing.
|
|||||||
### `remove_all`
|
### `remove_all`
|
||||||
Removes multiple items from the set.
|
Removes multiple items from the set.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func remove_all(set:@{T}, items: [T] -> Void)
|
func remove_all(set:@{T}, items: [T] -> Void)
|
||||||
```
|
```
|
||||||
@ -281,7 +272,6 @@ Nothing.
|
|||||||
### `with`
|
### `with`
|
||||||
Creates a new set that is the union of the original set and another set.
|
Creates a new set that is the union of the original set and another set.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func with(set:{T}, other: {T} -> {T})
|
func with(set:{T}, other: {T} -> {T})
|
||||||
```
|
```
|
||||||
@ -303,7 +293,6 @@ A new set containing all items from both sets.
|
|||||||
### `without`
|
### `without`
|
||||||
Creates a new set with items from the original set but without items from another set.
|
Creates a new set with items from the original set but without items from another set.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func without(set:{T}, other: {T} -> {T})
|
func without(set:{T}, other: {T} -> {T})
|
||||||
```
|
```
|
||||||
|
@ -21,7 +21,6 @@ user-controlled string is automatically escaped when performing interpolation.
|
|||||||
### `by_line`
|
### `by_line`
|
||||||
Run a shell command and return an iterator over its output, line-by-line.
|
Run a shell command and return an iterator over its output, line-by-line.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func by_line(command: Shell -> Void)
|
func by_line(command: Shell -> Void)
|
||||||
```
|
```
|
||||||
@ -43,7 +42,6 @@ for line in $Shell"ping www.example.com":by_line()!:
|
|||||||
### `execute`
|
### `execute`
|
||||||
Execute a shell command without capturing its output and return its exit status.
|
Execute a shell command without capturing its output and return its exit status.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func execute(command: Shell -> Int32?)
|
func execute(command: Shell -> Int32?)
|
||||||
```
|
```
|
||||||
@ -64,7 +62,6 @@ If the command exits normally, return its exit status. Otherwise return `none`.
|
|||||||
### `run`
|
### `run`
|
||||||
Run a shell command and return the output text from `stdout`.
|
Run a shell command and return the output text from `stdout`.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func run(command: Shell -> Text?)
|
func run(command: Shell -> Text?)
|
||||||
```
|
```
|
||||||
@ -87,7 +84,6 @@ if there is a trailing newline, it will be stripped.
|
|||||||
### `run_bytes`
|
### `run_bytes`
|
||||||
Run a shell command and return the output in raw bytes from `stdout`.
|
Run a shell command and return the output in raw bytes from `stdout`.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func run(command: Shell -> [Byte]?)
|
func run(command: Shell -> [Byte]?)
|
||||||
```
|
```
|
||||||
|
@ -144,7 +144,6 @@ iterating over any of the new values.
|
|||||||
Increments the value associated with a key by a specified amount. If the key is
|
Increments the value associated with a key by a specified amount. If the key is
|
||||||
not already in the table, its value will be assumed to be zero.
|
not already in the table, its value will be assumed to be zero.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func bump(t:@{K,V}, key: K, amount: Int = 1 -> Void)
|
func bump(t:@{K,V}, key: K, amount: Int = 1 -> Void)
|
||||||
```
|
```
|
||||||
@ -170,7 +169,6 @@ t:bump("B", 10)
|
|||||||
### `clear`
|
### `clear`
|
||||||
Removes all key-value pairs from the table.
|
Removes all key-value pairs from the table.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func clear(t:@{K,V})
|
func clear(t:@{K,V})
|
||||||
```
|
```
|
||||||
@ -190,7 +188,6 @@ Nothing.
|
|||||||
### `get`
|
### `get`
|
||||||
Retrieves the value associated with a key, or returns null if the key is not present.
|
Retrieves the value associated with a key, or returns null if the key is not present.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func get(t:{K,V}, key: K -> V?)
|
func get(t:{K,V}, key: K -> V?)
|
||||||
```
|
```
|
||||||
@ -222,7 +219,6 @@ The value associated with the key or null if the key is not found.
|
|||||||
### `has`
|
### `has`
|
||||||
Checks if the table contains a specified key.
|
Checks if the table contains a specified key.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func has(t:{K,V}, key: K -> Bool)
|
func has(t:{K,V}, key: K -> Bool)
|
||||||
```
|
```
|
||||||
@ -246,7 +242,6 @@ func has(t:{K,V}, key: K -> Bool)
|
|||||||
### `remove`
|
### `remove`
|
||||||
Removes the key-value pair associated with a specified key.
|
Removes the key-value pair associated with a specified key.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func remove(t:{K,V}, key: K -> Void)
|
func remove(t:{K,V}, key: K -> Void)
|
||||||
```
|
```
|
||||||
@ -270,7 +265,6 @@ t:remove("A")
|
|||||||
### `set`
|
### `set`
|
||||||
Sets or updates the value associated with a specified key.
|
Sets or updates the value associated with a specified key.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func set(t:{K,V}, key: K, value: V -> Void)
|
func set(t:{K,V}, key: K, value: V -> Void)
|
||||||
```
|
```
|
||||||
|
35
docs/text.md
35
docs/text.md
@ -309,7 +309,6 @@ pattern documentation](patterns.md) for more details.
|
|||||||
### `as_c_string`
|
### `as_c_string`
|
||||||
Converts a `Text` value to a C-style string.
|
Converts a `Text` value to a C-style string.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func as_c_string(text: Text -> CString)
|
func as_c_string(text: Text -> CString)
|
||||||
```
|
```
|
||||||
@ -331,7 +330,6 @@ A C-style string (`CString`) representing the text.
|
|||||||
Get the graphical cluster at a given index. This is similar to `str[i]` with
|
Get the graphical cluster at a given index. This is similar to `str[i]` with
|
||||||
ASCII text, but has more correct behavior for unicode text.
|
ASCII text, but has more correct behavior for unicode text.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func at(text: Text, index: Int -> Text)
|
func at(text: Text, index: Int -> Text)
|
||||||
```
|
```
|
||||||
@ -356,7 +354,6 @@ indices are counted from the back of the text, so `-1` means the last cluster,
|
|||||||
Returns an iterator function that can be used to iterate over the lines in a
|
Returns an iterator function that can be used to iterate over the lines in a
|
||||||
text.
|
text.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func by_line(text: Text -> func(->Text?))
|
func by_line(text: Text -> func(->Text?))
|
||||||
```
|
```
|
||||||
@ -385,7 +382,6 @@ for line in text:by_line():
|
|||||||
Returns an iterator function that can be used to iterate over the occurrences
|
Returns an iterator function that can be used to iterate over the occurrences
|
||||||
of a pattern in a text.
|
of a pattern in a text.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func by_match(text: Text, pattern: Pattern -> func(->Match?))
|
func by_match(text: Text, pattern: Pattern -> func(->Match?))
|
||||||
```
|
```
|
||||||
@ -412,7 +408,6 @@ for match in text:by_match($/{alpha}/):
|
|||||||
Returns an iterator function that can be used to iterate over text separated by
|
Returns an iterator function that can be used to iterate over text separated by
|
||||||
a pattern.
|
a pattern.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func by_split(text: Text, pattern: Pattern = $// -> func(->Text?))
|
func by_split(text: Text, pattern: Pattern = $// -> func(->Text?))
|
||||||
```
|
```
|
||||||
@ -439,7 +434,6 @@ for chunk in text:by_split($/,/):
|
|||||||
Converts a `Text` value to an array of bytes representing a UTF8 encoding of
|
Converts a `Text` value to an array of bytes representing a UTF8 encoding of
|
||||||
the text.
|
the text.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func bytes(text: Text -> [Byte])
|
func bytes(text: Text -> [Byte])
|
||||||
```
|
```
|
||||||
@ -460,7 +454,6 @@ An array of bytes (`[Byte]`) representing the text in UTF8 encoding.
|
|||||||
### `codepoint_names`
|
### `codepoint_names`
|
||||||
Returns an array of the names of each codepoint in the text.
|
Returns an array of the names of each codepoint in the text.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func codepoint_names(text: Text -> [Text])
|
func codepoint_names(text: Text -> [Text])
|
||||||
```
|
```
|
||||||
@ -482,7 +475,6 @@ An array of codepoint names (`[Text]`).
|
|||||||
Iterates over each match of a [pattern](patterns.md) and passes the match to
|
Iterates over each match of a [pattern](patterns.md) and passes the match to
|
||||||
the given function.
|
the given function.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func each(text: Text, pattern: Pattern, fn: func(m: Match), recursive: Bool = yes -> Int?)
|
func each(text: Text, pattern: Pattern, fn: func(m: Match), recursive: Bool = yes -> Int?)
|
||||||
```
|
```
|
||||||
@ -508,7 +500,6 @@ None.
|
|||||||
### `ends_with`
|
### `ends_with`
|
||||||
Checks if the `Text` ends with a literal suffix text.
|
Checks if the `Text` ends with a literal suffix text.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func ends_with(text: Text, suffix: Text -> Bool)
|
func ends_with(text: Text, suffix: Text -> Bool)
|
||||||
```
|
```
|
||||||
@ -531,7 +522,6 @@ func ends_with(text: Text, suffix: Text -> Bool)
|
|||||||
Finds the first occurrence of a [pattern](patterns.md) in the given text (if
|
Finds the first occurrence of a [pattern](patterns.md) in the given text (if
|
||||||
any).
|
any).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func find(text: Text, pattern: Pattern, start: Int = 1 -> Int?)
|
func find(text: Text, pattern: Pattern, start: Int = 1 -> Int?)
|
||||||
```
|
```
|
||||||
@ -561,7 +551,6 @@ struct containing information about the match.
|
|||||||
### `find_all`
|
### `find_all`
|
||||||
Finds all occurrences of a [pattern](patterns.md) in the given text.
|
Finds all occurrences of a [pattern](patterns.md) in the given text.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func find_all(text: Text, pattern: Pattern -> [Match])
|
func find_all(text: Text, pattern: Pattern -> [Match])
|
||||||
```
|
```
|
||||||
@ -596,7 +585,6 @@ Note: if `text` or `pattern` is empty, an empty array will be returned.
|
|||||||
### `from`
|
### `from`
|
||||||
Get a slice of the text, starting at the given position.
|
Get a slice of the text, starting at the given position.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func from(text: Text, first: Int -> Text)
|
func from(text: Text, first: Int -> Text)
|
||||||
```
|
```
|
||||||
@ -626,7 +614,6 @@ Returns text that has been constructed from the given UTF8 bytes. Note: the
|
|||||||
text will be normalized, so the resulting text's UTF8 bytes may not exactly
|
text will be normalized, so the resulting text's UTF8 bytes may not exactly
|
||||||
match the input.
|
match the input.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func from_codepoint_names(codepoints: [Int32] -> [Text])
|
func from_codepoint_names(codepoints: [Int32] -> [Text])
|
||||||
```
|
```
|
||||||
@ -647,7 +634,6 @@ A new text based on the input UTF8 bytes after normalization has been applied.
|
|||||||
### `from_c_string`
|
### `from_c_string`
|
||||||
Converts a C-style string to a `Text` value.
|
Converts a C-style string to a `Text` value.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func from_c_string(str: CString -> Text)
|
func from_c_string(str: CString -> Text)
|
||||||
```
|
```
|
||||||
@ -670,7 +656,6 @@ Returns text that has the given codepoint names (according to the Unicode
|
|||||||
specification) as its codepoints. Note: the text will be normalized, so the
|
specification) as its codepoints. Note: the text will be normalized, so the
|
||||||
resulting text's codepoints may not exactly match the input codepoints.
|
resulting text's codepoints may not exactly match the input codepoints.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func from_codepoint_names(codepoint_names: [Text] -> [Text])
|
func from_codepoint_names(codepoint_names: [Text] -> [Text])
|
||||||
```
|
```
|
||||||
@ -699,7 +684,6 @@ Returns text that has been constructed from the given UTF32 codepoints. Note:
|
|||||||
the text will be normalized, so the resulting text's codepoints may not exactly
|
the text will be normalized, so the resulting text's codepoints may not exactly
|
||||||
match the input codepoints.
|
match the input codepoints.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func from_codepoint_names(codepoints: [Int32] -> [Text])
|
func from_codepoint_names(codepoints: [Int32] -> [Text])
|
||||||
```
|
```
|
||||||
@ -720,7 +704,6 @@ A new text with the specified codepoints after normalization has been applied.
|
|||||||
### `has`
|
### `has`
|
||||||
Checks if the `Text` contains a target [pattern](patterns.md).
|
Checks if the `Text` contains a target [pattern](patterns.md).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func has(text: Text, pattern: Pattern -> Bool)
|
func has(text: Text, pattern: Pattern -> Bool)
|
||||||
```
|
```
|
||||||
@ -748,7 +731,6 @@ func has(text: Text, pattern: Pattern -> Bool)
|
|||||||
### `join`
|
### `join`
|
||||||
Joins an array of text pieces with a specified glue.
|
Joins an array of text pieces with a specified glue.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func join(glue: Text, pieces: [Text] -> Text)
|
func join(glue: Text, pieces: [Text] -> Text)
|
||||||
```
|
```
|
||||||
@ -771,7 +753,6 @@ A single `Text` value with the pieces joined by the glue.
|
|||||||
Splits the text into an array of lines of text, preserving blank lines,
|
Splits the text into an array of lines of text, preserving blank lines,
|
||||||
ignoring trailing newlines, and handling `\r\n` the same as `\n`.
|
ignoring trailing newlines, and handling `\r\n` the same as `\n`.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func split(text: Text -> [Text])
|
func split(text: Text -> [Text])
|
||||||
```
|
```
|
||||||
@ -800,7 +781,6 @@ An array of substrings resulting from the split.
|
|||||||
### `lower`
|
### `lower`
|
||||||
Converts all characters in the text to lowercase.
|
Converts all characters in the text to lowercase.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func lower(text: Text -> Text)
|
func lower(text: Text -> Text)
|
||||||
```
|
```
|
||||||
@ -822,7 +802,6 @@ The lowercase version of the text.
|
|||||||
For each occurrence of the given [pattern](patterns.md), replace the text with
|
For each occurrence of the given [pattern](patterns.md), replace the text with
|
||||||
the result of calling the given function on that match.
|
the result of calling the given function on that match.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func map(text: Text, pattern: Pattern, fn: func(text:Match)->Text -> Text, recursive: Bool = yes)
|
func map(text: Text, pattern: Pattern, fn: func(text:Match)->Text -> Text, recursive: Bool = yes)
|
||||||
```
|
```
|
||||||
@ -852,7 +831,6 @@ Checks if the `Text` matches target [pattern](patterns.md) and returns an array
|
|||||||
of the matching text captures or a null value if the entire text doesn't match
|
of the matching text captures or a null value if the entire text doesn't match
|
||||||
the pattern.
|
the pattern.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func matches(text: Text, pattern: Pattern -> [Text])
|
func matches(text: Text, pattern: Pattern -> [Text])
|
||||||
```
|
```
|
||||||
@ -878,7 +856,6 @@ or a null value otherwise.
|
|||||||
### `quoted`
|
### `quoted`
|
||||||
Formats the text as a quoted string.
|
Formats the text as a quoted string.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func quoted(text: Text, color: Bool = no -> Text)
|
func quoted(text: Text, color: Bool = no -> Text)
|
||||||
```
|
```
|
||||||
@ -900,7 +877,6 @@ The text formatted as a quoted string.
|
|||||||
### `repeat`
|
### `repeat`
|
||||||
Repeat some text multiple times.
|
Repeat some text multiple times.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func repeat(text: Text, count:Int -> Text)
|
func repeat(text: Text, count:Int -> Text)
|
||||||
```
|
```
|
||||||
@ -923,7 +899,6 @@ The text repeated the given number of times.
|
|||||||
Replaces occurrences of a [pattern](patterns.md) in the text with a replacement
|
Replaces occurrences of a [pattern](patterns.md) in the text with a replacement
|
||||||
string.
|
string.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func replace(text: Text, pattern: Pattern, replacement: Text, backref: Pattern = $/\/, recursive: Bool = yes -> Text)
|
func replace(text: Text, pattern: Pattern, replacement: Text, backref: Pattern = $/\/, recursive: Bool = yes -> Text)
|
||||||
```
|
```
|
||||||
@ -989,7 +964,6 @@ on to *after* the replacement text, so replacement text is not recursively
|
|||||||
modified. See [`replace()`](#replace) for more information about replacement
|
modified. See [`replace()`](#replace) for more information about replacement
|
||||||
behavior.
|
behavior.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func replace_all(replacements:{Pattern,Text}, backref: Pattern = $/\/, recursive: Bool = yes -> Text)
|
func replace_all(replacements:{Pattern,Text}, backref: Pattern = $/\/, recursive: Bool = yes -> Text)
|
||||||
```
|
```
|
||||||
@ -1029,7 +1003,6 @@ replacement text.
|
|||||||
### `reversed`
|
### `reversed`
|
||||||
Return a text that has the grapheme clusters in reverse order.
|
Return a text that has the grapheme clusters in reverse order.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func reversed(text: Text -> Text)
|
func reversed(text: Text -> Text)
|
||||||
```
|
```
|
||||||
@ -1050,7 +1023,6 @@ A reversed version of the text.
|
|||||||
### `slice`
|
### `slice`
|
||||||
Get a slice of the text.
|
Get a slice of the text.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func slice(text: Text, from: Int = 1, to: Int = -1 -> Text)
|
func slice(text: Text, from: Int = 1, to: Int = -1 -> Text)
|
||||||
```
|
```
|
||||||
@ -1082,7 +1054,6 @@ the string.
|
|||||||
### `split`
|
### `split`
|
||||||
Splits the text into an array of substrings based on a [pattern](patterns.md).
|
Splits the text into an array of substrings based on a [pattern](patterns.md).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func split(text: Text, pattern: Pattern = "" -> [Text])
|
func split(text: Text, pattern: Pattern = "" -> [Text])
|
||||||
```
|
```
|
||||||
@ -1114,7 +1085,6 @@ An array of substrings resulting from the split.
|
|||||||
### `starts_with`
|
### `starts_with`
|
||||||
Checks if the `Text` starts with a literal prefix text.
|
Checks if the `Text` starts with a literal prefix text.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func starts_with(text: Text, prefix: Text -> Bool)
|
func starts_with(text: Text, prefix: Text -> Bool)
|
||||||
```
|
```
|
||||||
@ -1136,7 +1106,6 @@ func starts_with(text: Text, prefix: Text -> Bool)
|
|||||||
### `title`
|
### `title`
|
||||||
Converts the text to title case (capitalizing the first letter of each word).
|
Converts the text to title case (capitalizing the first letter of each word).
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func title(text: Text -> Text)
|
func title(text: Text -> Text)
|
||||||
```
|
```
|
||||||
@ -1157,7 +1126,6 @@ The text in title case.
|
|||||||
### `to`
|
### `to`
|
||||||
Get a slice of the text, ending at the given position.
|
Get a slice of the text, ending at the given position.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func to(text: Text, last: Int -> Text)
|
func to(text: Text, last: Int -> Text)
|
||||||
```
|
```
|
||||||
@ -1185,7 +1153,6 @@ the string.
|
|||||||
### `trim`
|
### `trim`
|
||||||
Trims the matching [pattern](patterns.md) from the left and/or right side of the text.
|
Trims the matching [pattern](patterns.md) from the left and/or right side of the text.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func trim(text: Text, pattern: Pattern = $/{whitespace/, trim_left: Bool = yes, trim_right: Bool = yes -> Text)
|
func trim(text: Text, pattern: Pattern = $/{whitespace/, trim_left: Bool = yes, trim_right: Bool = yes -> Text)
|
||||||
```
|
```
|
||||||
@ -1215,7 +1182,6 @@ The text without the trim pattern at either end.
|
|||||||
### `upper`
|
### `upper`
|
||||||
Converts all characters in the text to uppercase.
|
Converts all characters in the text to uppercase.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func upper(text: Text -> Text)
|
func upper(text: Text -> Text)
|
||||||
```
|
```
|
||||||
@ -1236,7 +1202,6 @@ The uppercase version of the text.
|
|||||||
### `utf32_codepoints`
|
### `utf32_codepoints`
|
||||||
Returns an array of Unicode code points for UTF32 encoding of the text.
|
Returns an array of Unicode code points for UTF32 encoding of the text.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func utf32_codepoints(text: Text -> [Int32])
|
func utf32_codepoints(text: Text -> [Int32])
|
||||||
```
|
```
|
||||||
|
@ -14,7 +14,6 @@ through [mutex-guarded datastructures](mutexed.md).
|
|||||||
### `cancel`
|
### `cancel`
|
||||||
Requests the cancellation of a specified thread.
|
Requests the cancellation of a specified thread.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func cancel(thread: Thread)
|
func cancel(thread: Thread)
|
||||||
```
|
```
|
||||||
@ -34,7 +33,6 @@ Nothing.
|
|||||||
### `detach`
|
### `detach`
|
||||||
Detaches a specified thread, allowing it to run independently.
|
Detaches a specified thread, allowing it to run independently.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func detach(thread: Thread)
|
func detach(thread: Thread)
|
||||||
```
|
```
|
||||||
@ -51,7 +49,6 @@ Nothing.
|
|||||||
### `join`
|
### `join`
|
||||||
Waits for a specified thread to terminate.
|
Waits for a specified thread to terminate.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func join(thread: Thread)
|
func join(thread: Thread)
|
||||||
```
|
```
|
||||||
@ -71,7 +68,6 @@ Nothing.
|
|||||||
### `new`
|
### `new`
|
||||||
Creates a new thread to execute a specified function.
|
Creates a new thread to execute a specified function.
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
```tomo
|
```tomo
|
||||||
func new(fn: func(->Void) -> Thread)
|
func new(fn: func(->Void) -> Thread)
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user