diff options
Diffstat (limited to 'docs/type_system/fn.md')
| -rw-r--r-- | docs/type_system/fn.md | 34 |
1 files changed, 13 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 |
