Unicode escapes, variadic infix fix, spreads demos, scoped-effects + foundations plans
- Add \uXXXX unicode escape support to parser.py and parser.sx spec - Add char-from-code primitive (Python chr(), JS String.fromCharCode()) - Fix variadic infix operators in both bootstrappers (js.sx, py.sx) — (+ a b c d) was silently dropping terms, now left-folds correctly - Rebootstrap sx_ref.py and sx-browser.js with all fixes - Fix 3 pre-existing map-dict test failures in shared/sx/tests/run.py - Add live demos alongside examples in spreads essay (side-by-side layout) - Add scoped-effects plan: algebraic effects as unified foundation for spread/collect/island/lake/signal/context - Add foundations plan: CEK machine, the computational floor, three-axis model (depth/topology/linearity), Curry-Howard correspondence - Route both plans in page-functions.sx and nav-data.sx Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -830,11 +830,21 @@
|
||||
|
||||
(define py-emit-infix
|
||||
(fn ((op :as string) (args :as list) (cell-vars :as list))
|
||||
(let ((py-op (py-op-symbol op)))
|
||||
(if (and (= (len args) 1) (= op "-"))
|
||||
(str "(-" (py-expr-with-cells (first args) cell-vars) ")")
|
||||
(str "(" (py-expr-with-cells (first args) cell-vars)
|
||||
" " py-op " " (py-expr-with-cells (nth args 1) cell-vars) ")")))))
|
||||
(let ((py-op (py-op-symbol op))
|
||||
(n (len args)))
|
||||
(cond
|
||||
(and (= n 1) (= op "-"))
|
||||
(str "(-" (py-expr-with-cells (first args) cell-vars) ")")
|
||||
(= n 2)
|
||||
(str "(" (py-expr-with-cells (first args) cell-vars)
|
||||
" " py-op " " (py-expr-with-cells (nth args 1) cell-vars) ")")
|
||||
;; Variadic: left-fold (a op b op c op d ...)
|
||||
:else
|
||||
(let ((result (py-expr-with-cells (first args) cell-vars)))
|
||||
(for-each (fn (arg)
|
||||
(set! result (str "(" result " " py-op " " (py-expr-with-cells arg cell-vars) ")")))
|
||||
(rest args))
|
||||
result)))))
|
||||
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user