S-expression: atom or parenthesized list. Whitespace is collapsed.
Program result = read → expand → evaluate → print.
REPL
Atoms (plus the usual string & math functions)
1 2 3 4 5 6 7 8 9 10 | 42+3i 1/3 0.333 #b101010 #x2a #o52 "hello world" #\h #true #t #false ; yes, we have no falsiness #f 'sym (void) |
Datums: quote ' quasiquote unquote unquote-splicing `(short ,hand ,@notation) '(dotted . pair)
Variable = identifier + binding
Binding forms: define define-values let let* set!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | (for/list ([i (in-range 1 5)] [j (in-naturals 6)]) (list i j)) (for/fold ([sum 0]) ([i (in-range 1 5)] [j (in-naturals 6)]) (+ sum i j)) (for/sum ([i (in-range 1 5)] [j (in-naturals 6)]) (+ i j)) (apply + (apply append (for/list ([i (in-range 1 5)] [j (in-naturals 6)]) (list i j)))) |
Import & export: require provide rename-out
Syntax objects: syntax quasisyntax unsyntax unsyntax-splicing #`(short #,hand #,@notation) syntax/loc
Syntax patterns: ...
1 2 3 4 5 6 7 8 9 10 11 12 13 | (define-macro (dbl ARG) #'(list ARG ARG)) (define-macro-cases foo [(_ 42) #'"kaboom!"] [(_ ARG) #'(list ARG ARG)]) (define-macro (rev ARG0 "foo" ARG ...) #'(append (reverse (list 'ARG ...)) (list 'ARG0))) (define-macro (tell ARG ...) #'(for ([name (in-list (list 'ARG ...))]) (displayln (format "~a = ~a" name ARG)) ...)) |
Interposition points: #%app #%datum #%top-interaction #%module-begin
Comments: ;line #|block|# #;expr
In #lang br: #R debugging
If you already know how to write functions, make your own implementations of map and filter.
If you already know how to write macros, make your own implementations of apply, and, and or.