#lang scheme/base
(require
"../tools.ss"
"../scat.ss"
"../rpn.ss"
"../ns.ss"
(for-syntax
"../ns-tx.ss"
scheme/base))
(provide (all-defined-out))
(define (make-ns-defined? sym)
(lambda (ns)
(namespace-variable-value
(ns-name ns sym) #t (lambda () #f))))
(define (live-interpret sym)
(define defined? (make-ns-defined? sym))
(cond
((defined? '(scat)) => (lambda (x) x))
((defined? '()) => (lambda (x) (scat-wrap-dynamic x)))
(else (error 'undefined "~s" sym))))
(define-syntax-rule (live: code ...)
(make-word
(rpn-parse (rpn:-compile (live) scat-apply scat-push scat-push live: (rpn-lambda) ) code ...)))
(define-syntax (live stx)
(syntax-case stx ()
((_ id)
(identifier? #'id)
#'(live-interpret 'id))))