diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/index.md | 2 | ||||
| -rw-r--r-- | docs/language/ownership.md | 2 | ||||
| -rw-r--r-- | docs/type_system/empty.md | 2 | ||||
| -rw-r--r-- | docs/type_system/function.md (renamed from docs/type_system/fn.md) | 24 | ||||
| -rw-r--r-- | docs/type_system/index.md | 2 | ||||
| -rw-r--r-- | docs/type_system/overload.md | 2 |
6 files changed, 21 insertions, 13 deletions
diff --git a/docs/index.md b/docs/index.md index 64071a8..5d8ba9d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -30,7 +30,7 @@ readFile("filename", callback(data)) // Continue while readFile is running // --- langauge equivalent // Do Soemthing -Fn[name; callback] $ ( +([name; callback] `use "io" [open; read] callback `sync read `sync open `sync name ) `async ("filename"; callback) diff --git a/docs/language/ownership.md b/docs/language/ownership.md index 9af214b..71e15a7 100644 --- a/docs/language/ownership.md +++ b/docs/language/ownership.md @@ -21,7 +21,7 @@ References are automatically taken if the function signature specifies ref ```text -inc_push_to_ref : Fn[Ref.x; y] $ ( +inc_push_to_ref : ([Ref.x; y] x `push y + 1 ) int_array : Array[I64] $ () diff --git a/docs/type_system/empty.md b/docs/type_system/empty.md index 55bdcf1..6097711 100644 --- a/docs/type_system/empty.md +++ b/docs/type_system/empty.md @@ -7,7 +7,7 @@ Container type can be null ## Use with `Option` Union ```text -make_array : Fn[yes] $ ( +make_array : ([yes] ? yes { `some Array $ (1; 2; 3) `nome diff --git a/docs/type_system/fn.md b/docs/type_system/function.md index 1bf88c5..ebd14ea 100644 --- a/docs/type_system/fn.md +++ b/docs/type_system/function.md @@ -1,21 +1,29 @@ -# Fn +# Function --- ```text -Fn_class `alias Enum[ +Function_class `alias Enum[ .unknown; .incomplete; .native .task; process; .generator; .iterator; .closure; .bound; .regex ] -Fn[Fn_class; RETURN_TYPE; Collection[ARGS]; STATE; List] +Function[Function_class; RETURN_TYPE; Collection[TYPE.SYMBOL]; STATE; List] +``` + +# Alias -Fn[Fn_class; RETURN_TYPE; ARGS...] -Fn[RETURN_TYPE; ARGS...] -Fn[Fn_class; ARGS...] -Fn[ARGS...] +```text +Fn[Generic.T; Collection[TYPE.SYMBOL]] `alias Function[Any; Generic.T; Collection[TYPE.SYMBOL]; STATE; List] +``` + +# Inline Definition + +```text +([x; y] x + y) // Fn[Any; Any.x; Any.y] +([I64.x; y] x + y) // Fn[Any; I64.x; Any.y] ``` # Function Classes @@ -75,7 +83,7 @@ Yielding wraps the value in the transient union `Next` Return `Void` to stop iteration ```text -fn : Fn[n] $ ( @ 1 < n {[x] `yield 2 * x; n +: 1 } ) +fn : ([n] @ 1 < n {[x] `yield 2 * x; n +: 1 } ) it : fn `sync 10 // invoking @ it {[v] `log v } // 2 4 6 8 10 12 14 16 18 20 diff --git a/docs/type_system/index.md b/docs/type_system/index.md index ece02b1..2d39963 100644 --- a/docs/type_system/index.md +++ b/docs/type_system/index.md @@ -72,7 +72,7 @@ Denotes that a field that does not resolve to anything * #### [Var](./var.md) -* #### [Fn](./fn.md) +* #### [Function](./function.md) * #### [Task](./task.md) diff --git a/docs/type_system/overload.md b/docs/type_system/overload.md index 11bf21d..9fd839e 100644 --- a/docs/type_system/overload.md +++ b/docs/type_system/overload.md @@ -11,7 +11,7 @@ Overload[Collection[FNS]] ## Example ```text -add : Overload[Fn[.native; I64; Tuple[I64.x; I64.y]; ...]; Fn[.native; F64; Tuple[F64.x; F64.y]; ...]; ...] +add : Overload[Fn[I64; I64.x; I64.y]; Fn[F64; F64.x; F64.y]; ...] `log add `sync (1; 2) // Valid calls first `log add `sync (1.1; 2.2) // Valid calls second |
