diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/arrays.md | 16 | ||||
| -rw-r--r-- | docs/integers.md | 4 | ||||
| -rw-r--r-- | docs/optionals.md | 8 | ||||
| -rw-r--r-- | docs/paths.md | 18 | ||||
| -rw-r--r-- | docs/serialization.md | 2 | ||||
| -rw-r--r-- | docs/tables.md | 6 |
6 files changed, 27 insertions, 27 deletions
diff --git a/docs/arrays.md b/docs/arrays.md index 437ab76f..8ea51f01 100644 --- a/docs/arrays.md +++ b/docs/arrays.md @@ -246,13 +246,13 @@ variable or dereference a heap pointer, it may trigger copy-on-write behavior. - [`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], random: func(min,max:Int64->Int64)? = none:func(min,max:Int64->Int64) -> T)`](#random) +- [`func random(arr: [T], random: func(min,max:Int64->Int64)? = none -> 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], random: func(->Num)? = none:func(->Num) -> [T])`](#sample) -- [`func shuffle(arr: @[T], random: func(min,max:Int64->Int64)? = none:func(min,max:Int64->Int64) -> Void)`](#shuffle) -- [`func shuffled(arr: [T], random: func(min,max:Int64->Int64)? = none:func(min,max:Int64->Int64) -> [T])`](#shuffled) +- [`func sample(arr: [T], count: Int, weights: [Num]? = ![Num], random: func(->Num)? = none -> [T])`](#sample) +- [`func shuffle(arr: @[T], random: func(min,max:Int64->Int64)? = none -> Void)`](#shuffle) +- [`func shuffled(arr: [T], random: func(min,max:Int64->Int64)? = none -> [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) @@ -607,7 +607,7 @@ otherwise the item at the given index. Selects a random element from the array. ```tomo -func random(arr: [T], random: func(min,max:Int64->Int64)? = none:func(min,max:Int64->Int64) -> T) +func random(arr: [T], random: func(min,max:Int64->Int64)? = none -> T) ``` - `arr`: The array from which to select a random element. @@ -707,7 +707,7 @@ Selects a sample of elements from the array, optionally with weighted probabilities. ```tomo -func sample(arr: [T], count: Int, weights: [Num]? = ![Num], random: func(->Num)? = none:func(->Num) -> [T]) +func sample(arr: [T], count: Int, weights: [Num]? = ![Num], random: func(->Num)? = none -> [T]) ``` - `arr`: The array to sample from. @@ -744,7 +744,7 @@ A list of sampled elements from the array. Shuffles the elements of the array in place. ```tomo -func shuffle(arr: @[T], random: func(min,max:Int64->Int64)? = none:func(min,max:Int64->Int64) -> Void) +func shuffle(arr: @[T], random: func(min,max:Int64->Int64)? = none -> Void) ``` - `arr`: The mutable reference to the array to be shuffled. @@ -766,7 +766,7 @@ Nothing. Creates a new array with elements shuffled. ```tomo -func shuffled(arr: [T], random: func(min,max:Int64->Int64)? = none:func(min,max:Int64->Int64) -> [T]) +func shuffled(arr: [T], random: func(min,max:Int64->Int64)? = none -> [T]) ``` - `arr`: The array to be shuffled. diff --git a/docs/integers.md b/docs/integers.md index 6e45f1be..5681388c 100644 --- a/docs/integers.md +++ b/docs/integers.md @@ -135,7 +135,7 @@ can be called either on the type itself: `Int.sqrt(x)` or as a method call: - [`func parse(text: Text -> Int?)`](#parse) - [`func prev_prime(x: Int -> Int)`](#prev_prime) - [`func sqrt(x: Int -> Int)`](#sqrt) -- [`func to(first: Int, last: Int, step : Int? = none:Int -> func(->Int?))`](#to) +- [`func to(first: Int, last: Int, step : Int? = none -> func(->Int?))`](#to) ### `abs` Calculates the absolute value of an integer. @@ -458,7 +458,7 @@ Returns an iterator function that iterates over the range of numbers specified. Iteration is assumed to be nonempty and ```tomo -func to(first: Int, last: Int, step : Int? = none:Int -> func(->Int?)) +func to(first: Int, last: Int, step : Int? = none -> func(->Int?)) ``` - `first`: The starting value of the range. diff --git a/docs/optionals.md b/docs/optionals.md index 84f886b7..ff4252d1 100644 --- a/docs/optionals.md +++ b/docs/optionals.md @@ -40,7 +40,7 @@ example, if you wanted to declare a variable that could be either an integer value or `none` and initialize it as none, you would write it as: ```tomo -x := none:Int +x : Int = none ``` Similarly, if you wanted to declare a variable that could be an array of texts @@ -57,7 +57,7 @@ keep open the possibility of assigning `none` later, you can use the postfix ```tomo x := 5? # Later on, assign none: -x = !Int +x = none ``` ## Type Inference @@ -86,7 +86,7 @@ Non-none values can also be automatically promoted to optional values without the need for an explicit `?` operator in the cases listed above: ```tomo -x := !Int +x : Int? = none x = 5 func doop(arg:Int?)->Text?: @@ -109,7 +109,7 @@ maybe_x := 5? >> maybe_x or fail("No value!") = 5 : Int -maybe_x = !Int +maybe_x = none >> maybe_x or -1 = -1 : Int >> maybe_x or fail("No value!") diff --git a/docs/paths.md b/docs/paths.md index 234ad44f..2bfc9b0f 100644 --- a/docs/paths.md +++ b/docs/paths.md @@ -68,7 +68,7 @@ intended. Paths can be created from text with slashes using - [`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 set_owner(path:Path, owner:Text?=none, group:Text?=none, follow_symlinks=yes)`](#set_owner) - [`func subdirectories(path: Path, include_hidden=no -> [Path])`](#subdirectories) - [`func unique_directory(path: Path -> Path)`](#unique_directory) - [`func write(path: Path, text: Text, permissions=0o644[32] -> Void)`](#write) @@ -95,7 +95,7 @@ accessed, or `none` if no such file or directory exists. >> (./file.txt):accessed() = 1704221100? >> (./not-a-file):accessed() -= none:Int64? += none ``` --- @@ -289,7 +289,7 @@ changed, or `none` if no such file or directory exists. >> (./file.txt):changed() = 1704221100? >> (./not-a-file):changed() -= none:Int64 += none ``` --- @@ -535,7 +535,7 @@ The name of the group which owns the file or directory, or `none` if the path do >> (/bin):group() = "root" >> (/non/existent/file):group() -= none:Text += none ``` --- @@ -648,7 +648,7 @@ modified, or `none` if no such file or directory exists. >> (./file.txt):modified() = 1704221100? >> (./not-a-file):modified() -= none:Int64 += none ``` --- @@ -671,7 +671,7 @@ The name of the user who owns the file or directory, or `none` if the path does >> (/bin):owner() = "root" >> (/non/existent/file):owner() -= none:Text += none ``` --- @@ -717,7 +717,7 @@ raised. = "Hello"? >> (./nosuchfile.xxx):read() -= none:Text += none ``` --- @@ -741,7 +741,7 @@ returned. = [72[B], 101[B], 108[B], 108[B], 111[B]]? >> (./nosuchfile.xxx):read() -= none:[Byte] += none ``` --- @@ -815,7 +815,7 @@ The resolved absolute path. Set the owning user and/or group for a path. ```tomo -func set_owner(path:Path, owner: Text? = none:Text, group: Text? = none:Text, follow_symlinks: Bool = yes) +func set_owner(path:Path, owner: Text? = none, group: Text? = none, follow_symlinks: Bool = yes) ``` - `path`: The path to change the permissions for. diff --git a/docs/serialization.md b/docs/serialization.md index 0f158be1..a1a38fdb 100644 --- a/docs/serialization.md +++ b/docs/serialization.md @@ -52,7 +52,7 @@ cyclic datastructures correctly, enabling you to serialize cyclic structures like circularly linked lists or graphs: ```tomo -struct Cycle(name:Text, next=none:@Cycle) +struct Cycle(name:Text, next:@Cycle?=none) c := @Cycle("A") c.next = @Cycle("B", next=c) diff --git a/docs/tables.md b/docs/tables.md index 83c80b2b..93ee3eb9 100644 --- a/docs/tables.md +++ b/docs/tables.md @@ -43,7 +43,7 @@ table := {"A"=1, "B"=2} >> table["A"] = 1? >> table["missing"] -= none:Int += none ``` As with all optional values, you can use the `!` postfix operator to assert @@ -77,7 +77,7 @@ table value: >> t2.fallback = {"A"=10}? >> t.fallback -= none:{Text=Int} += none ``` ### Default Values @@ -225,7 +225,7 @@ The value associated with the key or `none` if the key is not found. = 1? >> t:get("????") -= none:Int += none >> t:get("A")! = 1 |
