Scheme Language Overview handout #8 Summary of basic Scheme features: Types: numbers: integers (3, 802), reals (3.4), rationals (3/4), complex (2+3.4i) symbols: x, y, hello, r2d2 booleans: #t, #f strings: "hello", "how are you?" lists: (3 4 5) (98.5 "hello" (3 82.9) 73) Constructs: function call: (f arg1 arg2 arg3 ... arg-n) variable binding: (define sym expr) function binding: (define (f p1 p2 ... pn) expr) function binding with helper functions: (define (f p1 p2 ... pn) (define ...) (define ...) expr) let binding: (let ([sym1 e1] [sym2 e2] ... [sym-n en]) expr) let* binding: (let* ([sym1 e1] [sym2 e2] ... [sym-n en]) expr) set! assignment: (set! sym expr) if expression: (if test e1 e2) cond expression: (cond (test1 e1) (test2 e2) ... (test-n e-n)) (cond (test1 e1) (test2 e2) ... (else e-n)) Useful functions arithmetic: +, -, *, /, modulo, quotient, remainder mathematical: abs, sin, cos, max, min, expt (exponent), sqrt, floor, ceiling, truncate, round relational (for numbers): =, <, >, <=, >= equality (for other structures): eq? (pointer), eqv? (value), equal? (deep) logical: and, or, not type predicates: number? integer? real? symbol? boolean? string? list? higher-order: map, filter, foldl, foldr, sort, andmap, ormap list operations: length -- length of a list car -- first element of a list cdr -- rest of the list cons -- takes a value and a list and constructs a new list with the value at the front and the list after append -- joins lists together list -- forms a list from a sequence of values member -- whether a value is in a list remove -- removes one occurrence of a value from a list null? -- is something an empty list? pair? -- is a list nonempty (assuming it's a list)?
Stuart Reges
Last modified: Mon May 18 09:48:11 PDT 2026