"..." means zero or more repetitions of the preceding expression. it is only actually written in syntax patterns
boolean: #t #f
\\ \" \| \a \f \n \r \t \v \b \0
most ascii characters that are not control characters or whitespace are allowed. for example
test-identifier? ! $ % & * + - . / : < = > ? @ ^ _ ~
; ab c
#;(ab c) #;(abc (efg #;(nested even)))
(quote a) (quote (a b))
(if test consequent alternate) (if test consequent)
(lambda (formals ...) expression other-expressions ...) (lambda (a b c) (+ a b c)) (lambda (a b c . rest) expression other-expressions ...) (lambda a expression other-expressions ...)
body must contain at least one expression
( (lambda (a b) (display (+ a b))) 1 2) (apply (lambda (a b) (display (+ a b))) (list 1 2)) (define test (lambda (a b) (+ 1 a b))) (test 2 3)
(define a 1) (define b (+ 2 3))
( (lambda (a b) (+ a b)) 1 2)
(syntax-case syntax-object-name () (pattern expansion ...) ...)
(syntax-case s () ((_ a b) (syntax (+ a b))))
(syntax-case s () ( (_ a (b ...) ... c) (syntax (+ a (+ 1 b ...) ... c))) ((_ a) (syntax a)))
(define-syntax test (lambda (s) syntax-transformer)) (define-syntax test (lambda (s) (syntax-case s () ((_ a b) (syntax (+ a b))))))
(test 1 2)
(let-syntax ((test-1 syntax-transformer) (test-2 syntax-transformer)) (test 1 2)) (let-syntax ( (test (lambda (s) (syntax-case s () ((_ a b) (syntax (+ a b))))))) (test 1 2))
(begin any-expression ...)
the last expression is the result, unless the "begin" form is specified at the top-level. on the top-level the contents are merged with the series of other top-level expressions as if the enclosing "begin" where not there. this is to make it possible to create macros that create top-level restricted code like defines
; top-level (begin (define a 1) (define b 2))
same as
; top-level (define a 1) (define b 2)
based on forms of level 1
(quasiquote (+ 1 (unquote (+ 2 3)) (unquote (+ 4 5))))
(let ((a 1) (b 2)) a)
(let* ((a 1) (b (+ 2 a))) b)
(letrec ((a (lambda (b) (if (< b 10) (a (+ 1 b)) b))) (b (a 1))) b)
(define (a b c) (+ b c))
definition looks similar to application
(a 1 2) (apply a (list 1 2))
(let loop ((a 10) (b 2)) (if (> a 0) (loop (- a 1) b))) (let a () #t)
(syntax-case syntax-object () ((_ a b) (quasisyntax (+ 1 (unsyntax a) (unsyntax b))))) (syntax-case s () (syntax-case s () ((_ a b) (syntax (+ a b))))) (syntax-rules () ((_ b c) (+ b c)) ((_ b ...) (+ c b ...))) (syntax-rules (literal-keyword-to-match ...) ((_ b literal-keyword-to-match c) (+ b c)))
(define-syntax-rules (a b ... c d) (+ b ... c d)) (define-syntax a (syntax-rules () ((_ b c) (+ b c))))