On this page:
stx-length
stx-length=?
stx-length<=?
stx-length>=?
8.12

2 list module🔗ℹ

 (require syntax/list) package: syntax-extension

procedure

(stx-length stx)  (or/c integer? #f)

  stx : syntax?
Get the length of syntax if it’s list-like syntax, or returns #f.

Examples:
> (stx-length #'(1 2 3))

3

> (stx-length #'(a b (c d) e))

4

> (stx-length #'a)

#f

> (stx-length #'())

0

procedure

(stx-length=? left right)  boolean?

  left : syntax?
  right : syntax?
Compare the length of left and right is different, and notice if one of left or right is not list-like syntax, than the result is always #f.

Examples:
> (stx-length=? #'(1 2 3) #'(a b c))

#t

> (stx-length=? #'(1 2 3) #'())

#f

> (stx-length=? #'(1 2 3) #'a)

#f

> (stx-length=? #'a #'b)

#f

procedure

(stx-length<=? left right)  boolean?

  left : syntax?
  right : syntax?
Just like stx-length=? but for <= relation.

Examples:
> (stx-length<=? #'(1) #'(a b c))

#t

> (stx-length<=? #'(1 2 3) #'())

#f

procedure

(stx-length>=? left right)  boolean?

  left : syntax?
  right : syntax?
Just like stx-length=? but for >= relation.

Examples:
> (stx-length>=? #'(1) #'(a b c))

#f

> (stx-length>=? #'(1 2 3) #'())

#t