(module stack-signature mzscheme
(provide provide-stack)
(require-for-syntax "macro-utilities.scm")
(define-syntax (provide-stack stx)
(syntax-case stx ()
[(_)
(with-captures stx
(elements
empty
empty?
insert
insert*
remove remove-first
first
first+remove
fold
size
stack?
stack-ec
:stack
)
(quasisyntax/loc stx
(begin
(require (prefix : (lib "contract.ss")))
(define compare/c (:flat-named-contract 'compare-function procedure?))
(define stack/c (:flat-named-contract 'stack stack?))
(define list/c (:flat-named-contract 'list (lambda (o) (or (null? o) (pair? o)))))
(define boolean/c (:flat-named-contract 'boolean boolean?))
(define any/c :any/c)
(provide :stack stack-ec)
(provide empty)
(provide (rename insert push))
#,(quasisyntax/loc stx
(:provide/contract
(elements
(:-> stack/c list/c))
(empty? (:-> stack/c boolean/c))
(insert (:-> any/c stack/c stack/c))
(insert* (:-> list/c stack/c stack/c))
(remove
(:-> stack/c stack/c))
(remove-first
(:-> stack/c stack/c))
(first
(:-> stack/c any/c))
(first+remove
(:->* (stack/c) (any/c stack/c)))
(fold (:-> (:-> any/c any/c any/c) any/c stack/c any/c))
(size (:-> stack/c :natural-number/c))
(stack? (:-> :any/c boolean/c))
)))))]))
)