#lang scheme/base
(require
"stack.ss"
"rep.ss")
(require
(for-syntax
scheme/base
"../tools-tx.ss"))
(provide
as-push as-void )
(define-syntax scheme->cat/perm
(syntax-rules ()
((_ combine fn (dsta ...) (srca ...))
(make-word
(stack-lambda (dsta ... . stack)
(combine (fn srca ...) stack))))))
(define-syntax scheme->cat/rev
(lambda (stx)
(syntax-case stx ()
((_ combine fn args ...)
#`(scheme->cat/perm combine fn
#,(stx-reverse #'(args ...)) (args ...))))))
(define-syntax as-push
(syntax-rules ()
((_ fn args ...) (scheme->cat/rev cons fn args ...))))
(define-syntax as-void
(syntax-rules ()
((_ fn args ...) (scheme->cat/rev begin fn args ...))))