Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
λ Scheme JD White III Kevin Sweeney Josh Amick Jonathan Eitel About Scheme was invented by Guy Lewis Steele Jr. and Gerald Jay Sussman in the 1970’s Dialect of Lisp Designed for clear and simple semantics One of the first languages to incorporate first class procedures Introduced concept of exact and inexact numbers About (cont.) Supports multiple programming paradigms Best known for support of functional programming Follows a minimalist philosophy; everything provided by libraries Widely used by schools for introductory programming courses: Stanford, MIT, etc. Concepts Scheme has lexical scoping and uniform evaluation rules All data types are equal There are seven kinds of expressions: Constant, Variable reference, Procedure creation, Procedure application, Conditional, Assignment, and Sequence. Types Numbers 1, 2, 3.1459, Strings “Take home exam, please” Char’s #\a, #\b Bools #t #f Syntax Compute expressions from the inside out No operator precedence rules Uses fully nested and parenthesized notation Conditionals: (if test then-expr else-expr) Nested Conditionals: (cond (test1 expr1 ...) (test2 expr2 ...) ... (else exprn)) Sample Program: Factorial (define (fact n) (if (< n 2) 1 (* n (fact (- n 1)))))) (defun fact (n) (if (< n 2) 1 (* n (fact (1- n))))) Prefix vs. Infix Prefix: (* 2 (+ 1 2)) Parenthesis are a must (+ 2 4 6 8) = 20 Infix: 2 * ( 1 + 2) Parenthesis used to override execution order If the more than 2 arguments, then the operator must be repeated These have the same execution order Scheme vs. C Scheme (factorial 3) (+ 1 2) (+ 1 2 3) (< low X high) ( * (+ 1 2) 3) C Factorial(9) 1+2 1+2+3 (low < X) && (hi < X) (1 + 2) * 3 Sources Wikipedia: http://en.wikipedia.org/wiki/Scheme_programming_language MIT: http://www-swiss.ai.mit.edu/projects/scheme/ University of Washington: http://www.cs.washington.edu/education/courses/341/99su/lectures/ scheme/ppframe.htm University of Michigan-Dearborn: http://www.engin.umd.umich.edu/CIS/course.des/cis400/scheme/sch eme.html