diff options
| -rw-r--r-- | docs/type_system/fn.md | 34 | ||||
| -rw-r--r-- | docs/type_system/namespace.md | 19 | ||||
| -rw-r--r-- | docs/type_system/union.md | 13 |
3 files changed, 45 insertions, 21 deletions
diff --git a/docs/type_system/fn.md b/docs/type_system/fn.md index 6a954bf..0b8c844 100644 --- a/docs/type_system/fn.md +++ b/docs/type_system/fn.md @@ -8,39 +8,31 @@ Fn_class `alias Enum[.partial; .complete; .iterator; .closure; .bound; .regex; . Fn[Fn_class; RETURN_TYPE; ARGS; STATE; List] ``` -## Transient Union Return - -### \`return_value - -### \`return_error - -### \`return_some - -### \`return_none +## \`return ## Transient Union Return Chaining # Iterating -## \`has_next - -## Transient Union Yield - -### \`yield_value - -### \`yield_error +## \`yield -### \`yield_some +Yielding wraps the value in the transient union `Next` -### \`yield_none +Return `Void` to stop iteration ```text -fn : Fn[x] $ ( @ 1 .. x { `yield_some 2 * x } ) +fn : Fn[x] $ ( @ 1 .. x { `yield 2 * x } ) it : fn `sync 10 // invoking -@ it { `log v }[v] // Opton[Int[...]].v $ (.some : 2); Opton[Int[...]].v $ (.some : 4) +@ it { `log v }[v] // 2 4 6 8 10 12 14 16 18 20 // same as above -@ `has_next it { `log `call_sync it } +@ { + # `call_sync it { + .value { `log v }[v] + .done { `break } + .error { `return e }[e] + } +} ``` # Calling diff --git a/docs/type_system/namespace.md b/docs/type_system/namespace.md index fc1d238..c3b79f1 100644 --- a/docs/type_system/namespace.md +++ b/docs/type_system/namespace.md @@ -2,6 +2,25 @@ --- +```text +Namespace_class `alias Enum[.native; .file] +Namespace[Namespace_class; ...] +``` + A file with code ## Exports + +### \`export + +## Imports + +### \`import + +### \`use + +## Main + +### \`is_main + +Run this function if the file is not imported diff --git a/docs/type_system/union.md b/docs/type_system/union.md index 0f8b65b..1df65a8 100644 --- a/docs/type_system/union.md +++ b/docs/type_system/union.md @@ -27,6 +27,8 @@ Can only be retuned from functions and operations. The inner value must be moved Result[ANY] `alias Union[.transient; ANY.value; Error.error] Option[ANY] `alias Union[.transient; ANY.some; Void.none] + +Next[Any] `alias Union[.transient; ANY.value; Void.done; Error.error] ``` ## Default Operation @@ -39,3 +41,14 @@ If the type is not the first specified a result with an error is returned to the z : x / y // Result[Int[...]] z // is value if y is not zero ``` +## Operators + +### \`value + +### \`error + +### \`some + +### \`none + + |
