Introduction to Scheme - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Introduction to Scheme

Description:

(quote literal-expression) or 'literal-expression. Conditional expressions. if ... car cdr append length reverse member assoc) string-processing. vector-processing ... – PowerPoint PPT presentation

Number of Views:19
Avg rating:3.0/5.0
Slides: 10
Provided by: RowanUni8
Learn more at: http://elvis.rowan.edu
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Scheme


1
Introduction to Scheme
  • Originally developed in 1975 (Steele Sussman)
  • Syntactical similar to LISP
  • Semantically similar to ALGOL
  • Later influenced Common Lisp
  • See http//www.informatik.uni-bremen.de/net/hist
    ory.html

2
Scheme Syntax
  • Everything is an expression (returns a value)
  • Function calls are of the form
  • (function arg1 arg2 )
  • Control expressions are of the form
  • (keyword arg1 arg2 )

3
Primitive Data Types
  • Numbers
  • Integers, rationals, reals, complex
  • Booleans
  • f, t
  • Characters
  • Strings
  • Symbols

4
Composite Types
  • Pairs
  • Lists
  • Linked list of pairs
  • Vectors

5
Variable Binding
  • define
  • Introduce (or override) new variable-gtvalue
    binding at current lexical level
  • let
  • Introduce lexical variable binding

6
Literal Expressions
  • (quote literal-expression)
  • or
  • 'literal-expression

7
Conditional expressions
  • if
  • (if ( (/ n 2) 0) even odd)
  • cond
  • and, or

8
Functional Expressions
  • lambda
  • (define inc (lambda (n) ( n 1)))
  • or
  • (define (inc n) ( n 1)

9
Built-in Functions
  • predicates (number? pair? rational? etc.)
  • mathematical functions ( - / max min)
  • constructors (cons list vector string)
  • conversion (string-gtsymbol symbol-gtstring)
  • list-processing (null? car cdr append length
    reverse member assoc)
  • string-processing
  • vector-processing
  • See http//www.scheme.com/tspl2d/objects.html
Write a Comment
User Comments (0)
About PowerShow.com