flow: Phase 1 declarative DAG — sequence/parallel/defflow combinators + 18 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s
Flow combinators as a Scheme prelude loaded onto scheme-standard-env; a flow is a Scheme procedure input->output, run inside the interpreter (sets up Phase 3 call/cc suspend). flow/start entry point, conformance runner, scoreboard. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
30
lib/flow/api.sx
Normal file
30
lib/flow/api.sx
Normal file
@@ -0,0 +1,30 @@
|
||||
;; lib/flow/api.sx — flow runtime entry points.
|
||||
;;
|
||||
;; Builds a Scheme env preloaded with the flow combinators (lib/flow/spec.sx)
|
||||
;; plus the public flow API, and provides SX helpers to run flow programs.
|
||||
;;
|
||||
;; Scheme-level API (available inside flow programs):
|
||||
;; (flow/start flow input) — run a flow with the given input, return result
|
||||
;;
|
||||
;; SX-level helpers (for hosts and tests):
|
||||
;; (flow-make-env) — fresh standard env + combinators + api
|
||||
;; (flow-run src) — eval a Scheme program string in a fresh flow env
|
||||
;; (flow-run-in env src) — eval a Scheme program string in a given env
|
||||
|
||||
(define flow-api-src "(define (flow/start flow input) (flow input))")
|
||||
|
||||
(define
|
||||
flow-make-env
|
||||
(fn
|
||||
()
|
||||
(let
|
||||
((env (scheme-standard-env)))
|
||||
(flow-load-combinators! env)
|
||||
(scheme-eval-program (scheme-parse-all flow-api-src) env)
|
||||
env)))
|
||||
|
||||
(define
|
||||
flow-run-in
|
||||
(fn (env src) (scheme-eval-program (scheme-parse-all src) env)))
|
||||
|
||||
(define flow-run (fn (src) (flow-run-in (flow-make-env) src)))
|
||||
Reference in New Issue
Block a user