diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-02-13 15:03:22 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-02-13 15:03:22 -0500 |
| commit | 5be955904682300153af0abdfd6b711b9da2ac8f (patch) | |
| tree | e616bc83904817fdefa43354fa815f13daf18739 /docs/ranges.md | |
| parent | 8e0f1fa227be762cab19234abc106ba4c572077d (diff) | |
Deprecate Range datatype in favor of using iterator methods
Diffstat (limited to 'docs/ranges.md')
| -rw-r--r-- | docs/ranges.md | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/docs/ranges.md b/docs/ranges.md deleted file mode 100644 index 799b0eb3..00000000 --- a/docs/ranges.md +++ /dev/null @@ -1,65 +0,0 @@ -# Ranges - -Ranges are Tomo's way to do iteration over numeric ranges. Ranges are typically -created using the `Int.to()` method like so: `5:to(10)`. Ranges are -*inclusive*. - -```tomo ->> [i for i in 3:to(5)] -= [3, 4, 5] -``` - ---- - -## Range Methods - -### `reversed` - -**Description:** -Returns a reversed copy of the range. - -**Signature:** -```tomo -func reversed(range: Range -> Range) -``` - -**Parameters:** - -- `range`: The range to be reversed. - -**Returns:** -A new `Range` with the order of elements reversed. - -**Example:** -```tomo ->> 1:to(5):reversed() -= Range(first=5, last=1, step=-1) -``` - ---- - -### `by` - -**Description:** -Creates a new range with a specified step value. - -**Signature:** -```tomo -func by(range: Range, step: Int -> Range) -``` - -**Parameters:** - -- `range`: The original range. -- `step`: The step value to be used in the new range. - -**Returns:** -A new `Range` that increments by the specified step value. - -**Example:** -```tomo ->> 1:to(5):by(2) -= Range(first=1, last=5, step=2) -``` - ---- |
