aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-17 22:18:21 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-17 22:18:21 -0400
commitca62aa365faee27895f8cb1eccddd7af8a7d15c9 (patch)
tree22d191de7f16c889c407ef92f27ef9efb3303998 /docs
parent80ca0f0b1ba04c1aa3d7bb1a62928dbcecbb3bd8 (diff)
Switch types to use wordier syntax `[T]` -> `List(T)` etc
Diffstat (limited to 'docs')
-rw-r--r--docs/arrays.md104
-rw-r--r--docs/command-line-parsing.md10
-rw-r--r--docs/functions.md2
-rw-r--r--docs/langs.md2
-rw-r--r--docs/mutexed.md2
-rw-r--r--docs/optionals.md2
-rw-r--r--docs/paths.md42
-rw-r--r--docs/patterns.md12
-rw-r--r--docs/pointers.md4
-rw-r--r--docs/rng.md12
-rw-r--r--docs/serialization.md4
-rw-r--r--docs/sets.md44
-rw-r--r--docs/tables.md28
-rw-r--r--docs/text.md56
14 files changed, 162 insertions, 162 deletions
diff --git a/docs/arrays.md b/docs/arrays.md
index 543e44e1..8715cf3c 100644
--- a/docs/arrays.md
+++ b/docs/arrays.md
@@ -232,38 +232,38 @@ variable or dereference a heap pointer, it may trigger copy-on-write behavior.
## Array Methods
-- [`func binary_search(arr: [T], by: func(x,y:&T->Int32) = T.compare -> Int)`](#binary_search)
-- [`func by(arr: [T], step: Int -> [T])`](#by)
-- [`func clear(arr: @[T] -> Void)`](#clear)
-- [`func counts(arr: [T] -> {T,Int})`](#counts)
-- [`func find(arr: [T], target: T -> Int?)`](#find)
-- [`func first(arr: [T], predicate: func(item:&T -> Bool) -> Int)`](#first)
-- [`func from(arr: [T], first: Int -> [T])`](#from)
-- [`func has(arr: [T] -> Bool)`](#has)
-- [`func heap_pop(arr: @[T], by: func(x,y:&T->Int32) = T.compare -> T?)`](#heap_pop)
-- [`func heap_push(arr: @[T], item: T, by=T.compare -> Void)`](#heap_push)
-- [`func heapify(arr: @[T], by: func(x,y:&T->Int32) = T.compare -> Void)`](#heapify)
-- [`func insert(arr: @[T], item: T, at: Int = 0 -> Void)`](#insert)
-- [`func insert_all(arr: @[T], items: [T], at: Int = 0 -> Void)`](#insert_all)
-- [`func pop(arr: &[T], index: Int = -1 -> T?)`](#pop)
-- [`func random(arr: [T], rng: RNG = random -> T)`](#random)
-- [`func remove_at(arr: @[T], at: Int = -1, count: Int = 1 -> Void)`](#remove_at)
-- [`func remove_item(arr: @[T], item: T, max_count: Int = -1 -> Void)`](#remove_item)
-- [`func reversed(arr: [T] -> [T])`](#reversed)
-- [`func sample(arr: [T], count: Int, weights: [Num]? = ![Num], rng: RNG = random -> [T])`](#sample)
-- [`func shuffle(arr: @[T], rng: RNG = random -> Void)`](#shuffle)
-- [`func shuffled(arr: [T], rng: RNG = random -> [T])`](#shuffled)
-- [`func slice(arr: [T], from: Int, to: Int -> [T])`](#slice)
-- [`func sort(arr: @[T], by=T.compare -> Void)`](#sort)
-- [`sorted(arr: [T], by=T.compare -> [T])`](#sorted)
-- [`to(arr: [T], last: Int -> [T])`](#to)
-- [`unique(arr: [T] -> {T})`](#unique)
+- [`func binary_search(arr:List(T), by: func(x,y:&T->Int32) = T.compare -> Int)`](#binary_search)
+- [`func by(arr:List(T), step: Int -> List(T))`](#by)
+- [`func clear(arr:@List(T) -> Void)`](#clear)
+- [`func counts(arr:List(T) -> Table(T, Int))`](#counts)
+- [`func find(arr:List(T), target: T -> Int?)`](#find)
+- [`func first(arr:List(T), predicate: func(item:&T -> Bool) -> Int)`](#first)
+- [`func from(arr:List(T), first: Int -> List(T))`](#from)
+- [`func has(arr:List(T) -> Bool)`](#has)
+- [`func heap_pop(arr:@List(T), by: func(x,y:&T->Int32) = T.compare -> T?)`](#heap_pop)
+- [`func heap_push(arr:@List(T), item: T, by=T.compare -> Void)`](#heap_push)
+- [`func heapify(arr:@List(T), by: func(x,y:&T->Int32) = T.compare -> Void)`](#heapify)
+- [`func insert(arr:@List(T), item: T, at: Int = 0 -> Void)`](#insert)
+- [`func insert_all(arr:@List(T), items:List(T), at: Int = 0 -> Void)`](#insert_all)
+- [`func pop(arr:&List(T), index: Int = -1 -> T?)`](#pop)
+- [`func random(arr:List(T), rng: RNG = random -> T)`](#random)
+- [`func remove_at(arr:@List(T), at: Int = -1, count: Int = 1 -> Void)`](#remove_at)
+- [`func remove_item(arr:@List(T), item: T, max_count: Int = -1 -> Void)`](#remove_item)
+- [`func reversed(arr:List(T) -> List(T))`](#reversed)
+- [`func sample(arr:List(T), count: Int, weights:List(Num)? = ![Num], rng: RNG = random -> List(T))`](#sample)
+- [`func shuffle(arr:@List(T), rng: RNG = random -> Void)`](#shuffle)
+- [`func shuffled(arr:List(T), rng: RNG = random -> List(T))`](#shuffled)
+- [`func slice(arr:List(T), from: Int, to: Int -> List(T))`](#slice)
+- [`func sort(arr:@List(T), by=T.compare -> Void)`](#sort)
+- [`sorted(arr:List(T), by=T.compare -> List(T))`](#sorted)
+- [`to(arr:List(T), last: Int -> List(T))`](#to)
+- [`unique(arr:List(T) -> Set(T))`](#unique)
### `binary_search`
Performs a binary search on a sorted array.
```tomo
-func binary_search(arr: [T], by: func(x,y:&T->Int32) = T.compare -> Int)
+func binary_search(arr:List(T), by: func(x,y:&T->Int32) = T.compare -> Int)
```
- `arr`: The sorted array to search.
@@ -294,7 +294,7 @@ place where it would be found if it were inserted and the array were sorted.
Creates a new array with elements spaced by the specified step value.
```tomo
-func by(arr: [T], step: Int -> [T])
+func by(arr:List(T), step: Int -> List(T))
```
- `arr`: The original array.
@@ -315,7 +315,7 @@ A new array with every `step`-th element from the original array.
Clears all elements from the array.
```tomo
-func clear(arr: @[T] -> Void)
+func clear(arr:@List(T) -> Void)
```
- `arr`: The mutable reference to the array to be cleared.
@@ -334,7 +334,7 @@ Nothing.
Counts the occurrences of each element in the array.
```tomo
-func counts(arr: [T] -> {T,Int})
+func counts(arr:List(T) -> Table(T, Int))
```
- `arr`: The array to count elements in.
@@ -354,7 +354,7 @@ A table mapping each element to its count.
Finds the index of the first occurrence of an element (if any).
```tomo
-func find(arr: [T], target: T -> Int?)
+func find(arr:List(T), target: T -> Int?)
```
- `arr`: The array to search through.
@@ -378,7 +378,7 @@ The index of the first occurrence or `!Int` if not found.
Find the index of the first item that matches a predicate function (if any).
```tomo
-func first(arr: [T], predicate: func(item:&T -> Bool) -> Int)
+func first(arr:List(T), predicate: func(item:&T -> Bool) -> Int)
```
- `arr`: The array to search through.
@@ -403,7 +403,7 @@ item matches.
Returns a slice of the array starting from a specified index.
```tomo
-func from(arr: [T], first: Int -> [T])
+func from(arr:List(T), first: Int -> List(T))
```
- `arr`: The original array.
@@ -424,7 +424,7 @@ A new array starting from the specified index.
Checks if the array has any elements.
```tomo
-func has(arr: [T] -> Bool)
+func has(arr:List(T) -> Bool)
```
- `arr`: The array to check.
@@ -445,7 +445,7 @@ 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.
```tomo
-func heap_pop(arr: @[T], by: func(x,y:&T->Int32) = T.compare -> T?)
+func heap_pop(arr:@List(T), by: func(x,y:&T->Int32) = T.compare -> T?)
```
- `arr`: The mutable reference to the heap.
@@ -470,7 +470,7 @@ Adds an element to the heap and maintains the heap property. By default, this
is a *minimum* heap.
```tomo
-func heap_push(arr: @[T], item: T, by=T.compare -> Void)
+func heap_push(arr:@List(T), item: T, by=T.compare -> Void)
```
- `arr`: The mutable reference to the heap.
@@ -492,7 +492,7 @@ Nothing.
Converts an array into a heap.
```tomo
-func heapify(arr: @[T], by: func(x,y:&T->Int32) = T.compare -> Void)
+func heapify(arr:@List(T), by: func(x,y:&T->Int32) = T.compare -> Void)
```
- `arr`: The mutable reference to the array to be heapified.
@@ -514,7 +514,7 @@ Nothing.
Inserts an element at a specified position in the array.
```tomo
-func insert(arr: @[T], item: T, at: Int = 0 -> Void)
+func insert(arr:@List(T), item: T, at: Int = 0 -> Void)
```
- `arr`: The mutable reference to the array.
@@ -544,7 +544,7 @@ Nothing.
Inserts an array of items at a specified position in the array.
```tomo
-func insert_all(arr: @[T], items: [T], at: Int = 0 -> Void)
+func insert_all(arr:@List(T), items:List(T), at: Int = 0 -> Void)
```
- `arr`: The mutable reference to the array.
@@ -576,7 +576,7 @@ the array, the item at that index will be removed and the array will become one
element shorter.
```tomo
-func pop(arr: &[T], index: Int = -1 -> T?)
+func pop(arr:&List(T), index: Int = -1 -> T?)
```
- `arr`: The array to remove an item from.
@@ -607,7 +607,7 @@ otherwise the item at the given index.
Selects a random element from the array.
```tomo
-func random(arr: [T], rng: RNG = random -> T)
+func random(arr:List(T), rng: RNG = random -> T)
```
- `arr`: The array from which to select a random element.
@@ -628,7 +628,7 @@ A random element from the array.
Removes elements from the array starting at a specified index.
```tomo
-func remove_at(arr: @[T], at: Int = -1, count: Int = 1 -> Void)
+func remove_at(arr:@List(T), at: Int = -1, count: Int = 1 -> Void)
```
- `arr`: The mutable reference to the array.
@@ -656,7 +656,7 @@ arr:remove_at(2, count=2)
Removes all occurrences of a specified item from the array.
```tomo
-func remove_item(arr: @[T], item: T, max_count: Int = -1 -> Void)
+func remove_item(arr:@List(T), item: T, max_count: Int = -1 -> Void)
```
- `arr`: The mutable reference to the array.
@@ -684,7 +684,7 @@ arr:remove_item(20, max_count=1)
Returns a reversed slice of the array.
```tomo
-func reversed(arr: [T] -> [T])
+func reversed(arr:List(T) -> List(T))
```
- `arr`: The array to be reversed.
@@ -705,7 +705,7 @@ Selects a sample of elements from the array, optionally with weighted
probabilities.
```tomo
-func sample(arr: [T], count: Int, weights: [Num]? = ![Num], rng: RNG = random -> [T])
+func sample(arr:List(T), count: Int, weights:List(Num)? = ![Num], rng: RNG = random -> List(T))
```
- `arr`: The array to sample from.
@@ -739,7 +739,7 @@ A list of sampled elements from the array.
Shuffles the elements of the array in place.
```tomo
-func shuffle(arr: @[T], rng: RNG = random -> Void)
+func shuffle(arr:@List(T), rng: RNG = random -> Void)
```
- `arr`: The mutable reference to the array to be shuffled.
@@ -759,7 +759,7 @@ Nothing.
Creates a new array with elements shuffled.
```tomo
-func shuffled(arr: [T], rng: RNG = random -> [T])
+func shuffled(arr:List(T), rng: RNG = random -> List(T))
```
- `arr`: The array to be shuffled.
@@ -780,7 +780,7 @@ A new array with shuffled elements.
Returns a slice of the array spanning the given indices (inclusive).
```tomo
-func slice(arr: [T], from: Int, to: Int -> [T])
+func slice(arr:List(T), from: Int, to: Int -> List(T))
```
- `arr`: The original array.
@@ -807,7 +807,7 @@ second-to-last, and so on.
Sorts the elements of the array in place in ascending order (small to large).
```tomo
-func sort(arr: @[T], by=T.compare -> Void)
+func sort(arr:@List(T), by=T.compare -> Void)
```
- `arr`: The mutable reference to the array to be sorted.
@@ -835,7 +835,7 @@ arr:sort(func(a,b:&Int): a:abs() <> b:abs())
Creates a new array with elements sorted.
```tomo
-sorted(arr: [T], by=T.compare -> [T])
+sorted(arr:List(T), by=T.compare -> List(T))
```
- `arr`: The array to be sorted.
@@ -860,7 +860,7 @@ A new array with sorted elements.
Returns a slice of the array from the start of the original array up to a specified index (inclusive).
```tomo
-to(arr: [T], last: Int -> [T])
+to(arr:List(T), last: Int -> List(T))
```
- `arr`: The original array.
@@ -884,7 +884,7 @@ A new array containing elements from the start up to the specified index.
Returns a Set that contains the unique elements of the array.
```tomo
-unique(arr: [T] -> {T})
+unique(arr:List(T) -> Set(T))
```
- `arr`: The array to process.
diff --git a/docs/command-line-parsing.md b/docs/command-line-parsing.md
index 127cf232..230105d5 100644
--- a/docs/command-line-parsing.md
+++ b/docs/command-line-parsing.md
@@ -104,20 +104,20 @@ Array-of-text arguments can be passed like this:
```tomo
# many-texts.tm
-func main(args:[Text]):
+func main(args:List(Text)):
>> args
```
```bash
$ tomo many-texts.tm
->> [] : [Text]
+>> [] :List(Text)
$ tomo many-texts.tm one two three
->> ["one", "two", "three"] : [Text]
+>> ["one", "two", "three"] :List(Text)
$ tomo many-texts.tm --args=one,two,three
->> ["one", "two", "three"] : [Text]
+>> ["one", "two", "three"] :List(Text)
$ tomo many-texts.tm -- one --not-a-flag 'a space'
->> ["one", "--not-a-flag", "a space"] : [Text]
+>> ["one", "--not-a-flag", "a space"] :List(Text)
```
diff --git a/docs/functions.md b/docs/functions.md
index edd1261a..3cb37875 100644
--- a/docs/functions.md
+++ b/docs/functions.md
@@ -98,7 +98,7 @@ evicted if the cache has reached the maximum size and needs to insert a new
entry:
```tomo
-func doop(x:Int, y:Text, z:[Int]; cache_size=100 -> Text):
+func doop(x:Int, y:Text, z:List(Int); cache_size=100 -> Text):
return "x=$x y=$y z=$z"
```
diff --git a/docs/langs.md b/docs/langs.md
index 0e6242db..b2709db8 100644
--- a/docs/langs.md
+++ b/docs/langs.md
@@ -100,6 +100,6 @@ struct Foo(x,y:Int):
convert(f:Foo -> Sh):
return Sh.from_text("$(f.x),$(f.y)")
-convert(texts:[Text] -> Sh):
+convert(texts:List(Text) -> Sh):
return $Sh" ":join([Sh(t) for t in texts])
```
diff --git a/docs/mutexed.md b/docs/mutexed.md
index 97357f39..06e16b6b 100644
--- a/docs/mutexed.md
+++ b/docs/mutexed.md
@@ -17,7 +17,7 @@ nums := mutexed [10, 20, 30]
holding nums:
# Inside this block, the type of `nums` is `&[Int]`
>> nums
- = &[10, 20, 30] : &[Int]
+ = &[10, 20, 30] :&List(Int)
thread := Thread.new(func():
holding nums:
diff --git a/docs/optionals.md b/docs/optionals.md
index 84f886b7..fbd7bac7 100644
--- a/docs/optionals.md
+++ b/docs/optionals.md
@@ -115,7 +115,7 @@ maybe_x = !Int
>> maybe_x or fail("No value!")
# Failure!
-func do_stuff(matches:[Text]):
+func do_stuff(matches:List(Text)):
pass
for line in lines:
diff --git a/docs/paths.md b/docs/paths.md
index cb4bb055..9d80244b 100644
--- a/docs/paths.md
+++ b/docs/paths.md
@@ -39,7 +39,7 @@ intended. Paths can be created from text with slashes using
- [`func accessed(path:Path, follow_symlinks=yes -> Moment?)`](#accessed)
- [`func append(path: Path, text: Text, permissions: Int32 = 0o644[32] -> Void)`](#append)
-- [`func append_bytes(path: Path, bytes: [Byte], permissions: Int32 = 0o644[32] -> Void)`](#append_bytes)
+- [`func append_bytes(path: Path, bytes:List(Byte), permissions: Int32 = 0o644[32] -> Void)`](#append_bytes)
- [`func base_name(path: Path -> Text)`](#base_name)
- [`func by_line(path: Path -> func(->Text?)?)`](#by_line)
- [`func can_execute(path:Path -> Bool)`](#can_execute)
@@ -47,14 +47,14 @@ intended. Paths can be created from text with slashes using
- [`func can_write(path:Path -> Bool)`](#can_write)
- [`func changed(path:Path, follow_symlinks=yes -> Moment?)`](#changed)
- [`func child(path: Path, child:Text -> Path)`](#child)
-- [`func children(path: Path, include_hidden=no -> [Path])`](#children)
+- [`func children(path: Path, include_hidden=no -> List(Path))`](#children)
- [`func create_directory(path: Path, permissions=0o755[32] -> Void)`](#create_directory)
- [`func exists(path: Path -> Bool)`](#exists)
- [`func expand_home(path: Path -> Path)`](#expand_home)
- [`func extension(path: Path, full=yes -> Text)`](#extension)
-- [`func files(path: Path, include_hidden=no -> [Path])`](#files)
-- [`func from_components(components:[Text] -> Path)`](#from_components)
-- [`func glob(path: Path -> [Path])`](#glob)
+- [`func files(path: Path, include_hidden=no -> List(Path))`](#files)
+- [`func from_components(components:List(Text) -> Path)`](#from_components)
+- [`func glob(path: Path -> List(Path))`](#glob)
- [`func group(path: Path, follow_symlinks=yes -> Text?)`](#group)
- [`func is_directory(path: Path, follow_symlinks=yes -> Bool)`](#is_directory)
- [`func is_file(path: Path, follow_symlinks=yes -> Bool)`](#is_file)
@@ -64,17 +64,17 @@ intended. Paths can be created from text with slashes using
- [`func owner(path: Path, follow_symlinks=yes -> Text?)`](#owner)
- [`func parent(path: Path -> Path)`](#parent)
- [`func read(path: Path -> Text?)`](#read)
-- [`func read_bytes(path: Path -> [Byte]?)`](#read_bytes)
+- [`func read_bytes(path: Path -> List(Byte)?)`](#read_bytes)
- [`func relative_to(path: Path, relative_to=(./) -> Path)`](#relative_to)
- [`func remove(path: Path, ignore_missing=no -> Void)`](#remove)
- [`func resolved(path: Path, relative_to=(./) -> Path)`](#resolved)
- [`func set_owner(path:Path, owner=none:Text, group=none:Text, follow_symlinks=yes)`](#set_owner)
-- [`func subdirectories(path: Path, include_hidden=no -> [Path])`](#subdirectories)
+- [`func subdirectories(path: Path, include_hidden=no -> List(Path))`](#subdirectories)
- [`func unique_directory(path: Path -> Path)`](#unique_directory)
- [`func write(path: Path, text: Text, permissions=0o644[32] -> Void)`](#write)
-- [`func write_bytes(path: Path, bytes: [Byte], permissions=0o644[32] -> Void)`](#write_bytes)
+- [`func write_bytes(path: Path, bytes:List(Byte), permissions=0o644[32] -> Void)`](#write_bytes)
- [`func write_unique(path: Path, text: Text -> Path)`](#write_unique)
-- [`func write_unique_bytes(path: Path, bytes: [Byte] -> Path)`](#write_unique_bytes)
+- [`func write_unique_bytes(path: Path, bytes:List(Byte) -> Path)`](#write_unique_bytes)
### `accessed`
Gets the file access time of a file.
@@ -127,7 +127,7 @@ 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.
```tomo
-func append_bytes(path: Path, bytes: [Byte], permissions: Int32 = 0o644[32] -> Void)
+func append_bytes(path: Path, bytes:List(Byte), permissions: Int32 = 0o644[32] -> Void)
```
- `path`: The path of the file to append to.
@@ -298,7 +298,7 @@ changed, or `none` if no such file or directory exists.
Return a path that is a child of another path.
```tomo
-func child(path: Path, child: Text -> [Path])
+func child(path: Path, child: Text -> List(Path))
```
- `path`: The path of a directory.
@@ -319,7 +319,7 @@ A new path representing the child.
Returns a list of children (files and directories) within the directory at the specified path. Optionally includes hidden files.
```tomo
-func children(path: Path, include_hidden=no -> [Path])
+func children(path: Path, include_hidden=no -> List(Path))
```
- `path`: The path of the directory.
@@ -434,7 +434,7 @@ no file extension.
Returns a list of files within the directory at the specified path. Optionally includes hidden files.
```tomo
-func files(path: Path, include_hidden: Bool = no -> [Path])
+func files(path: Path, include_hidden: Bool = no -> List(Path))
```
- `path`: The path of the directory.
@@ -455,7 +455,7 @@ A list of file paths.
Returns a path built from an array of path components.
```tomo
-func from_components(components: [Text] -> Path)
+func from_components(components:List(Text) -> Path)
```
- `components`: An array of path components.
@@ -486,7 +486,7 @@ specific details:
- The shell-style syntax `**` for matching subdirectories is not supported.
```tomo
-func glob(path: Path -> [Path])
+func glob(path: Path -> List(Path))
```
- `path`: The path of the directory which may contain special globbing characters
@@ -726,7 +726,7 @@ Reads the contents of the file at the specified path or a null value if the
file could not be read.
```tomo
-func read_bytes(path: Path -> [Byte]?)
+func read_bytes(path: Path -> List(Byte)?)
```
- `path`: The path of the file to read.
@@ -738,10 +738,10 @@ returned.
**Example:**
```tomo
>> (./hello.txt):read()
-= [72[B], 101[B], 108[B], 108[B], 111[B]] : [Byte]?
+= [72[B], 101[B], 108[B], 108[B], 111[B]] :List(Byte)?
>> (./nosuchfile.xxx):read()
-= none : [Byte]?
+= none :List(Byte)?
```
---
@@ -837,7 +837,7 @@ Nothing. If a path does not exist, a failure will be raised.
Returns a list of subdirectories within the directory at the specified path. Optionally includes hidden subdirectories.
```tomo
-func subdirectories(path: Path, include_hidden=no -> [Path])
+func subdirectories(path: Path, include_hidden=no -> List(Path))
```
- `path`: The path of the directory.
@@ -910,7 +910,7 @@ it doesn't already exist. Sets the file permissions as specified. If the file
writing cannot be successfully completed, a runtime error is raised.
```tomo
-func write(path: Path, bytes: [Byte], permissions=0o644[32] -> Void)
+func write(path: Path, bytes:List(Byte), permissions=0o644[32] -> Void)
```
- `path`: The path of the file to write to.
@@ -960,7 +960,7 @@ file is created if it doesn't exist. This is useful for creating temporary
files.
```tomo
-func write_unique_bytes(path: Path, bytes: [Byte] -> Path)
+func write_unique_bytes(path: Path, bytes:List(Byte) -> Path)
```
- `path`: The base path for generating the unique file. This path must include
diff --git a/docs/patterns.md b/docs/patterns.md
index 728b978e..c14ca23f 100644
--- a/docs/patterns.md
+++ b/docs/patterns.md
@@ -22,13 +22,13 @@ functions that would normally be handled by a more extensive API:
Text.has(pattern:Pattern -> Bool)
Text.each(pattern:Pattern, fn:func(m:Match), recursive=yes -> Text)
Text.find(pattern:Pattern, start=1 -> Match?)
-Text.find_all(pattern:Pattern -> [Match])
-Text.matches(pattern:Pattern -> [Text]?)
+Text.find_all(pattern:Pattern -> List(Match))
+Text.matches(pattern:Pattern -> List(Text)?)
Text.map(pattern:Pattern, fn:func(m:Match -> Text), recursive=yes -> Text)
-Text.replace(pattern:Pattern, replacement:Text, placeholder:Pattern=$//, recursive=yes -> [Text])
-Text.replace_all(replacements:{Pattern,Text}, placeholder:Pattern=$//, recursive=yes -> [Text])
-Text.split(pattern:Pattern -> [Text])
-Text.trim(pattern=$/{whitespace}/, trim_left=yes, trim_right=yes -> [Text])
+Text.replace(pattern:Pattern, replacement:Text, placeholder:Pattern=$//, recursive=yes -> List(Text))
+Text.replace_all(replacements:Table(Pattern, Text), placeholder:Pattern=$//, recursive=yes -> List(Text))
+Text.split(pattern:Pattern -> List(Text))
+Text.trim(pattern=$/{whitespace}/, trim_left=yes, trim_right=yes -> List(Text))
```
## Matches
diff --git a/docs/pointers.md b/docs/pointers.md
index f1bd1b5a..5cada7c6 100644
--- a/docs/pointers.md
+++ b/docs/pointers.md
@@ -12,7 +12,7 @@ a new, different value and assigning it to a pointer's memory location to
replace the value that previously resided there.
```tomo
-func no_mutation_possible(nums:[Int]):
+func no_mutation_possible(nums:List(Int)):
nums[1] = 10 // This performs a copy-on-write and creates a new array
// The new array is only accessible as a local variable here
...
@@ -21,7 +21,7 @@ no_mutation_possible(my_nums)
>> my_nums
= [0, 1, 2]
-func do_mutation(nums:@[Int]):
+func do_mutation(nums:@List(Int)):
nums[1] = 10 // The mutates the value at the given pointer's location
...
my_nums := @[0, 1, 2]
diff --git a/docs/rng.md b/docs/rng.md
index 90c75362..398215c0 100644
--- a/docs/rng.md
+++ b/docs/rng.md
@@ -21,12 +21,12 @@ This documentation provides details on RNG functions available in the API.
- [`func bool(rng: RNG, p: Num = 0.5 -> Bool)`](#bool)
- [`func byte(rng: RNG -> Byte)`](#byte)
-- [`func bytes(rng: RNG, count: Int -> [Byte])`](#bytes)
+- [`func bytes(rng: RNG, count: Int -> List(Byte))`](#bytes)
- [`func copy(rng: RNG -> RNG)`](#copy)
- [`func int(rng: RNG, min: Int, max: Int -> Int)`](#int`, `int64`, `int32`, `int16`, `int8)
-- [`func new(seed: [Byte] = (/dev/urandom):read_bytes(40)! -> RNG)`](#new)
+- [`func new(seed:List(Byte) = (/dev/urandom):read_bytes(40)! -> RNG)`](#new)
- [`func num(rng: RNG, min: Num = 0.0, max: Num = 1.0 -> Int)`](#num`, `num32)
-- [`func set_seed(rng: RNG, seed: [Byte])`](#set_seed)
+- [`func set_seed(rng: RNG, seed:List(Byte))`](#set_seed)
### `bool`
Generate a random boolean value with a given probability.
@@ -77,7 +77,7 @@ A random byte (0-255).
Generate an array of uniformly random bytes with the given length.
```tomo
-func bytes(rng: RNG, count: Int -> [Byte])
+func bytes(rng: RNG, count: Int -> List(Byte))
```
- `rng`: The random number generator to use.
@@ -153,7 +153,7 @@ is greater than `max`, an error will be raised.
Return a new random number generator.
```tomo
-func new(seed: [Byte] = (/dev/urandom):read_bytes(40)! -> RNG)
+func new(seed:List(Byte) = (/dev/urandom):read_bytes(40)! -> RNG)
```
- `seed`: The seed use for the random number generator. A seed length of 40
@@ -200,7 +200,7 @@ A floating point number uniformly chosen from the range `[min, max]`
Set the seed for an RNG.
```tomo
-func set_seed(rng: RNG, seed: [Byte])
+func set_seed(rng: RNG, seed:List(Byte))
```
- `rng`: The random number generator to modify.
diff --git a/docs/serialization.md b/docs/serialization.md
index 764a6b27..af100c92 100644
--- a/docs/serialization.md
+++ b/docs/serialization.md
@@ -16,7 +16,7 @@ will return an array of bytes that encode the value's data:
```tomo
value := Int64(5)
>> serialized := value:serialized()
-= [0x0A] : [Byte]
+= [0x0A] : List(Byte)
```
Serialization produces a fairly compact representation of data as a flat array
@@ -59,7 +59,7 @@ c.next = @Cycle("B", next=c)
>> c
= @Cycle(name="A", next=@Cycle(name="B", next=@~1))
>> serialized := c:serialized()
-= [0x02, 0x02, 0x41, 0x01, 0x04, 0x02, 0x42, 0x01, 0x02] : [Byte]
+= [0x02, 0x02, 0x41, 0x01, 0x04, 0x02, 0x42, 0x01, 0x02] : List(Byte)
>> roundtrip := DESERIALIZE(serialized):@Cycle
= @Cycle(name="A", next=@Cycle(name="B", next=@~1)) : @Cycle
```
diff --git a/docs/sets.md b/docs/sets.md
index 778740a3..a7c88d0e 100644
--- a/docs/sets.md
+++ b/docs/sets.md
@@ -75,23 +75,23 @@ iterating over any of the new values.
## Set Methods
-- [`func add(set:{T}, item: T -> Void)`](#add)
-- [`func add_all(set:@{T}, items: [T] -> Void)`](#add_all)
-- [`func clear(set:@{T} -> Void)`](#clear)
-- [`func has(set:{T}, item:T -> Bool)`](#has)
-- [`func (set: {T}, other: {T}, strict: Bool = no -> Bool)`](#is_subset_of)
-- [`func is_superset_of(set:{T}, other: {T}, strict: Bool = no -> Bool)`](#is_superset_of)
-- [`func overlap(set:{T}, other: {T} -> {T})`](#overlap)
-- [`func remove(set:@{T}, item: T -> Void)`](#remove)
-- [`func remove_all(set:@{T}, items: [T] -> Void)`](#remove_all)
-- [`func with(set:{T}, other: {T} -> {T})`](#with)
-- [`func without(set:{T}, other: {T} -> {T})`](#without)
+- [`func add(set:Set(T), item: T -> Void)`](#add)
+- [`func add_all(set:@Set(T), items:List(T) -> Void)`](#add_all)
+- [`func clear(set:@Set(T) -> Void)`](#clear)
+- [`func has(set:Set(T), item:T -> Bool)`](#has)
+- [`func (set:Set(T), other:Set(T), strict: Bool = no -> Bool)`](#is_subset_of)
+- [`func is_superset_of(set:Set(T), other:Set(T), strict: Bool = no -> Bool)`](#is_superset_of)
+- [`func overlap(set:Set(T), other:Set(T) -> Set(T))`](#overlap)
+- [`func remove(set:@Set(T), item: T -> Void)`](#remove)
+- [`func remove_all(set:@Set(T), items:List(T) -> Void)`](#remove_all)
+- [`func with(set:Set(T), other:Set(T) -> Set(T))`](#with)
+- [`func without(set:Set(T), other:Set(T) -> Set(T))`](#without)
### `add`
Adds an item to the set.
```tomo
-func add(set:{T}, item: T -> Void)
+func add(set:Set(T), item: T -> Void)
```
- `set`: The mutable reference to the set.
@@ -111,7 +111,7 @@ Nothing.
Adds multiple items to the set.
```tomo
-func add_all(set:@{T}, items: [T] -> Void)
+func add_all(set:@Set(T), items:List(T) -> Void)
```
- `set`: The mutable reference to the set.
@@ -131,7 +131,7 @@ Nothing.
Removes all items from the set.
```tomo
-func clear(set:@{T} -> Void)
+func clear(set:@Set(T) -> Void)
```
- `set`: The mutable reference to the set.
@@ -150,7 +150,7 @@ Nothing.
Checks if the set contains a specified item.
```tomo
-func has(set:{T}, item:T -> Bool)
+func has(set:Set(T), item:T -> Bool)
```
- `set`: The set to check.
@@ -171,7 +171,7 @@ func has(set:{T}, item:T -> Bool)
Checks if the set is a subset of another set.
```tomo
-func (set: {T}, other: {T}, strict: Bool = no -> Bool)
+func (set:Set(T), other:Set(T), strict: Bool = no -> Bool)
```
- `set`: The set to check.
@@ -193,7 +193,7 @@ func (set: {T}, other: {T}, strict: Bool = no -> Bool)
Checks if the set is a superset of another set.
```tomo
-func is_superset_of(set:{T}, other: {T}, strict: Bool = no -> Bool)
+func is_superset_of(set:Set(T), other:Set(T), strict: Bool = no -> Bool)
```
- `set`: The set to check.
@@ -212,7 +212,7 @@ func is_superset_of(set:{T}, other: {T}, strict: Bool = no -> Bool)
Creates a new set with items that are in both the original set and another set.
```tomo
-func overlap(set:{T}, other: {T} -> {T})
+func overlap(set:Set(T), other:Set(T) -> Set(T))
```
- `set`: The original set.
@@ -233,7 +233,7 @@ A new set containing only items present in both sets.
Removes an item from the set.
```tomo
-func remove(set:@{T}, item: T -> Void)
+func remove(set:@Set(T), item: T -> Void)
```
- `set`: The mutable reference to the set.
@@ -253,7 +253,7 @@ Nothing.
Removes multiple items from the set.
```tomo
-func remove_all(set:@{T}, items: [T] -> Void)
+func remove_all(set:@Set(T), items:List(T) -> Void)
```
- `set`: The mutable reference to the set.
@@ -273,7 +273,7 @@ Nothing.
Creates a new set that is the union of the original set and another set.
```tomo
-func with(set:{T}, other: {T} -> {T})
+func with(set:Set(T), other:Set(T) -> Set(T))
```
- `set`: The original set.
@@ -294,7 +294,7 @@ A new set containing all items from both sets.
Creates a new set with items from the original set but without items from another set.
```tomo
-func without(set:{T}, other: {T} -> {T})
+func without(set:Set(T), other:Set(T) -> Set(T))
```
- `set`: The original set.
diff --git a/docs/tables.md b/docs/tables.md
index 42af25d4..78c91c5d 100644
--- a/docs/tables.md
+++ b/docs/tables.md
@@ -75,9 +75,9 @@ table value:
```tomo
>> t2.fallback
-= {"A"=10} : {Text,Int}?
+= {"A"=10} : Table(Text, Int)?
>> t.fallback
-= none : {Text,Int}?
+= none : Table(Text, Int)?
```
## Setting Values
@@ -133,19 +133,19 @@ iterating over any of the new values.
## Table Methods
-- [`func bump(t:@{K,V}, key: K, amount: Int = 1 -> Void)`](#bump)
-- [`func clear(t:@{K,V})`](#clear)
-- [`func get(t:{K,V}, key: K -> V?)`](#get)
-- [`func has(t:{K,V}, key: K -> Bool)`](#has)
-- [`func remove(t:{K,V}, key: K -> Void)`](#remove)
-- [`func set(t:{K,V}, key: K, value: V -> Void)`](#set)
+- [`func bump(t:@Table(K,V), key: K, amount: Int = 1 -> Void)`](#bump)
+- [`func clear(t:@Table(K,V))`](#clear)
+- [`func get(t:Table(K, V), key: K -> V?)`](#get)
+- [`func has(t:Table(K, V), key: K -> Bool)`](#has)
+- [`func remove(t:Table(K, V), key: K -> Void)`](#remove)
+- [`func set(t:Table(K, V), key: K, value: V -> Void)`](#set)
### `bump`
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.
```tomo
-func bump(t:@{K,V}, key: K, amount: Int = 1 -> Void)
+func bump(t:@Table(K,V), key: K, amount: Int = 1 -> Void)
```
- `t`: The reference to the table.
@@ -170,7 +170,7 @@ t:bump("B", 10)
Removes all key-value pairs from the table.
```tomo
-func clear(t:@{K,V})
+func clear(t:@Table(K,V))
```
- `t`: The reference to the table.
@@ -189,7 +189,7 @@ Nothing.
Retrieves the value associated with a key, or returns null if the key is not present.
```tomo
-func get(t:{K,V}, key: K -> V?)
+func get(t:Table(K, V), key: K -> V?)
```
- `t`: The table.
@@ -220,7 +220,7 @@ The value associated with the key or null if the key is not found.
Checks if the table contains a specified key.
```tomo
-func has(t:{K,V}, key: K -> Bool)
+func has(t:Table(K, V), key: K -> Bool)
```
- `t`: The table.
@@ -243,7 +243,7 @@ func has(t:{K,V}, key: K -> Bool)
Removes the key-value pair associated with a specified key.
```tomo
-func remove(t:{K,V}, key: K -> Void)
+func remove(t:Table(K, V), key: K -> Void)
```
- `t`: The reference to the table.
@@ -266,7 +266,7 @@ t:remove("A")
Sets or updates the value associated with a specified key.
```tomo
-func set(t:{K,V}, key: K, value: V -> Void)
+func set(t:Table(K, V), key: K, value: V -> Void)
```
- `t`: The reference to the table.
diff --git a/docs/text.md b/docs/text.md
index 79fc5dd5..1467a9e4 100644
--- a/docs/text.md
+++ b/docs/text.md
@@ -275,31 +275,31 @@ pattern documentation](patterns.md) for more details.
- [`func by_line(text: Text -> func(->Text?))`](#by_line)
- [`func by_match(text: Text, pattern: Pattern -> func(->Match?))`](#by_match)
- [`func by_split(text: Text, pattern: Pattern = $// -> func(->Text?))`](#by_split)
-- [`func bytes(text: Text -> [Byte])`](#bytes)
+- [`func bytes(text: Text -> List(Byte))`](#bytes)
- [`func caseless_equals(a: Text, b:Text, language:Text = "C" -> Bool)`](#caseless_equals)
-- [`func codepoint_names(text: Text -> [Text])`](#codepoint_names)
+- [`func codepoint_names(text: Text -> List(Text))`](#codepoint_names)
- [`func each(text: Text, pattern: Pattern, fn: func(m: Match), recursive: Bool = yes -> Int?)`](#each)
- [`func ends_with(text: Text, suffix: Text -> Bool)`](#ends_with)
- [`func find(text: Text, pattern: Pattern, start: Int = 1 -> Int?)`](#find)
-- [`func find_all(text: Text, pattern: Pattern -> [Match])`](#find_all)
+- [`func find_all(text: Text, pattern: Pattern -> List(Match))`](#find_all)
- [`func from(text: Text, first: Int -> Text)`](#from)
-- [`func from_codepoint_names(codepoints: [Int32] -> [Text])`](#from_bytes)
+- [`func from_codepoint_names(codepoints:List(Int32) -> List(Text))`](#from_bytes)
- [`func from_c_string(str: CString -> Text)`](#from_c_string)
-- [`func from_codepoint_names(codepoint_names: [Text] -> [Text])`](#from_codepoint_names)
-- [`func from_codepoint_names(codepoints: [Int32] -> [Text])`](#from_codepoints)
+- [`func from_codepoint_names(codepoint_names:List(Text) -> List(Text))`](#from_codepoint_names)
+- [`func from_codepoint_names(codepoints:List(Int32) -> List(Text))`](#from_codepoints)
- [`func has(text: Text, pattern: Pattern -> Bool)`](#has)
-- [`func join(glue: Text, pieces: [Text] -> Text)`](#join)
-- [`func split(text: Text -> [Text])`](#lines)
+- [`func join(glue: Text, pieces:List(Text) -> Text)`](#join)
+- [`func split(text: Text -> List(Text))`](#lines)
- [`func middle_pad(text: Text, width: Int, pad: Text = " " -> Text)`](#middle_pad)
- [`func left_pad(text: Text, width: Int, pad: Text = " " -> Text)`](#left_pad)
-- [`func lines(text: Text, pattern: Pattern = "" -> [Text])`](#lines)
+- [`func lines(text: Text, pattern: Pattern = "" -> List(Text))`](#lines)
- [`func lower(text: Text, language: Text = "C" -> Text)`](#lower)
- [`func map(text: Text, pattern: Pattern, fn: func(text:Match)->Text -> Text, recursive: Bool = yes)`](#map)
-- [`func matches(text: Text, pattern: Pattern -> [Text])`](#matches)
+- [`func matches(text: Text, pattern: Pattern -> List(Text))`](#matches)
- [`func quoted(text: Text, color: Bool = no -> Text)`](#quoted)
- [`func repeat(text: Text, count:Int -> Text)`](#repeat)
- [`func replace(text: Text, pattern: Pattern, replacement: Text, backref: Pattern = $/\/, recursive: Bool = yes -> Text)`](#replace)
-- [`func replace_all(replacements:{Pattern,Text}, backref: Pattern = $/\/, recursive: Bool = yes -> Text)`](#replace_all)
+- [`func replace_all(replacements:Table(Pattern, Text), backref: Pattern = $/\/, recursive: Bool = yes -> Text)`](#replace_all)
- [`func reversed(text: Text -> Text)`](#reversed)
- [`func right_pad(text: Text, width: Int, pad: Text = " " -> Text)`](#right_pad)
- [`func slice(text: Text, from: Int = 1, to: Int = -1 -> Text)`](#slice)
@@ -308,7 +308,7 @@ pattern documentation](patterns.md) for more details.
- [`func to(text: Text, last: Int -> Text)`](#to)
- [`func trim(text: Text, pattern: Pattern = $/{whitespace/, trim_left: Bool = yes, trim_right: Bool = yes -> Text)`](#trim)
- [`func upper(text: Text, language: Text "C" -> Text)`](#upper)
-- [`func utf32_codepoints(text: Text -> [Int32])`](#utf32_codepoints)
+- [`func utf32_codepoints(text: Text -> List(Int32))`](#utf32_codepoints)
### `as_c_string`
Converts a `Text` value to a C-style string.
@@ -439,7 +439,7 @@ Converts a `Text` value to an array of bytes representing a UTF8 encoding of
the text.
```tomo
-func bytes(text: Text -> [Byte])
+func bytes(text: Text -> List(Byte))
```
- `text`: The text to be converted to UTF8 bytes.
@@ -450,7 +450,7 @@ An array of bytes (`[Byte]`) representing the text in UTF8 encoding.
**Example:**
```tomo
>> "Amélie":bytes()
-= [65[B], 109[B], 195[B], 169[B], 108[B], 105[B], 101[B]] : [Byte]
+= [65[B], 109[B], 195[B], 169[B], 108[B], 105[B], 101[B]] :List(Byte)
```
---
@@ -486,7 +486,7 @@ func caseless_equals(a: Text, b:Text, language:Text = "C" -> Bool)
Returns an array of the names of each codepoint in the text.
```tomo
-func codepoint_names(text: Text -> [Text])
+func codepoint_names(text: Text -> List(Text))
```
- `text`: The text from which to extract codepoint names.
@@ -583,7 +583,7 @@ struct containing information about the match.
Finds all occurrences of a [pattern](patterns.md) in the given text.
```tomo
-func find_all(text: Text, pattern: Pattern -> [Match])
+func find_all(text: Text, pattern: Pattern -> List(Match))
```
- `text`: The text to be searched.
@@ -646,7 +646,7 @@ text will be normalized, so the resulting text's UTF8 bytes may not exactly
match the input.
```tomo
-func from_codepoint_names(codepoints: [Int32] -> [Text])
+func from_codepoint_names(codepoints:List(Int32) -> List(Text))
```
- `codepoints`: The UTF32 codepoints in the desired text.
@@ -688,7 +688,7 @@ specification) as its codepoints. Note: the text will be normalized, so the
resulting text's codepoints may not exactly match the input codepoints.
```tomo
-func from_codepoint_names(codepoint_names: [Text] -> [Text])
+func from_codepoint_names(codepoint_names:List(Text) -> List(Text))
```
- `codepoint_names`: The names of each codepoint in the desired text. Names
@@ -716,7 +716,7 @@ the text will be normalized, so the resulting text's codepoints may not exactly
match the input codepoints.
```tomo
-func from_codepoint_names(codepoints: [Int32] -> [Text])
+func from_codepoint_names(codepoints:List(Int32) -> List(Text))
```
- `codepoints`: The UTF32 codepoints in the desired text.
@@ -763,7 +763,7 @@ func has(text: Text, pattern: Pattern -> Bool)
Joins an array of text pieces with a specified glue.
```tomo
-func join(glue: Text, pieces: [Text] -> Text)
+func join(glue: Text, pieces:List(Text) -> Text)
```
- `glue`: The text used to join the pieces.
@@ -837,7 +837,7 @@ Splits the text into an array of lines of text, preserving blank lines,
ignoring trailing newlines, and handling `\r\n` the same as `\n`.
```tomo
-func lines(text: Text -> [Text])
+func lines(text: Text -> List(Text))
```
- `text`: The text to be split into lines.
@@ -919,7 +919,7 @@ of the matching text captures or a null value if the entire text doesn't match
the pattern.
```tomo
-func matches(text: Text, pattern: Pattern -> [Text])
+func matches(text: Text, pattern: Pattern -> List(Text))
```
- `text`: The text to be searched.
@@ -932,10 +932,10 @@ or a null value otherwise.
**Example:**
```tomo
>> "hello world":matches($/{id}/)
-= none : [Text]?
+= none :List(Text)?
>> "hello world":matches($/{id} {id}/)
-= ["hello", "world"] : [Text]?
+= ["hello", "world"] :List(Text)?
```
---
@@ -1052,7 +1052,7 @@ modified. See [`replace()`](#replace) for more information about replacement
behavior.
```tomo
-func replace_all(replacements:{Pattern,Text}, backref: Pattern = $/\/, recursive: Bool = yes -> Text)
+func replace_all(replacements:Table(Pattern, Text), backref: Pattern = $/\/, recursive: Bool = yes -> Text)
```
- `text`: The text in which to perform replacements.
@@ -1168,7 +1168,7 @@ the string.
Splits the text into an array of substrings based on a [pattern](patterns.md).
```tomo
-func split(text: Text, pattern: Pattern = "" -> [Text])
+func split(text: Text, pattern: Pattern = "" -> List(Text))
```
- `text`: The text to be split.
@@ -1326,7 +1326,7 @@ The uppercase version of the text.
Returns an array of Unicode code points for UTF32 encoding of the text.
```tomo
-func utf32_codepoints(text: Text -> [Int32])
+func utf32_codepoints(text: Text -> List(Int32))
```
- `text`: The text from which to extract Unicode code points.
@@ -1337,5 +1337,5 @@ An array of 32-bit integer Unicode code points (`[Int32]`).
**Example:**
```tomo
>> "Amélie":utf32_codepoints()
-= [65[32], 109[32], 233[32], 108[32], 105[32], 101[32]] : [Int32]
+= [65[32], 109[32], 233[32], 108[32], 105[32], 101[32]] :List(Int32)
```