(define-syntax if-identifier? (syntax-rules () ((if-symbol? (x . y) sk fk) fk) ((if-symbol? #(x ...) sk fk) fk) ((if-symbol? x sk fk) (let-syntax ((test (syntax-rules () ((test x sk* fk*) sk*) ((test non-x sk* fk*) fk*)))) (test foo sk fk))))) (define-syntax if-symbol? (syntax-rules (quote) ((if-symbol? (quote (x . y)) sk fk) fk) ((if-symbol? (quote x) sk fk) (let-syntax ((test (syntax-rules () ((test s sk* fk*) sk*) ((test non-x sk* fk*) fk*)))) (test x sk fk))) ((if-symbol? (x . y) sk fk) fk) ((if-symbol? #(x ...) sk fk) fk) ((if-symbol? x sk fk) fk))) (define-syntax if-keyword? (syntax-rules (quote) ((if-symbol? x sk fk) (let-syntax ((test (syntax-rules () ((test x sk* fk*) sk*) ((test non-x sk* fk*) fk*)))) (test (quote x) sk fk))) ((if-symbol? (x . y) sk fk) fk) ((if-symbol? #(x ...) sk fk) fk) ((if-symbol? x sk fk) fk))) (if-identifier? test (print "identifier") (print "not identifier")) (if-identifier? 'test (print "identifier") (print "not identifier")) (if-identifier? 123 (print "identifier") (print "not identifier")) (if-identifier? "asdf" (print "identifier") (print "not identifier")) (if-identifier? (a b c) (print "identifier") (print "not identifier")) (print '---) (if-symbol? 'test (print "symbol") (print "not symbol")) (if-symbol? test (print "symbol") (print "not symbol")) (if-symbol? 123 (print "symbol") (print "not symbol")) (if-symbol? #:test (print "symbol") (print "not symbol")) (if-symbol? '(test 12) (print "symbol") (print "not symbol")) (if-symbol? (test 12) (print "symbol") (print "not symbol")) (print '---) (if-keyword? #:test (print "keyword") (print "not keyword")) (if-keyword? 'test (print "keyword") (print "not keyword")) (if-keyword? 123 (print "keyword") (print "not keyword")) (if-keyword? "test" (print "keyword") (print "not keyword"))