#lang scheme/base
(provide
compositions with-compositions
snarf as-void as-push)
(require
"../tools.ss"
"ns.ss"
"snarf.ss"
(for-syntax
"rpn-tx.ss"
"ns-tx.ss"
"../tools.ss"
scheme/base))
(define-sr (compositions dst-ns fn: (name . body) ...)
(redefinitions!-ns dst-ns (name (fn: . body)) ...))
(define-sr (with-compositions dst-ns fn: (name . body) ...)
(lambda (thunk)
(parameterize-words-ns!
dst-ns ((name (fn: . body)) ...)
(thunk))))
(define-sr (snarf tx ns (formals (fn ...)) ...)
(begin (row tx ns (formals (fn ...))) ...))
(define-sr (row tx ns (formals (fn/tofrom ...)))
(begin (word tx ns formals fn/tofrom) ...))
(define-syntax word
(syntax-rules ()
((_ tx ns a (to from))
(pre/to/from tx ns to from . a))
((_ tx ns a fn)
(word tx ns a (fn fn)))))
(define-sr (pre/to/from snarfer ns to from . args)
(define-ns ns to (snarfer from . args)))