Quick Reference for Scheme

Updated September 30, 1996

Here's a summary of the syntax of Scheme. There's nothing here about semantics (i.e. meanings). For that, check the Revised^4 Report on Programming Lanugage Scheme. (A PostScript version of that document may be found on the Scheme home page.) Reading everything in that document from the beginning through "Standard procedures" will give you everything you need.

;; FILE             "Scheme Sigs"
;; IMPLEMENTS   R^4RS Function Signature Synopsis
;; AUTHOR           Kenneth A Dickey
;; DATE             1992 October 2
;; LAST UPDATED 1992 October 3
;; NOTES:  Extracted from Amiga Gambit QuickTour file


  <object>      any Scheme data object.
  <object>*     zero or more objects
  <object>+     one or more objects
  [<object>]    optional object
  ( <whatever> )...   Zero or more occurances of ( <whatever> )


  (LAMBDA <name> <exp>+ )
  (LAMBDA (<name>* ) <exp>+ )
  (AND <exp>*)
  (OR  <exp>*)
  (IF <test-exp> <if-true> [<if-false>] )
  (COND (<test> <exp>* )... [(ELSE <exp>+)] )
  (CASE <key-exp> ((<datum>+ ) <exp>* )... [(ELSE <exp>+)] )
  (DEFINE ( <name> <name>* ) <exp>+ )
  (DEFINE <name> <exp> )
  (LET [<name>] ( (<vname> <value-exp>)... ) <exp>+ )
  (LET*   ( (<vname> <value-exp>)... ) <exp>+ )
  (LETREC ( (<vname> <value-exp>)... ) <exp>+ )
  (BEGIN <expression>+ )
  (DO ( (<var> <init> <step>)... ) ( <test> <exp>* ) <exp>* )
  ;; Note also R^4RS syntax, below

