Add syntax-length to unstable/syntax.
This commit is contained in:
parent
83f38f4d3b
commit
0d771fb4f1
|
@ -100,6 +100,15 @@ Performs @racket[(map f (syntax->list stxl) ...)].
|
|||
(syntax-map syntax-e #'(a b c))]
|
||||
}
|
||||
|
||||
@addition{@author+email["Eric Dobson" "eric.n.dobson@gmail.com"]}
|
||||
|
||||
@defproc[(syntax-length [stx syntax?]) exact-nonnegative-integer?]{
|
||||
Performs @racket[(length (syntax->list stx))].
|
||||
|
||||
@examples[#:eval the-eval
|
||||
(syntax-length #'(d e f))]
|
||||
}
|
||||
|
||||
@addition[@author+email["Carl Eastlund" "cce@racket-lang.org"]]
|
||||
|
||||
@section{Syntax Object Source Locations}
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
|
||||
(provide (rename-out [stx-map syntax-map])
|
||||
|
||||
;; by endobson
|
||||
syntax-length
|
||||
|
||||
;; by cce:
|
||||
syntax-source-file-name
|
||||
syntax-source-directory
|
||||
|
@ -103,3 +106,9 @@
|
|||
[(id . args)
|
||||
(let ([stx* (cons #'(#%expression id) (cdr (syntax-e stx)))])
|
||||
(datum->syntax stx stx* stx))]))))
|
||||
|
||||
;; by endobson
|
||||
|
||||
(define (syntax-length stx)
|
||||
(let ((list (syntax->list stx)))
|
||||
(and list (length list))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user