From 20c34833bbc105675d014c8a0a4d2b17fc787c26 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 21 Apr 2025 14:58:28 -0400 Subject: Fix old syntax in docs --- api/api.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'api/api.md') diff --git a/api/api.md b/api/api.md index a0306ae8..56105498 100644 --- a/api/api.md +++ b/api/api.md @@ -37,14 +37,14 @@ force_tty | `Bool` | Whether or not to force the use of /dev/tty. | `yes` ## exit ```tomo -exit : func(message: Text? = !Text, status: Int32 = Int32(1) -> Void) +exit : func(message: Text? = none, status: Int32 = Int32(1) -> Void) ``` Exits the program with a given status and optionally prints a message. Argument | Type | Description | Default ---------|------|-------------|--------- -message | `Text?` | If nonempty, this message will be printed (with a newline) before exiting. | `!Text` +message | `Text?` | If nonempty, this message will be printed (with a newline) before exiting. | `none` status | `Int32` | The status code that the program with exit with. | `Int32(1)` **Return:** This function never returns. @@ -786,7 +786,7 @@ Argument | Type | Description | Default list | `[T]` | The list to search through. | - target | `T` | The item to search for. | - -**Return:** The index of the first occurrence or `!Int` if not found. +**Return:** The index of the first occurrence or `none` if not found. **Example:** @@ -1113,7 +1113,7 @@ list | `[T]` | The list to be reversed. | - ## List.sample ```tomo -List.sample : func(list: [T], count: Int, weights: [Num]? = ![Num], random: func(->Num)? = none -> [T]) +List.sample : func(list: [T], count: Int, weights: [Num]? = none, random: func(->Num)? = none -> [T]) ``` Selects a sample of elements from the list, optionally with weighted probabilities. @@ -1124,7 +1124,7 @@ Argument | Type | Description | Default ---------|------|-------------|--------- list | `[T]` | The list to sample from. | - count | `Int` | The number of elements to sample. | - -weights | `[Num]?` | The probability weights for each element in the list. These values do not need to add up to any particular number, they are relative weights. If no weights are given, elements will be sampled with uniform probability. | `![Num]` +weights | `[Num]?` | The probability weights for each element in the list. These values do not need to add up to any particular number, they are relative weights. If no weights are given, elements will be sampled with uniform probability. | `none` random | `func(->Num)?` | If provided, this function will be used to get random values for sampling the list. The provided function should return random numbers between `0.0` (inclusive) and `1.0` (exclusive). (Used for deterministic pseudorandom number generation) | `none` **Return:** A list of sampled elements from the list. @@ -1317,7 +1317,7 @@ Argument | Type | Description | Default list | `[T]` | The list to search through. | - predicate | `func(item:&T -> Bool)` | A function that returns `yes` if the item's index should be returned or `no` if it should not. | - -**Return:** Returns the index of the first item where the predicate is true or `!Int` if no item matches. +**Return:** Returns the index of the first item where the predicate is true or `none` if no item matches. **Example:** -- cgit v1.2.3