aboutsummaryrefslogtreecommitdiff
path: root/api/lists.md
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-21 14:58:28 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-21 14:58:28 -0400
commit20c34833bbc105675d014c8a0a4d2b17fc787c26 (patch)
tree9e7826eea5490a8d62451401c920da6d27175718 /api/lists.md
parent3b1acb8ac5788061b90aeb9069ddecacf265f20c (diff)
Fix old syntax in docs
Diffstat (limited to 'api/lists.md')
-rw-r--r--api/lists.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/api/lists.md b/api/lists.md
index 32433bee..9c1ce5ee 100644
--- a/api/lists.md
+++ b/api/lists.md
@@ -107,7 +107,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:**
@@ -434,7 +434,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.
@@ -445,7 +445,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.
@@ -638,7 +638,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:**