1 / 10

λ Scheme

λ 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

dustin
Download Presentation

λ Scheme

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. λScheme JD White III Kevin Sweeney Josh Amick Jonathan Eitel

  2. 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

  3. 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.

  4. 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.

  5. Types • Numbers • 1, 2, 3.1459, • Strings • “Take home exam, please” • Char’s • #\a, #\b • Bools • #t #f

  6. 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))

  7. (define (fact n) (if (< n 2) 1 (* n (fact (- n 1)))))) (defun fact (n) (if (< n 2) 1 (* n (fact (1- n))))) Sample Program: Factorial

  8. 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

  9. 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 Scheme vs. C

  10. 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/scheme.html

More Related