; IEEE Scheme

  (NOT <object>)
  (BOOLEAN? <object>)

  (EQ?    <obj1> <obj2>)
  (EQV?   <obj1> <obj2>)
  (EQUAL? <obj1> <obj2>)

  (PAIR? <object>)
  (CONS <obj1> <obj2>)
  (CAR <pair>)
  (CDR <pair>)
  (SET-CAR! <pair> <object>)
  (SET-CDR! <pair> <object>)
  (CAAR  <list>)   (CADR  <list>)   (CDAR  <list>)   (CDDR <list>)
  (CAAAR <list>)   (CAADR <list>)   (CADAR <list>)   (CADDR <list>)
  (CDAAR <list>)   (CDADR <list>)   (CDDAR <list>)   (CDDDR <list>)
  (CAAAAR <list>)  (CAAADR <list>)  (CAADAR <list>)  (CAADDR <list>)
  (CADAAR <list>)  (CADADR <list>)  (CADDAR <list>)  (CADDDR <list>)
  (CDAAAR <list>)  (CDAADR <list>)  (CDADAR <list>)  (CDADDR <list>)
  (CDDAAR <list>)  (CDDADR <list>)  (CDDDAR <list>)  (CDDDDR <list>)
  (NULL? <object>)
  (LIST? <object>)
  (LIST <object>* )
  (LENGTH <list>)
  (APPEND <list>+ )
  (REVERSE <list>)
  (LIST-REF <list> <index>)

  (MEMQ  <object> <list>)
  (MEMV  <object> <list>)
  (MEMBER <object> <list>)

  (ASSQ  <object> <alist>)
  (ASSV  <object> <alist>)
  (ASSOC <object> <alist>)

  (SYMBOL? <object>)  (SYMBOL->STRING <symbol>)  (STRING->SYMBOL <string>)

  (NUMBER? <object>)
  (COMPLEX? <object>)
  (REAL? <object>)
  (RATIONAL? <object>)
  (INTEGER? <object>)
  (EXACT? <number>)     (INEXACT? <number>)
  (=  <number>+ )
  (<  <number>+ )  (>  <number>+ )
  (<= <number>+ )  (>= <number>+ )
  (ZERO? <number>)
  (POSITIVE? <number>)  (NEGATIVE? <number>)
  (ODD? <number>)       (EVEN? <number>)
  (MAX <number>+ )      (MIN <number>+ )
  (+ <number>+ )
  (* <number>+ )
  (- <number>+ )
  (/ <number>+ )
  (ABS <number>)
  (QUOTIENT <num1> <num2>)  (REMAINDER <num1> <num2>)
  (MODULO <num1> <num2>)
  (GCD <number>* )          (LCM <number>* )
  (NUMERATOR <rational>)    (DENOMINATOR <rational>)
  (FLOOR <number>)          (CEILING <number>)
  (TRUNCATE <number>)       (ROUND <number>)
  (RATIONALIZE <num1> <num2>)
  (EXP <number>)            (LOG <number>)
  (SIN <number>)   (COS <number>)   (TAN <number>)
  (ASIN <number>)  (ACOS <number>)  (ATAN <number> [<number>])
  (SQRT <number>)
  (EXPT <num1> <num2>)
  (MAKE-RECTANGULAR <num1> <num2>)  (MAKE-POLAR <num1> <num2>)
  (REAL-PART <number>)       (IMAG-PART <number>)
  (MAGNITUDE <number>)       (ANGLE <number>)
  (EXACT->INEXACT <number>)  (INEXACT->EXACT <number>)
  (NUMBER->STRING <number>)  (STRING->NUMBER <string>)

  (CHAR? <object>)
  (CHAR=?  <char1> <char2>)  (CHAR-CI=?  <char1> <char2>)
  (CHAR<?  <char1> <char2>)  (CHAR-CI<?  <char1> <char2>)
  (CHAR>?  <char1> <char2>)  (CHAR-CI>?  <char1> <char2>)
  (CHAR<=? <char1> <char2>)  (CHAR-CI<=? <char1> <char2>)
  (CHAR>=? <char1> <char2>)  (CHAR-CI>=? <char1> <char2>)
  (CHAR-ALPHABETIC? <character>)
  (CHAR-NUMERIC?    <character>)
  (CHAR-WHITESPACE? <character>)
  (CHAR-UPPER-CASE? <character>)  (CHAR-LOWER-CASE? <character>)
  (CHAR->INTEGER <character>)     (INTEGER->CHAR    <integer>)
  (CHAR-UPCASE   <character>)     (CHAR-DOWNCASE    <character>)

  (STRING? <object>)
  (MAKE-STRING <length> [<character>] )
  (STRING <character>+ )
  (STRING-LENGTH <string>)
  (STRING-REF <string> <index>)
  (STRING-SET! <string> <index> <character>)
  (STRING=?  <string1> <string2>)  (STRING-CI=?  <string1> <string2>)
  (STRING<?  <string1> <string2>)  (STRING-CI<?  <string1> <string2>)
  (STRING>?  <string1> <string2>)  (STRING-CI>?  <string1> <string2>)
  (STRING<=? <string1> <string2>)  (STRING-CI<=? <string1> <string2>)
  (STRING>=? <string1> <string2>)  (STRING-CI>=? <string1> <string2>)
  (SUBSTRING <string> <start-index> <end-index>)
  (STRING-APPEND <string>+ )

  (VECTOR? <object>)
  (MAKE-VECTOR <length> [<object>] )
  (VECTOR <object>* )
  (VECTOR-LENGTH <vector>)
  (VECTOR-REF  <vector> <index>)
  (VECTOR-SET! <vector> <index> <object>)

  (PROCEDURE? <object>)
  (APPLY <procedure> <arg>* <arg-list>)
  (MAP   <procedure> <list>+ )
  (FOR-EACH <procedure> <list>+ )
  (CALL-WITH-CURRENT-CONTINUATION <one-argument-procedure>)

  (CALL-WITH-INPUT-FILE  <string> <procedure>)
  (CALL-WITH-OUTPUT-FILE <string> <procedure>)
  (INPUT-PORT? <object>)  (OUTPUT-PORT? <object>)
  (OPEN-INPUT-FILE  <string>)       (OPEN-OUTPUT-FILE <string>)
  (CLOSE-INPUT-PORT  <input-port>)  (CLOSE-OUTPUT-PORT <output-port>)
  (EOF-OBJECT? <object>)
  (READ [<input-port>] )
  (READ-CHAR [<input-port>] )
  (PEEK-CHAR [<input-port>] )
  (WRITE   <object> [<output-port>] )
  (DISPLAY <object> [<output-port>] )
  (NEWLINE [<output-port>] )
  (WRITE-CHAR <character> [<output-port>] )

; R4RS Scheme

  (LIST-TAIL <list> <index>)
  (STRING->LIST <string>)
  (LIST->STRING <list-of-characters>)
  (STRING-COPY  <string>)
  (STRING-FILL! <string> <character>)
  (VECTOR->LIST <vector>)
  (LIST->VECTOR <list>)
  (VECTOR-FILL! <vector> <object>)
  (DELAY <expression>)
  (FORCE <promise>)
  (WITH-INPUT-FROM-FILE <string> <thunk>)
  (WITH-OUTPUT-TO-FILE  <string> <thunk>)
  (CHAR-READY? [<input-port>] )
  (LOAD <string>)
  (TRANSCRIPT-ON <string>)

  (DEFINE-SYNTAX <name> <transformer-spec>)     -- High-Level macros (only)
  (LET-SYNTAX    ( <syntax-spec>* ) <exp>+ )
  (LETREC-SYNTAX ( <syntax-spec>* ) <exp>+ )


IEEE Standard 1178-1990. "IEEE Standard for the Scheme Programming
Language", IEEE, New York, 1991, ISBN 1-55937-125-0 [1-800-678-IEEE:
order # SH14209].  -- now also an ANSI standard.

W. Clinger and J. Rees, eds., "Revised^4 Report on the Algorithmic
Language Scheme", ACM LISP Pointers IV, 3 (July-September 1991).

Back to David Neto's CSC324 page
Back to David Neto's teaching page
Back to David Neto's home page