aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-10-09 13:26:28 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-10-09 13:26:28 -0400
commit074cf22ad462eafe963e4a749b2b74cab51211a1 (patch)
treee1d7f938f2d949cc5dcf67ca648f200663e36562 /docs
parent47fca946065508cff4151a32b3008c161983fd9d (diff)
Change function syntax from `func(args)->ret` to `func(args -> ret)`
Diffstat (limited to 'docs')
-rw-r--r--docs/README.md12
-rw-r--r--docs/arrays.md48
-rw-r--r--docs/booleans.md4
-rw-r--r--docs/bytes.md2
-rw-r--r--docs/channels.md12
-rw-r--r--docs/datetime.md32
-rw-r--r--docs/enums.md2
-rw-r--r--docs/functions.md25
-rw-r--r--docs/integers.md24
-rw-r--r--docs/langs.md8
-rw-r--r--docs/metamethods.md8
-rw-r--r--docs/namespacing.md2
-rw-r--r--docs/nums.md104
-rw-r--r--docs/paths.md50
-rw-r--r--docs/ranges.md4
-rw-r--r--docs/sets.md22
-rw-r--r--docs/tables.md12
-rw-r--r--docs/text.md52
-rw-r--r--docs/threads.md8
19 files changed, 217 insertions, 214 deletions
diff --git a/docs/README.md b/docs/README.md
index c58c5c85..e4449365 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -44,7 +44,7 @@ Gets a line of user input text with a prompt.
**Usage:**
```markdown
-ask(prompt:Text, bold:Bool = yes, force_tty:Bool = yes) -> Void
+ask(prompt:Text, bold:Bool = yes, force_tty:Bool = yes -> Void)
```
**Parameters:**
@@ -79,7 +79,7 @@ Exits the program with a given status and optionally prints a message.
**Usage:**
```markdown
-ask(message:Text? = !Text, status:Int32 = 1[32]) -> Void
+ask(message:Text? = !Text, status:Int32 = 1[32] -> Void)
```
**Parameters:**
@@ -106,7 +106,7 @@ Prints a message to the console.
**Usage:**
```markdown
-say(text:Text, newline:Bool = yes) -> Void
+say(text:Text, newline:Bool = yes -> Void)
```
**Parameters:**
@@ -132,7 +132,7 @@ Pause execution for a given number of seconds.
**Usage:**
```markdown
-sleep(seconds: Num) -> Void
+sleep(seconds: Num -> Void)
```
**Parameters:**
@@ -156,7 +156,7 @@ Prints a message to the console, aborts the program, and prints a stack trace.
**Usage:**
```markdown
-fail(message:Text) -> Abort
+fail(message:Text -> Abort)
```
**Parameters:**
@@ -180,7 +180,7 @@ Gets the current time. This is an alias for `DateTime.now()`.
**Usage:**
```markdown
-now() -> DateTime
+now(->DateTime)
```
**Parameters:**
diff --git a/docs/arrays.md b/docs/arrays.md
index edde43af..773500af 100644
--- a/docs/arrays.md
+++ b/docs/arrays.md
@@ -239,7 +239,7 @@ Performs a binary search on a sorted array.
**Usage:**
```markdown
-binary_search(arr: [T], by=T.compare) -> Int
+binary_search(arr: [T], by=T.compare -> Int)
```
**Parameters:**
@@ -275,7 +275,7 @@ Creates a new array with elements spaced by the specified step value.
**Usage:**
```markdown
-by(arr: [T], step: Int) -> [T]
+by(arr: [T], step: Int -> [T])
```
**Parameters:**
@@ -301,7 +301,7 @@ Clears all elements from the array.
**Usage:**
```markdown
-clear(arr: & [T]) -> Void
+clear(arr: & [T] -> Void)
```
**Parameters:**
@@ -325,7 +325,7 @@ Counts the occurrences of each element in the array.
**Usage:**
```markdown
-counts(arr: [T]) -> {T: Int}
+counts(arr: [T] -> {T: Int})
```
**Parameters:**
@@ -350,7 +350,7 @@ Finds the index of the first occurrence of an element (if any).
**Usage:**
```markdown
-find(arr: [T]) -> Int?
+find(arr: [T] -> Int?)
```
**Parameters:**
@@ -378,7 +378,7 @@ Find the index of the first item that matches a predicate function (if any).
**Usage:**
```markdown
-first(arr: [T], predicate: func(item:&T)->Bool) -> Int
+first(arr: [T], predicate: func(item:&T)->Bool -> Int)
```
**Parameters:**
@@ -408,7 +408,7 @@ Returns a slice of the array starting from a specified index.
**Usage:**
```markdown
-from(arr: [T], first: Int) -> [T]
+from(arr: [T], first: Int -> [T])
```
**Parameters:**
@@ -434,7 +434,7 @@ Checks if the array has any elements.
**Usage:**
```markdown
-has(arr: [T]) -> Bool
+has(arr: [T] -> Bool)
```
**Parameters:**
@@ -460,7 +460,7 @@ Removes and returns the top element of a heap. By default, this is the
**Usage:**
```markdown
-heap_pop(arr: & [T], by=T.compare) -> T
+heap_pop(arr: & [T], by=T.compare -> T)
```
**Parameters:**
@@ -490,7 +490,7 @@ is a *minimum* heap.
**Usage:**
```markdown
-heap_push(arr: & [T], item: T, by=T.compare) -> Void
+heap_push(arr: & [T], item: T, by=T.compare -> Void)
```
**Parameters:**
@@ -517,7 +517,7 @@ Converts an array into a heap.
**Usage:**
```markdown
-heapify(arr: & [T], by=T.compare) -> Void
+heapify(arr: & [T], by=T.compare -> Void)
```
**Parameters:**
@@ -544,7 +544,7 @@ Inserts an element at a specified position in the array.
**Usage:**
```markdown
-insert(arr: & [T], item: T, at: Int = 0) -> Void
+insert(arr: & [T], item: T, at: Int = 0 -> Void)
```
**Parameters:**
@@ -579,7 +579,7 @@ Inserts an array of items at a specified position in the array.
**Usage:**
```markdown
-insert_all(arr: & [T], items: [T], at: Int = 0) -> Void
+insert_all(arr: & [T], items: [T], at: Int = 0 -> Void)
```
**Parameters:**
@@ -614,7 +614,7 @@ Selects a random element from the array.
**Usage:**
```markdown
-random(arr: [T]) -> T
+random(arr: [T] -> T)
```
**Parameters:**
@@ -639,7 +639,7 @@ Removes elements from the array starting at a specified index.
**Usage:**
```markdown
-remove_at(arr: & [T], at: Int = -1, count: Int = 1) -> Void
+remove_at(arr: & [T], at: Int = -1, count: Int = 1 -> Void)
```
**Parameters:**
@@ -672,7 +672,7 @@ Removes all occurrences of a specified item from the array.
**Usage:**
```markdown
-remove_item(arr: & [T], item: T, max_count: Int = -1) -> Void
+remove_item(arr: & [T], item: T, max_count: Int = -1 -> Void)
```
**Parameters:**
@@ -705,7 +705,7 @@ Returns a reversed slice of the array.
**Usage:**
```markdown
-reversed(arr: [T]) -> [T]
+reversed(arr: [T] -> [T])
```
**Parameters:**
@@ -731,7 +731,7 @@ probabilities.
**Usage:**
```markdown
-sample(arr: [T], count: Int, weights: [Num]? = ![Num]) -> [T]
+sample(arr: [T], count: Int, weights: [Num]? = ![Num] -> [T])
```
**Parameters:**
@@ -769,7 +769,7 @@ Shuffles the elements of the array in place.
**Usage:**
```markdown
-shuffle(arr: & [T]) -> Void
+shuffle(arr: & [T] -> Void)
```
**Parameters:**
@@ -793,7 +793,7 @@ Creates a new array with elements shuffled.
**Usage:**
```markdown
-shuffled(arr: [T]) -> [T]
+shuffled(arr: [T] -> [T])
```
**Parameters:**
@@ -818,7 +818,7 @@ Sorts the elements of the array in place in ascending order (small to large).
**Usage:**
```markdown
-sort(arr: & [T], by=T.compare) -> Void
+sort(arr: & [T], by=T.compare -> Void)
```
**Parameters:**
@@ -851,7 +851,7 @@ Creates a new array with elements sorted.
**Usage:**
```markdown
-sorted(arr: [T], by=T.compare) -> [T]
+sorted(arr: [T], by=T.compare -> [T])
```
**Parameters:**
@@ -881,7 +881,7 @@ Returns a slice of the array from the start of the original array up to a specif
**Usage:**
```markdown
-to(arr: [T], last: Int) -> [T]
+to(arr: [T], last: Int -> [T])
```
**Parameters:**
@@ -910,7 +910,7 @@ Returns a Set that contains the unique elements of the array.
**Usage:**
```markdown
-unique(arr: [T]) -> {T}
+unique(arr: [T] -> {T})
```
**Parameters:**
diff --git a/docs/booleans.md b/docs/booleans.md
index 7d2c29a4..75259662 100644
--- a/docs/booleans.md
+++ b/docs/booleans.md
@@ -16,7 +16,7 @@ boolean values are case-insensitive variations of `yes`/`no`, `y`/`n`,
**Usage:**
```tomo
-from_text(text: Text, success: Bool = !&Bool) -> Bool
+from_text(text: Text, success: Bool = !&Bool -> Bool)
```
**Parameters:**
@@ -49,7 +49,7 @@ Generates a random boolean value based on a specified probability.
**Usage:**
```tomo
-random(p: Float = 0.5) -> Bool
+random(p: Float = 0.5 -> Bool)
```
**Parameters:**
diff --git a/docs/bytes.md b/docs/bytes.md
index 36180428..579db9db 100644
--- a/docs/bytes.md
+++ b/docs/bytes.md
@@ -16,7 +16,7 @@ Generates a random byte value in the specified range.
**Usage:**
```tomo
-random(min: Byte = Byte.min, max: Byte = Byte.max) -> Byte
+random(min: Byte = Byte.min, max: Byte = Byte.max -> Byte)
```
**Parameters:**
diff --git a/docs/channels.md b/docs/channels.md
index 8763f11d..47b9ced4 100644
--- a/docs/channels.md
+++ b/docs/channels.md
@@ -31,7 +31,7 @@ Adds an item to the channel.
**Usage:**
```markdown
-give(channel:|T|, item: T, front: Bool = no) -> Void
+give(channel:|T|, item: T, front: Bool = no -> Void)
```
**Parameters:**
@@ -57,7 +57,7 @@ Adds multiple items to the channel.
**Usage:**
```markdown
-give_all(channel:|T|, items: [T], front: Bool = no) -> Void
+give_all(channel:|T|, items: [T], front: Bool = no -> Void)
```
**Parameters:**
@@ -83,7 +83,7 @@ Removes and returns an item from the channel. If the channel is empty, it waits
**Usage:**
```markdown
-get(channel:|T|, front: Bool = yes) -> T
+get(channel:|T|, front: Bool = yes -> T)
```
**Parameters:**
@@ -110,7 +110,7 @@ it. If the channel is empty, it waits until an item is available.
**Usage:**
```markdown
-peek(channel:|T|, front: Bool = yes) -> T
+peek(channel:|T|, front: Bool = yes -> T)
```
**Parameters:**
@@ -136,7 +136,7 @@ Removes all items from the channel.
**Usage:**
```markdown
-clear(channel:|T|) -> Void
+clear(channel:|T| -> Void)
```
**Parameters:**
@@ -160,7 +160,7 @@ Returns a list of all items currently in the channel without removing them.
**Usage:**
```markdown
-channel:view() -> [T]
+channel:view(->[T])
```
**Parameters:**
diff --git a/docs/datetime.md b/docs/datetime.md
index dd02b206..9d4e1e46 100644
--- a/docs/datetime.md
+++ b/docs/datetime.md
@@ -79,7 +79,7 @@ calculated.
**Usage:**
```markdown
-datetime:after(seconds : Num = 0.0, minutes : Num = 0.0, hours : Num = 0.0, days : Int = 0, weeks : Int = 0, months : Int = 0, years : Int = 0, timezone : Text? = !Text) -> DateTime
+datetime:after(seconds : Num = 0.0, minutes : Num = 0.0, hours : Num = 0.0, days : Int = 0, weeks : Int = 0, months : Int = 0, years : Int = 0, timezone : Text? = !Text -> DateTime)
```
**Parameters:**
@@ -113,7 +113,7 @@ specifier, which gives the date in `YYYY-MM-DD` form.
**Usage:**
```markdown
-datetime:date(timezone : Text? = !Text) -> Text
+datetime:date(timezone : Text? = !Text -> Text)
```
**Parameters:**
@@ -141,7 +141,7 @@ timezone.
**Usage:**
```markdown
-datetime:format(format: Text = "%Y-%m-%dT%H:%M:%S%z", timezone : Text? = !Text) -> Text
+datetime:format(format: Text = "%Y-%m-%dT%H:%M:%S%z", timezone : Text? = !Text -> Text)
```
**Parameters:**
@@ -168,7 +168,7 @@ the given UNIX epoch timestamp (seconds since January 1, 1970 UTC).
**Usage:**
```markdown
-DateTime.from_unix_timestamp(timestamp: Int64) -> DateTime
+DateTime.from_unix_timestamp(timestamp: Int64 -> DateTime)
```
**Parameters:**
@@ -195,7 +195,7 @@ provided optional fields.
**Usage:**
```markdown
-datetime:get(year : &Int? = !&Int, month : &Int? = !&Int, day : &Int? = !&Int, hour : &Int? = !&Int, minute : &Int? = !&Int, second : &Int? = !&Int, nanosecond : &Int? = !&Int, weekday : &Int? = !&Int, timezone : Text? = !Text) -> Void
+datetime:get(year : &Int? = !&Int, month : &Int? = !&Int, day : &Int? = !&Int, hour : &Int? = !&Int, minute : &Int? = !&Int, second : &Int? = !&Int, nanosecond : &Int? = !&Int, weekday : &Int? = !&Int, timezone : Text? = !Text -> Void)
```
**Parameters:**
@@ -233,7 +233,7 @@ calling `DateTime.set_local_timezone(...)`.
**Usage:**
```markdown
-DateTime.get_local_timezone() -> Text
+DateTime.get_local_timezone(->Text)
```
**Parameters:**
@@ -258,7 +258,7 @@ Return the number of hours until a given datetime.
**Usage:**
```markdown
-datetime:hours_till(then:DateTime) -> Num
+datetime:hours_till(then:DateTime -> Num)
```
**Parameters:**
@@ -284,7 +284,7 @@ Return the number of minutes until a given datetime.
**Usage:**
```markdown
-datetime:minutes_till(then:DateTime) -> Num
+datetime:minutes_till(then:DateTime -> Num)
```
**Parameters:**
@@ -312,7 +312,7 @@ constructor.
**Usage:**
```markdown
-DateTime.new(year : Int, month : Int, day : Int, hour : Int = 0, minute : Int = 0, second : Num = 0.0) -> DateTime
+DateTime.new(year : Int, month : Int, day : Int, hour : Int = 0, minute : Int = 0, second : Num = 0.0 -> DateTime)
```
**Parameters:**
@@ -351,7 +351,7 @@ is the same as the global function `now()`.
**Usage:**
```markdown
-DateTime.now() -> DateTime
+DateTime.now(->DateTime)
```
**Parameters:**
@@ -377,7 +377,7 @@ or a null value if the value could not be successfully parsed.
**Usage:**
```markdown
-DateTime.parse(text: Text, format: Text = "%Y-%m-%dT%H:%M:%S%z") -> DateTime?
+DateTime.parse(text: Text, format: Text = "%Y-%m-%dT%H:%M:%S%z" -> DateTime?)
```
**Parameters:**
@@ -410,7 +410,7 @@ between two `DateTime`s. For example: `5 minutes ago` or `1 day later`
**Usage:**
```markdown
-datetime:relative(relative_to : DateTime = DateTime.now(), timezone : Text? = !Text) -> Text
+datetime:relative(relative_to : DateTime = DateTime.now(), timezone : Text? = !Text -> Text)
```
**Parameters:**
@@ -445,7 +445,7 @@ Return the number of seconds until a given datetime.
**Usage:**
```markdown
-datetime:seconds_till(then:DateTime) -> Num
+datetime:seconds_till(then:DateTime -> Num)
```
**Parameters:**
@@ -475,7 +475,7 @@ converted to text.
**Usage:**
```markdown
-DateTime.set_local_timezone(timezone : Text? = !Text) -> Void
+DateTime.set_local_timezone(timezone : Text? = !Text -> Void)
```
**Parameters:**
@@ -501,7 +501,7 @@ Return a text representation of the time component of the given datetime.
**Usage:**
```markdown
-datetime:time(seconds : Bool = no, am_pm : Bool = yes, timezone : Text? = !Text) -> Text
+datetime:time(seconds : Bool = no, am_pm : Bool = yes, timezone : Text? = !Text -> Text)
```
**Parameters:**
@@ -537,7 +537,7 @@ January 1, 1970 UTC).
**Usage:**
```markdown
-datetime:unix_timestamp() -> Int64
+datetime:unix_timestamp(->Int64)
```
**Parameters:**
diff --git a/docs/enums.md b/docs/enums.md
index 4123fbc4..c73379f8 100644
--- a/docs/enums.md
+++ b/docs/enums.md
@@ -54,7 +54,7 @@ from a function with an explicit return type:
enum ArgumentType(AnInt(x:Int), SomeText(text:Text))
enum ReturnType(Nothing, AnInt(x:Int))
-func increment(arg:ArgumentType)->ReturnType:
+func increment(arg:ArgumentType -> ReturnType):
when arg is AnInt(x):
return AnInt(x + 1)
is SomeText:
diff --git a/docs/functions.md b/docs/functions.md
index 61a10037..174ad23a 100644
--- a/docs/functions.md
+++ b/docs/functions.md
@@ -3,7 +3,7 @@
In Tomo, you can define functions with the `func` keyword:
```tomo
-func add(x:Int, y:Int)->Int:
+func add(x:Int, y:Int -> Int):
return x + y
```
@@ -11,7 +11,7 @@ Functions require you to explicitly write out the types of each argument and
the return type of the function (unless the function doesn't return any values).
For convenience, you can lump arguments with the same type together to avoid
-having to retype the same type name: `func add(x, y:Int)->Int`
+having to retype the same type name: `func add(x, y:Int -> Int)`
## Default Arguments
@@ -19,7 +19,7 @@ Instead of giving a type, you can provide a default argument and the type
checker will infer the type of the argument from that value:
```tomo
-func increment(x:Int, amount=1)->Int:
+func increment(x:Int, amount=1 -> Int):
return x + amount
```
@@ -35,7 +35,7 @@ callsite:
```
**Note:** Default arguments are re-evaluated at the callsite for each function
-call, so if your default argument is `func foo(x=Int.random(1,10))->Int`, then
+call, so if your default argument is `func foo(x=Int.random(1,10) -> Int)`, then
each time you call the function without an `x` argument, it will give you a new
random number.
@@ -68,7 +68,7 @@ Tomo supports automatic function caching using the `cached` or `cache_size=N`
attributes on a function definition:
```tomo
-func add(x, y:Int; cached)->Int:
+func add(x, y:Int -> Int; cached):
return x + y
```
@@ -78,13 +78,13 @@ return value for those arguments. The above example is functionally similar to
the following code:
```tomo
-func _add(x, y:Int)->Int:
+func _add(x, y:Int -> Int):
return x + y
struct add_args(x,y:Int)
add_cache := @{:add_args:Int}
-func add(x, y:Int)->Int:
+func add(x, y:Int -> Int):
args := add_args(x, y)
if add_cache:has(args):
return add_cache:get(args)
@@ -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:[Int]; cache_size=100 -> Text):
return "x=$x y=$y z=$z"
```
@@ -108,7 +108,7 @@ Functions can also be given an `inline` attribute, which encourages the
compiler to inline the function when possible:
```tomo
-func add(x, y:Int; inline)->Int:
+func add(x, y:Int -> Int; inline):
return x + y
```
@@ -137,7 +137,10 @@ fn := func(x,y:Int):
Lambda functions must declare the types of their arguments, but do not require
declaring the return type. Because lambdas cannot be recursive or corecursive
(since they aren't declared with a name), it is always possible to infer the
-return type without much difficulty.
+return type without much difficulty. If you do choose to declare a return type,
+the compiler will attempt to promote return values to that type, or give a
+compiler error if the return value is not compatible with the declared return
+type.
## Closures
@@ -148,7 +151,7 @@ values. **Captured values are copied to a new location at the moment the lambda
is created and will not reflect changes to local variables.**
```tomo
-func create_adder(n:Int) -> func(i:Int)->Int:
+func create_adder(n:Int -> func(i:Int -> Int)):
adder := func(i:Int):
return n + i
diff --git a/docs/integers.md b/docs/integers.md
index 1b25bcf0..36dac3c4 100644
--- a/docs/integers.md
+++ b/docs/integers.md
@@ -37,7 +37,7 @@ Formats an integer as a string with a specified number of digits.
**Usage:**
```tomo
-format(i: Int, digits: Int = 0) -> Text
+format(i: Int, digits: Int = 0 -> Text)
```
**Parameters:**
@@ -63,7 +63,7 @@ Converts an integer to its hexadecimal representation.
**Usage:**
```tomo
-hex(i: Int, digits: Int = 0, uppercase: Bool = yes, prefix: Bool = yes) -> Text
+hex(i: Int, digits: Int = 0, uppercase: Bool = yes, prefix: Bool = yes -> Text)
```
**Parameters:**
@@ -91,7 +91,7 @@ Converts an integer to its octal representation.
**Usage:**
```tomo
-octal(i: Int, digits: Int = 0, prefix: Bool = yes) -> Text
+octal(i: Int, digits: Int = 0, prefix: Bool = yes -> Text)
```
**Parameters:**
@@ -118,7 +118,7 @@ Generates a random integer between the specified minimum and maximum values.
**Usage:**
```tomo
-random(min: Int, max: Int) -> Int
+random(min: Int, max: Int -> Int)
```
**Parameters:**
@@ -144,7 +144,7 @@ Converts a text representation of an integer into an integer.
**Usage:**
```tomo
-from_text(text: Text, success: Bool = !&Bool?) -> Int
+from_text(text: Text, success: Bool = !&Bool? -> Int)
```
**Parameters:**
@@ -188,7 +188,7 @@ Creates an inclusive range of integers between the specified start and end value
**Usage:**
```tomo
-to(from: Int, to: Int) -> Range
+to(from: Int, to: Int -> Range)
```
**Parameters:**
@@ -214,7 +214,7 @@ Calculates the absolute value of an integer.
**Usage:**
```tomo
-abs(x: Int) -> Int
+abs(x: Int -> Int)
```
**Parameters:**
@@ -239,7 +239,7 @@ Calculates the square root of an integer.
**Usage:**
```tomo
-sqrt(x: Int) -> Int
+sqrt(x: Int -> Int)
```
**Parameters:**
@@ -272,7 +272,7 @@ for more details.
**Usage:**
```tomo
-is_prime(x: Int, reps: Int = 50) -> Bool
+is_prime(x: Int, reps: Int = 50 -> Bool)
```
**Parameters:**
@@ -306,7 +306,7 @@ for more details.
**Usage:**
```tomo
-next_prime(x: Int) -> Int
+next_prime(x: Int -> Int)
```
**Parameters:**
@@ -339,7 +339,7 @@ for more details.
**Usage:**
```tomo
-prev_prime(x: Int) -> Int
+prev_prime(x: Int -> Int)
```
**Parameters:**
@@ -365,7 +365,7 @@ that range.
**Usage:**
```tomo
-clamped(x, low, high: Int) -> Int
+clamped(x, low, high: Int -> Int)
```
**Parameters:**
diff --git a/docs/langs.md b/docs/langs.md
index 0eecb3cd..31ce275e 100644
--- a/docs/langs.md
+++ b/docs/langs.md
@@ -10,7 +10,7 @@ where a different type of string is needed.
```tomo
lang HTML:
- func escape(t:Text)->HTML:
+ func escape(t:Text -> HTML):
t = t:replace_all({
$/&/: "&amp;",
$/</: "&lt;",
@@ -20,7 +20,7 @@ lang HTML:
})
return HTML.without_escaping(t)
- func paragraph(content:HTML)->HTML:
+ func paragraph(content:HTML -> HTML):
return $HTML"<p>$content</p>"
```
@@ -74,10 +74,10 @@ instead of building a global function called `execute()` that takes a
```tomo
lang Sh:
- func escape(text:Text)->Sh:
+ func escape(text:Text -> Sh):
return Sh.without_escaping("'" ++ text:replace($/'/, "''") ++ "'")
- func execute(sh:Sh)->Text:
+ func execute(sh:Sh -> Text):
...
dir := ask("List which dir? ")
diff --git a/docs/metamethods.md b/docs/metamethods.md
index 8ab2be43..dbd11069 100644
--- a/docs/metamethods.md
+++ b/docs/metamethods.md
@@ -3,25 +3,25 @@
This language relies on a small set of "metamethods" which define special
behavior that is required for all types:
-- `as_text(obj:&(optional)T, colorize=no, type:&TypeInfo_t)->Text`: a method to
+- `func as_text(obj:&(optional)T, colorize=no, type:&TypeInfo_t -> Text)`: a method to
convert the type to a string. If `colorize` is `yes`, then the method should
include ANSI escape codes for syntax highlighting. If the `obj` pointer is
`NULL`, a string representation of the type will be returned instead.
-- `compare(x:&T, y:&T, type:&TypeInfo_t)->Int32`: Return an integer representing
+- `func compare(x:&T, y:&T, type:&TypeInfo_t -> Int32)`: Return an integer representing
the result of comparing `x` and `y`, where negative numbers mean `x` is less
than `y`, zero means `x` is equal to `y`, and positive numbers mean `x` is
greater than `y`. For the purpose of floating point numbers, `NaN` is sorted
as greater than any other number value and `NaN` values are compared bitwise
between each other.
-- `equals(x:&T, y:&T, type:&TypeInfo_t)->Bool`: This is the same as comparing two
+- `func equals(x:&T, y:&T, type:&TypeInfo_t -> Bool)`: This is the same as comparing two
numbers to check for zero, except for some minor differences: floating point
`NaN` values are _not_ equal to each other (IEEE 754) and the implementation
of `equals` may be faster to compute than `compare` for certain types, such
as tables.
-- `hash(x:&T, type:&TypeInfo_t)->Int32`: Values are hashed when used as keys in a
+- `func hash(x:&T, type:&TypeInfo_t -> Int32)`: Values are hashed when used as keys in a
table or set. Hashing is consistent with equality, so two values that are
equal _must_ hash to the same hash value, ideally in a way that makes it
unlikely that two different values will have the same hash value.
diff --git a/docs/namespacing.md b/docs/namespacing.md
index 86b24cec..58638411 100644
--- a/docs/namespacing.md
+++ b/docs/namespacing.md
@@ -17,7 +17,7 @@ my_var := 123
struct Baz(x:Int):
member := 5
- func frob(b:Baz)->Int:
+ func frob(b:Baz -> Int):
return b.x
```
diff --git a/docs/nums.md b/docs/nums.md
index 151a0aa5..577225ba 100644
--- a/docs/nums.md
+++ b/docs/nums.md
@@ -42,7 +42,7 @@ Calculates the absolute value of a number.
**Usage:**
```tomo
-abs(n: Num) -> Num
+abs(n: Num -> Num)
```
**Parameters:**
@@ -67,7 +67,7 @@ Computes the arc cosine of a number.
**Usage:**
```tomo
-acos(x: Num) -> Num
+acos(x: Num -> Num)
```
**Parameters:**
@@ -92,7 +92,7 @@ Computes the inverse hyperbolic cosine of a number.
**Usage:**
```tomo
-acosh(x: Num) -> Num
+acosh(x: Num -> Num)
```
**Parameters:**
@@ -117,7 +117,7 @@ Computes the arc sine of a number.
**Usage:**
```tomo
-asin(x: Num) -> Num
+asin(x: Num -> Num)
```
**Parameters:**
@@ -142,7 +142,7 @@ Computes the inverse hyperbolic sine of a number.
**Usage:**
```tomo
-asinh(x: Num) -> Num
+asinh(x: Num -> Num)
```
**Parameters:**
@@ -167,7 +167,7 @@ Computes the arc tangent of the quotient of two numbers.
**Usage:**
```tomo
-atan2(x: Num, y: Num) -> Num
+atan2(x: Num, y: Num -> Num)
```
**Parameters:**
@@ -193,7 +193,7 @@ Computes the arc tangent of a number.
**Usage:**
```tomo
-atan(x: Num) -> Num
+atan(x: Num -> Num)
```
**Parameters:**
@@ -218,7 +218,7 @@ Computes the inverse hyperbolic tangent of a number.
**Usage:**
```tomo
-atanh(x: Num) -> Num
+atanh(x: Num -> Num)
```
**Parameters:**
@@ -243,7 +243,7 @@ Computes the cube root of a number.
**Usage:**
```tomo
-cbrt(x: Num) -> Num
+cbrt(x: Num -> Num)
```
**Parameters:**
@@ -268,7 +268,7 @@ Rounds a number up to the nearest integer.
**Usage:**
```tomo
-ceil(x: Num) -> Num
+ceil(x: Num -> Num)
```
**Parameters:**
@@ -293,7 +293,7 @@ Copies the sign of one number to another.
**Usage:**
```tomo
-copysign(x: Num, y: Num) -> Num
+copysign(x: Num, y: Num -> Num)
```
**Parameters:**
@@ -319,7 +319,7 @@ Computes the cosine of a number (angle in radians).
**Usage:**
```tomo
-cos(x: Num) -> Num
+cos(x: Num -> Num)
```
**Parameters:**
@@ -344,7 +344,7 @@ Computes the hyperbolic cosine of a number.
**Usage:**
```tomo
-cosh(x: Num) -> Num
+cosh(x: Num -> Num)
```
**Parameters:**
@@ -369,7 +369,7 @@ Computes the error function of a number.
**Usage:**
```tomo
-erf(x: Num) -> Num
+erf(x: Num -> Num)
```
**Parameters:**
@@ -394,7 +394,7 @@ Computes the complementary error function of a number.
**Usage:**
```tomo
-erfc(x: Num) -> Num
+erfc(x: Num -> Num)
```
**Parameters:**
@@ -419,7 +419,7 @@ Computes \( 2^x \) for a number.
**Usage:**
```tomo
-exp2(x: Num) -> Num
+exp2(x: Num -> Num)
```
**Parameters:**
@@ -444,7 +444,7 @@ Computes the exponential function \( e^x \) for a number.
**Usage:**
```tomo
-exp(x: Num) -> Num
+exp(x: Num -> Num)
```
**Parameters:**
@@ -469,7 +469,7 @@ Computes \( e^x - 1 \) for a number.
**Usage:**
```tomo
-expm1(x: Num) -> Num
+expm1(x: Num -> Num)
```
**Parameters:**
@@ -494,7 +494,7 @@ Computes the positive difference between two numbers.
**Usage:**
```tomo
-fdim(x: Num, y: Num) -> Num
+fdim(x: Num, y: Num -> Num)
```
**Parameters:**
@@ -522,7 +522,7 @@ Rounds a number down to the nearest integer.
**Usage:**
```tomo
-floor(x: Num) -> Num
+floor(x: Num -> Num)
```
**Parameters:**
@@ -547,7 +547,7 @@ Formats a number as a string with a specified precision.
**Usage:**
```tomo
-format(n: Num, precision: Int = 0) -> Text
+format(n: Num, precision: Int = 0 -> Text)
```
**Parameters:**
@@ -573,7 +573,7 @@ Converts a string representation of a number into a floating-point number.
**Usage:**
```tomo
-from_text(text: Text, the_rest: Text = "!&Text") -> Num
+from_text(text: Text, the_rest: Text = "!&Text" -> Num)
```
**Parameters:**
@@ -601,7 +601,7 @@ Computes the Euclidean norm, \( \sqrt{x^2 + y^2} \), of two numbers.
**Usage:**
```tomo
-hypot(x: Num, y: Num) -> Num
+hypot(x: Num, y: Num -> Num)
```
**Parameters:**
@@ -627,7 +627,7 @@ Checks if a number is finite.
**Usage:**
```tomo
-isfinite(n: Num) -> Bool
+isfinite(n: Num -> Bool)
```
**Parameters:**
@@ -654,7 +654,7 @@ Checks if a number is infinite.
**Usage:**
```tomo
-isinf(n: Num) -> Bool
+isinf(n: Num -> Bool)
```
**Parameters:**
@@ -681,7 +681,7 @@ Checks if a number is NaN (Not a Number).
**Usage:**
```tomo
-isnan(n: Num) -> Bool
+isnan(n: Num -> Bool)
```
**Parameters:**
@@ -708,7 +708,7 @@ Computes the Bessel function of the first kind of order 0.
**Usage:**
```tomo
-j0(x: Num) -> Num
+j0(x: Num -> Num)
```
**Parameters:**
@@ -733,7 +733,7 @@ Computes the Bessel function of the first kind of order 1.
**Usage:**
```tomo
-j1(x: Num) -> Num
+j1(x: Num -> Num)
```
**Parameters:**
@@ -758,7 +758,7 @@ Computes the base-10 logarithm of a number.
**Usage:**
```tomo
-log10(x: Num) -> Num
+log10(x: Num -> Num)
```
**Parameters:**
@@ -783,7 +783,7 @@ Computes \( \log(1 + x) \) for a number.
**Usage:**
```tomo
-log1p(x: Num) -> Num
+log1p(x: Num -> Num)
```
**Parameters:**
@@ -808,7 +808,7 @@ Computes the base-2 logarithm of a number.
**Usage:**
```tomo
-log2(x: Num) -> Num
+log2(x: Num -> Num)
```
**Parameters:**
@@ -833,7 +833,7 @@ Computes the natural logarithm (base \( e \)) of a number.
**Usage:**
```tomo
-log(x: Num) -> Num
+log(x: Num -> Num)
```
**Parameters:**
@@ -858,7 +858,7 @@ Computes the binary exponent (base-2 logarithm) of a number.
**Usage:**
```tomo
-logb(x: Num) -> Num
+logb(x: Num -> Num)
```
**Parameters:**
@@ -883,7 +883,7 @@ Interpolates between two numbers based on a given amount.
**Usage:**
```tomo
-mix(amount: Num, x: Num, y: Num) -> Num
+mix(amount: Num, x: Num, y: Num -> Num)
```
**Parameters:**
@@ -912,7 +912,7 @@ Generates a NaN (Not a Number) value.
**Usage:**
```tomo
-nan(tag: Text = "") -> Num
+nan(tag: Text = "" -> Num)
```
**Parameters:**
@@ -939,7 +939,7 @@ small enough, they are considered near each other.
**Usage:**
```tomo
-near(x: Num, y: Num, ratio: Num = 1e-9, min_epsilon: Num = 1e-9) -> Bool
+near(x: Num, y: Num, ratio: Num = 1e-9, min_epsilon: Num = 1e-9 -> Bool)
```
**Parameters:**
@@ -973,7 +973,7 @@ Computes the next representable value after a given number towards a specified d
**Usage:**
```tomo
-nextafter(x: Num, y: Num) -> Num
+nextafter(x: Num, y: Num -> Num)
```
**Parameters:**
@@ -999,7 +999,7 @@ Generates a random floating-point number.
**Usage:**
```tomo
-random() -> Num
+random(->Num)
```
**Parameters:**
@@ -1023,7 +1023,7 @@ Rounds a number to the nearest integer, with ties rounded to the nearest even in
**Usage:**
```tomo
-rint(x: Num) -> Num
+rint(x: Num -> Num)
```
**Parameters:**
@@ -1050,7 +1050,7 @@ Rounds a number to the nearest whole number integer.
**Usage:**
```tomo
-round(x: Num) -> Num
+round(x: Num -> Num)
```
**Parameters:**
@@ -1077,7 +1077,7 @@ Formats a number in scientific notation with a specified precision.
**Usage:**
```tomo
-scientific(n: Num, precision: Int = 0) -> Text
+scientific(n: Num, precision: Int = 0 -> Text)
```
**Parameters:**
@@ -1103,7 +1103,7 @@ Extracts the significand (or mantissa) of a number.
**Usage:**
```tomo
-significand(x: Num) -> Num
+significand(x: Num -> Num)
```
**Parameters:**
@@ -1128,7 +1128,7 @@ Computes the sine of a number (angle in radians).
**Usage:**
```tomo
-sin(x: Num) -> Num
+sin(x: Num -> Num)
```
**Parameters:**
@@ -1153,7 +1153,7 @@ Computes the hyperbolic sine of a number.
**Usage:**
```tomo
-sinh(x: Num) -> Num
+sinh(x: Num -> Num)
```
**Parameters:**
@@ -1178,7 +1178,7 @@ Computes the square root of a number.
**Usage:**
```tomo
-sqrt(x: Num) -> Num
+sqrt(x: Num -> Num)
```
**Parameters:**
@@ -1203,7 +1203,7 @@ Computes the tangent of a number (angle in radians).
**Usage:**
```tomo
-tan(x: Num) -> Num
+tan(x: Num -> Num)
```
**Parameters:**
@@ -1228,7 +1228,7 @@ Computes the hyperbolic tangent of a number.
**Usage:**
```tomo
-tanh(x: Num) -> Num
+tanh(x: Num -> Num)
```
**Parameters:**
@@ -1253,7 +1253,7 @@ Computes the gamma function of a number.
**Usage:**
```tomo
-tgamma(x: Num) -> Num
+tgamma(x: Num -> Num)
```
**Parameters:**
@@ -1278,7 +1278,7 @@ Truncates a number to the nearest integer towards zero.
**Usage:**
```tomo
-trunc(x: Num) -> Num
+trunc(x: Num -> Num)
```
**Parameters:**
@@ -1305,7 +1305,7 @@ Computes the Bessel function of the second kind of order 0.
**Usage:**
```tomo
-y0(x: Num) -> Num
+y0(x: Num -> Num)
```
**Parameters:**
@@ -1330,7 +1330,7 @@ Computes the Bessel function of the second kind of order 1.
**Usage:**
```tomo
-y1(x: Num) -> Num
+y1(x: Num -> Num)
```
**Parameters:**
@@ -1356,7 +1356,7 @@ that range.
**Usage:**
```tomo
-clamped(x, low, high: Num) -> Num
+clamped(x, low, high: Num -> Num)
```
**Parameters:**
diff --git a/docs/paths.md b/docs/paths.md
index b1f03fff..530560a4 100644
--- a/docs/paths.md
+++ b/docs/paths.md
@@ -45,7 +45,7 @@ it doesn't already exist. Failure to write will result in a runtime error.
**Usage:**
```markdown
-append(path: Path, text: Text, permissions: Int32 = 0o644[32]) -> Void
+append(path: Path, text: Text, permissions: Int32 = 0o644[32] -> Void)
```
**Parameters:**
@@ -72,7 +72,7 @@ it doesn't already exist. Failure to write will result in a runtime error.
**Usage:**
```markdown
-append_bytes(path: Path, bytes: [Byte], permissions: Int32 = 0o644[32]) -> Void
+append_bytes(path: Path, bytes: [Byte], permissions: Int32 = 0o644[32] -> Void)
```
**Parameters:**
@@ -98,7 +98,7 @@ Returns the base name of the file or directory at the specified path.
**Usage:**
```markdown
-base_name(path: Path) -> Text
+base_name(path: Path -> Text)
```
**Parameters:**
@@ -124,7 +124,7 @@ or returns a null value if the file could not be opened.
**Usage:**
```markdown
-by_line(path: Path) -> (func()->Text?)?
+by_line(path: Path -> (func()->Text?)?)
```
**Parameters:**
@@ -158,7 +158,7 @@ Returns a list of children (files and directories) within the directory at the s
**Usage:**
```markdown
-children(path: Path, include_hidden=no) -> [Path]
+children(path: Path, include_hidden=no -> [Path])
```
**Parameters:**
@@ -185,7 +185,7 @@ any of the parent directories do not exist, they will be created as needed.
**Usage:**
```markdown
-create_directory(path: Path, permissions=0o755[32]) -> Void
+create_directory(path: Path, permissions=0o755[32] -> Void)
```
**Parameters:**
@@ -210,7 +210,7 @@ Checks if a file or directory exists at the specified path.
**Usage:**
```markdown
-exists(path: Path) -> Bool
+exists(path: Path -> Bool)
```
**Parameters:**
@@ -235,7 +235,7 @@ Returns the file extension of the file at the specified path. Optionally returns
**Usage:**
```markdown
-extension(path: Path, full=yes) -> Text
+extension(path: Path, full=yes -> Text)
```
**Parameters:**
@@ -269,7 +269,7 @@ Returns a list of files within the directory at the specified path. Optionally i
**Usage:**
```markdown
-files(path: Path, include_hidden=no) -> [Path]
+files(path: Path, include_hidden=no -> [Path])
```
**Parameters:**
@@ -295,7 +295,7 @@ Checks if the path represents a directory. Optionally follows symbolic links.
**Usage:**
```markdown
-is_directory(path: Path, follow_symlinks=yes) -> Bool
+is_directory(path: Path, follow_symlinks=yes -> Bool)
```
**Parameters:**
@@ -324,7 +324,7 @@ Checks if the path represents a file. Optionally follows symbolic links.
**Usage:**
```markdown
-is_file(path: Path, follow_symlinks=yes) -> Bool
+is_file(path: Path, follow_symlinks=yes -> Bool)
```
**Parameters:**
@@ -353,7 +353,7 @@ Checks if the path represents a socket. Optionally follows symbolic links.
**Usage:**
```markdown
-is_socket(path: Path, follow_symlinks=yes) -> Bool
+is_socket(path: Path, follow_symlinks=yes -> Bool)
```
**Parameters:**
@@ -379,7 +379,7 @@ Checks if the path represents a symbolic link.
**Usage:**
```markdown
-is_symlink(path: Path) -> Bool
+is_symlink(path: Path -> Bool)
```
**Parameters:**
@@ -404,7 +404,7 @@ Returns the parent directory of the file or directory at the specified path.
**Usage:**
```markdown
-parent(path: Path) -> Path
+parent(path: Path -> Path)
```
**Parameters:**
@@ -430,7 +430,7 @@ file could not be read.
**Usage:**
```markdown
-read(path: Path) -> Text?
+read(path: Path -> Text?)
```
**Parameters:**
@@ -460,7 +460,7 @@ file could not be read.
**Usage:**
```markdown
-read_bytes(path: Path) -> [Byte]?
+read_bytes(path: Path -> [Byte]?)
```
**Parameters:**
@@ -489,7 +489,7 @@ Returns the path relative to a given base path. By default, the base path is the
**Usage:**
```markdown
-relative(path: Path, relative_to=(./)) -> Path
+relative(path: Path, relative_to=(./) -> Path)
```
**Parameters:**
@@ -515,7 +515,7 @@ Removes the file or directory at the specified path. A runtime error is raised i
**Usage:**
```markdown
-remove(path: Path, ignore_missing=no) -> Void
+remove(path: Path, ignore_missing=no -> Void)
```
**Parameters:**
@@ -540,7 +540,7 @@ Resolves the absolute path of the given path relative to a base path. By default
**Usage:**
```markdown
-resolved(path: Path, relative_to=(./)) -> Path
+resolved(path: Path, relative_to=(./) -> Path)
```
**Parameters:**
@@ -569,7 +569,7 @@ Returns a list of subdirectories within the directory at the specified path. Opt
**Usage:**
```markdown
-subdirectories(path: Path, include_hidden=no) -> [Path]
+subdirectories(path: Path, include_hidden=no -> [Path])
```
**Parameters:**
@@ -598,7 +598,7 @@ Generates a unique directory path based on the given path. Useful for creating t
**Usage:**
```markdown
-unique_directory(path: Path) -> Path
+unique_directory(path: Path -> Path)
```
**Parameters:**
@@ -629,7 +629,7 @@ writing cannot be successfully completed, a runtime error is raised.
**Usage:**
```markdown
-write(path: Path, text: Text, permissions=0o644[32]) -> Void
+write(path: Path, text: Text, permissions=0o644[32] -> Void)
```
**Parameters:**
@@ -657,7 +657,7 @@ writing cannot be successfully completed, a runtime error is raised.
**Usage:**
```markdown
-write(path: Path, bytes: [Byte], permissions=0o644[32]) -> Void
+write(path: Path, bytes: [Byte], permissions=0o644[32] -> Void)
```
**Parameters:**
@@ -685,7 +685,7 @@ files.
**Usage:**
```markdown
-write_unique(path: Path, text: Text) -> Path
+write_unique(path: Path, text: Text -> Path)
```
**Parameters:**
@@ -717,7 +717,7 @@ files.
**Usage:**
```markdown
-write_unique_bytes(path: Path, bytes: [Byte]) -> Path
+write_unique_bytes(path: Path, bytes: [Byte] -> Path)
```
**Parameters:**
diff --git a/docs/ranges.md b/docs/ranges.md
index 4771bd58..6565f94d 100644
--- a/docs/ranges.md
+++ b/docs/ranges.md
@@ -20,7 +20,7 @@ Returns a reversed copy of the range.
**Usage:**
```tomo
-reversed(range: Range) -> Range
+reversed(range: Range -> Range)
```
**Parameters:**
@@ -45,7 +45,7 @@ Creates a new range with a specified step value.
**Usage:**
```tomo
-by(range: Range, step: Int) -> Range
+by(range: Range, step: Int -> Range)
```
**Parameters:**
diff --git a/docs/sets.md b/docs/sets.md
index 850d1443..a0a17784 100644
--- a/docs/sets.md
+++ b/docs/sets.md
@@ -82,7 +82,7 @@ Checks if the set contains a specified item.
**Usage:**
```tomo
-has(set:{T}, item:T) -> Bool
+has(set:{T}, item:T -> Bool)
```
**Parameters:**
@@ -108,7 +108,7 @@ Adds an item to the set.
**Usage:**
```tomo
-add(set:{T}, item: T) -> Void
+add(set:{T}, item: T -> Void)
```
**Parameters:**
@@ -133,7 +133,7 @@ Adds multiple items to the set.
**Usage:**
```tomo
-add_all(set:&{T}, items: [T]) -> Void
+add_all(set:&{T}, items: [T] -> Void)
```
**Parameters:**
@@ -158,7 +158,7 @@ Removes an item from the set.
**Usage:**
```tomo
-remove(set:&{T}, item: T) -> Void
+remove(set:&{T}, item: T -> Void)
```
**Parameters:**
@@ -183,7 +183,7 @@ Removes multiple items from the set.
**Usage:**
```tomo
-remove_all(set:&{T}, items: [T]) -> Void
+remove_all(set:&{T}, items: [T] -> Void)
```
**Parameters:**
@@ -208,7 +208,7 @@ Removes all items from the set.
**Usage:**
```tomo
-clear(set:&{T}) -> Void
+clear(set:&{T} -> Void)
```
**Parameters:**
@@ -232,7 +232,7 @@ Creates a new set that is the union of the original set and another set.
**Usage:**
```tomo
-with(set:{T}, other: {T}) -> {T}
+with(set:{T}, other: {T} -> {T})
```
**Parameters:**
@@ -258,7 +258,7 @@ Creates a new set with items that are in both the original set and another set.
**Usage:**
```tomo
-overlap(set:{T}, other: {T}) -> {T}
+overlap(set:{T}, other: {T} -> {T})
```
**Parameters:**
@@ -284,7 +284,7 @@ Creates a new set with items from the original set but without items from anothe
**Usage:**
```tomo
-without(set:{T}, other: {T}) -> {T}
+without(set:{T}, other: {T} -> {T})
```
**Parameters:**
@@ -310,7 +310,7 @@ Checks if the set is a subset of another set.
**Usage:**
```tomo
-set:is_subset_of(other: {T}, strict: Bool = no) -> Bool
+set:is_subset_of(other: {T}, strict: Bool = no -> Bool)
```
**Parameters:**
@@ -337,7 +337,7 @@ Checks if the set is a superset of another set.
**Usage:**
```tomo
-is_superset_of(set:{T}, other: {T}, strict: Bool = no) -> Bool
+is_superset_of(set:{T}, other: {T}, strict: Bool = no -> Bool)
```
**Parameters:**
diff --git a/docs/tables.md b/docs/tables.md
index f589eb2e..e0c9ff38 100644
--- a/docs/tables.md
+++ b/docs/tables.md
@@ -118,7 +118,7 @@ not already in the table, its value will be assumed to be zero.
**Usage:**
```markdown
-bump(t:{K:V}, key: K, amount: Int = 1) -> Void
+bump(t:{K:V}, key: K, amount: Int = 1 -> Void)
```
**Parameters:**
@@ -148,7 +148,7 @@ Removes all key-value pairs from the table.
**Usage:**
```markdown
-t:clear() -> Void
+t:clear()
```
**Parameters:**
@@ -172,7 +172,7 @@ Retrieves the value associated with a key, or returns null if the key is not pre
**Usage:**
```markdown
-t:get(key: K) -> V?
+t:get(key: K -> V?)
```
**Parameters:**
@@ -208,7 +208,7 @@ Checks if the table contains a specified key.
**Usage:**
```markdown
-has(t:{K:V}, key: K) -> Bool
+has(t:{K:V}, key: K -> Bool)
```
**Parameters:**
@@ -236,7 +236,7 @@ Removes the key-value pair associated with a specified key.
**Usage:**
```markdown
-remove(t:{K:V}, key: K) -> Void
+remove(t:{K:V}, key: K -> Void)
```
**Parameters:**
@@ -264,7 +264,7 @@ Sets or updates the value associated with a specified key.
**Usage:**
```markdown
-set(t:{K:V}, key: K, value: V) -> Void
+set(t:{K:V}, key: K, value: V -> Void)
```
**Parameters:**
diff --git a/docs/text.md b/docs/text.md
index 38369539..aca5c041 100644
--- a/docs/text.md
+++ b/docs/text.md
@@ -402,7 +402,7 @@ Converts a `Text` value to a C-style string.
**Usage:**
```tomo
-as_c_string(text: Text) -> CString
+as_c_string(text: Text -> CString)
```
**Parameters:**
@@ -428,7 +428,7 @@ the text.
**Usage:**
```tomo
-utf8_bytes(text: Text) -> [Byte]
+utf8_bytes(text: Text -> [Byte])
```
**Parameters:**
@@ -453,7 +453,7 @@ Returns an array of the names of each codepoint in the text.
**Usage:**
```tomo
-codepoint_names(text: Text) -> [Text]
+codepoint_names(text: Text -> [Text])
```
**Parameters:**
@@ -478,7 +478,7 @@ Returns an array of Unicode code points for UTF32 encoding of the text.
**Usage:**
```tomo
-utf32_codepoints(text: Text) -> [Int32]
+utf32_codepoints(text: Text -> [Int32])
```
**Parameters:**
@@ -503,7 +503,7 @@ Checks if the `Text` ends with a literal suffix text.
**Usage:**
```tomo
-ends_with(text: Text, suffix: Text) -> Bool
+ends_with(text: Text, suffix: Text -> Bool)
```
**Parameters:**
@@ -529,7 +529,7 @@ Converts a C-style string to a `Text` value.
**Usage:**
```tomo
-from_c_string(str: CString) -> Text
+from_c_string(str: CString -> Text)
```
**Parameters:**
@@ -556,7 +556,7 @@ resulting text's codepoints may not exactly match the input codepoints.
**Usage:**
```tomo
-from_codepoint_names(codepoint_names: [Text]) -> [Text]
+from_codepoint_names(codepoint_names: [Text] -> [Text])
```
**Parameters:**
@@ -589,7 +589,7 @@ match the input codepoints.
**Usage:**
```tomo
-from_codepoint_names(codepoints: [Int32]) -> [Text]
+from_codepoint_names(codepoints: [Int32] -> [Text])
```
**Parameters:**
@@ -616,7 +616,7 @@ match the input.
**Usage:**
```tomo
-from_codepoint_names(codepoints: [Int32]) -> [Text]
+from_codepoint_names(codepoints: [Int32] -> [Text])
```
**Parameters:**
@@ -642,7 +642,7 @@ See: [Patterns](#Patterns) for more information on patterns.
**Usage:**
```tomo
-find(text: Text, pattern: Pattern, start: Int = 1, length: &Int64? = !&Int64) -> Int
+find(text: Text, pattern: Pattern, start: Int = 1, length: &Int64? = !&Int64 -> Int)
```
**Parameters:**
@@ -685,7 +685,7 @@ See: [Patterns](#Patterns) for more information on patterns.
**Usage:**
```tomo
-find_all(text: Text, pattern: Pattern) -> [Text]
+find_all(text: Text, pattern: Pattern -> [Text])
```
**Parameters:**
@@ -727,7 +727,7 @@ Checks if the `Text` contains a target pattern (see: [Patterns](#Patterns)).
**Usage:**
```tomo
-has(text: Text, pattern: Pattern) -> Bool
+has(text: Text, pattern: Pattern -> Bool)
```
**Parameters:**
@@ -759,7 +759,7 @@ Joins an array of text pieces with a specified glue.
**Usage:**
```tomo
-join(glue: Text, pieces: [Text]) -> Text
+join(glue: Text, pieces: [Text] -> Text)
```
**Parameters:**
@@ -786,7 +786,7 @@ ignoring trailing newlines, and handling `\r\n` the same as `\n`.
**Usage:**
```tomo
-split(text: Text) -> [Text]
+split(text: Text -> [Text])
```
**Parameters:**
@@ -819,7 +819,7 @@ Converts all characters in the text to lowercase.
**Usage:**
```tomo
-lower(text: Text) -> Text
+lower(text: Text -> Text)
```
**Parameters:**
@@ -846,7 +846,7 @@ doesn't match the pattern.
**Usage:**
```tomo
-matches(text: Text, pattern: Pattern) -> [Text]
+matches(text: Text, pattern: Pattern -> [Text])
```
**Parameters:**
@@ -877,7 +877,7 @@ calling the given function on that text.
**Usage:**
```tomo
-map(text: Text, pattern: Pattern, fn: func(text:Text)->Text) -> Text
+map(text: Text, pattern: Pattern, fn: func(text:Text)->Text -> Text)
```
**Parameters:**
@@ -907,7 +907,7 @@ Formats the text as a quoted string.
**Usage:**
```tomo
-quoted(text: Text, color: Bool = no) -> Text
+quoted(text: Text, color: Bool = no -> Text)
```
**Parameters:**
@@ -933,7 +933,7 @@ Repeat some text multiple times.
**Usage:**
```tomo
-repeat(text: Text, count:Int) -> Text
+repeat(text: Text, count:Int -> Text)
```
**Parameters:**
@@ -961,7 +961,7 @@ See [Patterns](#patterns) for more information about patterns.
**Usage:**
```tomo
-replace(text: Text, pattern: Pattern, replacement: Text, backref: Pattern = $/\/, recursive: Bool = yes) -> Text
+replace(text: Text, pattern: Pattern, replacement: Text, backref: Pattern = $/\/, recursive: Bool = yes -> Text)
```
**Parameters:**
@@ -1030,7 +1030,7 @@ See [`replace()`](#replace) for more information about replacement behavior.
**Usage:**
```tomo
-replace_all(replacements:{Pattern:Text}, backref: Pattern = $/\/) -> Text
+replace_all(replacements:{Pattern:Text}, backref: Pattern = $/\/ -> Text)
```
**Parameters:**
@@ -1075,7 +1075,7 @@ See [Patterns](#patterns) for more information about patterns.
**Usage:**
```tomo
-split(text: Text, pattern: Pattern = "") -> [Text]
+split(text: Text, pattern: Pattern = "" -> [Text])
```
**Parameters:**
@@ -1111,7 +1111,7 @@ Checks if the `Text` starts with a literal prefix text.
**Usage:**
```tomo
-starts_with(text: Text, prefix: Text) -> Bool
+starts_with(text: Text, prefix: Text -> Bool)
```
**Parameters:**
@@ -1137,7 +1137,7 @@ Converts the text to title case (capitalizing the first letter of each word).
**Usage:**
```tomo
-title(text: Text) -> Text
+title(text: Text -> Text)
```
**Parameters:**
@@ -1163,7 +1163,7 @@ See [Patterns](#patterns) for more information about patterns.
**Usage:**
```tomo
-trim(text: Text, pattern: Pattern = $/{whitespace/, trim_left: Bool = yes, trim_right: Bool = yes) -> Text
+trim(text: Text, pattern: Pattern = $/{whitespace/, trim_left: Bool = yes, trim_right: Bool = yes -> Text)
```
**Parameters:**
@@ -1197,7 +1197,7 @@ Converts all characters in the text to uppercase.
**Usage:**
```tomo
-upper(text: Text) -> Text
+upper(text: Text -> Text)
```
**Parameters:**
diff --git a/docs/threads.md b/docs/threads.md
index 228fc8ac..1580df8c 100644
--- a/docs/threads.md
+++ b/docs/threads.md
@@ -13,7 +13,7 @@ Creates a new thread to execute a specified function.
**Usage:**
```tomo
-Thread.new(fn: func() -> Void) -> Thread
+Thread.new(fn: func(->Void) -> Thread)
```
**Parameters:**
@@ -47,7 +47,7 @@ Requests the cancellation of a specified thread.
**Usage:**
```tomo
-cancel(thread: Thread) -> Void
+cancel(thread: Thread)
```
**Parameters:**
@@ -71,7 +71,7 @@ Waits for a specified thread to terminate.
**Usage:**
```tomo
-join(thread: Thread) -> Void
+join(thread: Thread)
```
**Parameters:**
@@ -95,7 +95,7 @@ Detaches a specified thread, allowing it to run independently.
**Usage:**
```tomo
-detach(thread: Thread) -> Void
+detach(thread: Thread)
```
**Parameters:**