Next: , Previous: , Up: expander utils   [Index]


15.4.5 Pairs processing

Function: syntax-car stx
Function: syntax-car stx synner

Expect stx to be a syntax object holding pair; return a syntax object representing the car of stx.

(bound-identifier=? (syntax-car #'(display . write))
                    #'display)
⇒ #t
Function: syntax-cdr stx
Function: syntax-cdr stx synner

Expect stx to be a syntax object holding pair; return a syntax object representing the cdr of stx.

(bound-identifier=? (syntax-cdr #'(display . write))
                    #'write)
⇒ #t
Function: syntax->list stx
Function: syntax->list stx synner

Expect stx to be a syntax object holding a proper list of items; return a proper list holding the individual item syntax objects.

(for-all (lambda (obj1 obj2)
           (if (identifier? obj2)
               (bound-identifier=? obj1 obj2)
             (equal? obj1 obj2)))
  (syntax->list #'(display 123 write))
  (list #'display 123 #'write))
⇒ #t
Function: identifiers->list stx
Function: identifiers->list stx synner

Expect stx to be a syntax object holding a proper list of identifiers; return a proper list holding the individual identifiers.

(for-all bound-identifier=?
  (identifiers->list #'(display write))
  (list #'display #'write))
⇒ #t
Function: all-identifiers? stx

Return #t if stx is a syntax object representing the empty list or a proper list of identifiers, otherwise return #f.