summaryrefslogtreecommitdiff
path: root/docs/type_system/fn.md
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-05-17 14:43:15 -0400
committernodist <kevin.comas.git@gmail.com>2026-05-17 14:43:15 -0400
commitd9c68aa51521171b951d37c879ffee5ea64e21df (patch)
treecbe53328e0addaf84732c297e8c68f8e3687a743 /docs/type_system/fn.md
parent27937495dfd7a376538d8ef3834f12f5c8eb5c0d (diff)
use return and yield as keyword with union types passed
Diffstat (limited to 'docs/type_system/fn.md')
-rw-r--r--docs/type_system/fn.md34
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