added stx-map to syntax/stx from unstable/syntax

This commit is contained in:
Ryan Culpepper 2011-04-07 07:25:43 -06:00
parent 86f65468d7
commit 76c75d5a87
2 changed files with 15 additions and 0 deletions

View File

@ -37,6 +37,13 @@ Takes the car of a @techlink[#:doc refman]{syntax pair}.}
Takes the cdr of a @techlink[#:doc refman]{syntax pair}.}
@defproc[(stx-map [proc procedure?]
[stxl stx-list?] ...)
list?]{
Equivalent to @racket[(map proc (stx->list stxl) ...)].
}
@defproc[(module-or-top-identifier=? [a-id identifier?]
[b-id identifier?])
boolean?]{

View File

@ -7,6 +7,7 @@
(provide stx-null? stx-pair? stx-list?
stx-car stx-cdr stx->list
stx-map
module-or-top-identifier=?)
;; a syntax null?
@ -70,6 +71,13 @@
#f))))
e))))
(define (stx-map f . stxls)
(for ([stxl (in-list stxls)]
[i (in-naturals)])
(unless (stx-list? stxl)
(apply raise-type-error 'stx-map "stx-list" i stxls)))
(apply map f (map stx->list stxls)))
(define (module-or-top-identifier=? a b)
(or (free-identifier=? a b)
(and (eq? (syntax-e a) (syntax-e b))