Teach Yourself Scheme in Fixnum Days introduction to the programming language Scheme">



Teach Yourself Scheme in Fixnum Days

 © Dorai Sitaram, 1998-2002 
 All Rights Reserved 
 ds26 at gte.com 
 [Download archive containing all the pages of this document] 
 [Download TeX source for this document] 
 Cover art by Margaret Wong 



Contents

    Preface

    1  Enter Scheme

    2  Data types
        2.1  Simple data types
            2.1.1  Booleans
            2.1.2  Numbers
            2.1.3  Characters
            2.1.4  Symbols
        2.2  Compound data types
            2.2.1  Strings
            2.2.2  Vectors
            2.2.3  Dotted pairs and lists
            2.2.4  Conversions between data types
        2.3  Other data types
        2.4  S-expressions

    3  Forms
        3.1  Procedures
            3.1.1  Procedure parameters
            3.1.2  Variable number of arguments
        3.2  apply
        3.3  Sequencing

    4  Conditionals
        4.1  when and unless
        4.2  cond
        4.3  case
        4.4  and and or

    5  Lexical variables
        5.1  let and let*
        5.2  fluid-let

    6  Recursion
        6.1  letrec
        6.2  Named let
        6.3  Iteration
        6.4  Mapping a procedure across a list

    7  I/O
        7.1  Reading
        7.2  Writing
        7.3  File ports
            7.3.1  Automatic opening and closing of file ports
        7.4  String ports
        7.5  Loading files

    8  Macros
        8.1  Specifying the expansion as a template
        8.2  Avoiding variable capture inside macros
        8.3  fluid-let

    9  Structures
        9.1  Default initializations
        9.2  defstruct defined

    10  Alists and tables

    11  System interface
        11.1  Checking for and deleting files
        11.2  Calling operating-system commands
        11.3  Environment variables

    12  Objects and classes
        12.1  A simple object system
        12.2  Classes are instances too
        12.3  Multiple inheritance

    13  Jumps
        13.1  call-with-current-continuation
        13.2  Escaping continuations
        13.3  Tree matching
        13.4  Coroutines
            13.4.1  Tree-matching with coroutines

    14  Nondeterminism
        14.1  Description of amb
        14.2  Implementing amb in Scheme
        14.3  Using amb in Scheme
        14.4  Logic puzzles
            14.4.1  The Kalotan puzzle
            14.4.2  Map coloring

    15  Engines
        15.1  The clock
        15.2  Flat engines
        15.3  Nestable engines

    16  Shell scripts
        16.1  Hello, World!, again
        16.2  Scripts with arguments
        16.3  Example

    17  CGI scripts
        17.1  Example: Displaying environment variables
        17.2  Example: Displaying selected environment variable
        17.3  CGI script utilities
        17.4  A calculator via CGI

    A  Scheme dialects
        A.1  Invocation and init files
        A.2  Shell scripts
        A.3  define-macro
        A.4  load-relative

    B  DOS batch files in Scheme

    C  Numerical techniques
        C.1  Simpson's rule
        C.2  Adaptive interval sizes
        C.3  Improper integrals

    D  A clock for infinity

    E  References

    F  Index