added stx-map to syntax/stx from unstable/syntax
This commit is contained in:
parent
86f65468d7
commit
76c75d5a87
|
@ -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?]{
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue
Block a user