diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-06-02 16:26:09 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-06-02 16:26:09 -0400 |
| commit | b26ad08b39b8229dcea0bafc4a8ba4b0d7ad7154 (patch) | |
| tree | 1a469cc7f1ab2bbf2af42336518fa19ad0d0ed76 /docs/type_system/fn.md | |
| parent | ba087e5dbcc50537d82da5dbc602df7292d3f24c (diff) | |
reformat with sync and async calls
Diffstat (limited to 'docs/type_system/fn.md')
| -rw-r--r-- | docs/type_system/fn.md | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/docs/type_system/fn.md b/docs/type_system/fn.md index 5a723f6..b004560 100644 --- a/docs/type_system/fn.md +++ b/docs/type_system/fn.md @@ -3,7 +3,12 @@ --- ```text -Fn_class `alias Enum[.unknown; .incomplete; .native; process; .generator; .iterator; .closure; .bound; .regex] +Fn_class `alias Enum[ + .unknown; .incomplete; .native + .task; process; .generator; .iterator; .closure; + .bound; + .regex +] Fn[Fn_class; RETURN_TYPE; Tuple[ARGS]; STATE; List] ``` @@ -22,6 +27,10 @@ A function with an incomplete type, type checking occurs at invocation Native function wrapper +## Task + +A queue-able function in a process or iterator + ## Process A list of tasks with state @@ -62,12 +71,12 @@ Return `Void` to stop iteration ```text fn : Fn[n] $ ( @ 1 < n {[x] `yield 2 * x; n +: 1 } ) -it : fn `call 10 +it : fn `sync 10 // invoking @ it {[v] `log v } // 2 4 6 8 10 12 14 16 18 20 // same as above @ { - # `call it { + # `sync it { .value {[v] `log v } .done { `break } } @@ -76,15 +85,21 @@ it : fn `call 10 # Calling -## \`fork +## \`async + +Asynchronous call ```text -task : `fork fn -value : `join task +task : `async fn +value : `wait task ``` -## \`call +## \`sync + +Synchronous call + +If the callee is a process, an inline wait with async is used ```text -fn `call args // `join fn `task args +fn `sync args // can be turned into `wait fn `async args ``` |
