spec: coroutine primitive — make-coroutine/resume/yield via perform/cek-step-loop
spec/coroutines.sx: define-library with make-coroutine, coroutine-resume, coroutine-yield, coroutine?, coroutine-alive?. Built on existing perform/ cek-step-loop/cek-resume suspension machinery. spec/tests/test-coroutines.sx: 17 tests — multi-yield, final return, arg passthrough, alive? predicate, nested coroutines, recursive iteration, independent coroutine interleaving. Key: coroutine body must use (define loop (fn…)) not named let — named let transpiles to cek_call→cek_run which rejects IO suspension. All 17/17 pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -797,3 +797,5 @@
|
||||
:params ((source :as string))
|
||||
:returns "list"
|
||||
:doc "Parse SX source string into a list of AST expressions.")
|
||||
|
||||
(define-module :stdlib.coroutines)
|
||||
|
||||
Reference in New Issue
Block a user