1 / 20

SCHEME

SCHEME. Scheme is elegant, clear, small, and powerful programming language.  It is a dialect of LISP and can be classified as a semi-functional programming language. Scheme is based on a formal model the lambda calculus. History of Scheme. History of Scheme.

amelie
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 • Scheme is elegant, clear, small, and powerful programming language.  It is a dialect of LISP and can be classified as a semi-functional programming language. • Scheme is based on a formal model the lambda calculus.

  2. History of Scheme

  3. History of Scheme • 1975 Scheme came into existence as a “toy'' Lisp interpreter that Guy Steele and Gerald Sussman wrote to study some aspects of Carl Hewitt's theory of actors, an object-oriented computational paradigm. • 1978 Rabbit -1st scheme compiler by Guy Steele Jr. It was used at the Massachusetts Institute of Technology AI department for reasearching new semantic concepts in programming language.

  4. History (cont’n) • Scheme rapidly became popular not only among groups interested in the theoretical and mathematical aspects of programming languages, but also as a tool for research and as the basis for computer science curricula at the universities and colleges

  5. History (cont) • Scheme standardization is an ongoing process. Today Reports are now written by an informal group of “Scheme Authors”. They communicate on a regular basis, and new features must be decided on unanimously by the authors. • This ensures the language remains relatively stable and small.

  6. Features of Scheme • Functions are first class citizens • stored in a variable or a list • passed to another function • returned from another function • Scheme's philosophy is unashamedly Minimalist • Its goal is not to pile feature upon feature, but to remove weaknesses and restrictions that make new features appear necessary.

  7. Features (cont) • First variety of Lisp to use lexical variable scoping exclusively • the scope of certain variables is determined according to its position in program code • Like Lisp, Scheme supports garbage collection of unreferenced data.

  8. Features(cont) • Listing capabilities - It uses lists as the primary data structure. • (a (b (c d))) • Scheme has very little syntax compared to many other programming languages.

  9. Some Disadvantages • Things that are simple in other languages tend to be hard in Scheme, yet some simple Scheme tricks are hard to do in other languages. • Scheme is not standardized beyond its core. • Functions that exist in one Scheme implementation do not need to exist in another or may have a completely different name and/or interface

  10. Disadvantages (cont) • One of the drawbacks of Scheme is that they are dynamically typed.This means that functions are written without saying what type of arguments they expect. - If the wrong type of value is passed to a function, the error is only detected at run-time when an operation is applied to a value that is incorrect (e.g., adding a string to a number or subtracting one from a function).

  11. Sample Programs

  12. Hello World • HELLO WORLD (BEGIN (display “Hello,World”) (newline))

  13. Hello World • BEGIN –evaluates the expessions sequentially from left to right, and the value of the last expression is returned. • (display obj) - standard output for printing to screen

  14. Factorial • (define (fact n) (if (zero? n) 1 (* n (fact (- n 1)))))

  15. Length of Argument in List • (define (len x) (if (null? x) 0 ;else (+ 1 (len (cdr x)))))

  16. Lexical Scoping (define counter 50) (define (inc-counter) (set! counter (+ 1 counter)) counter) (let ((counter 100)) (display (inc-counter)) (newline) (display counter) (newline) (display (inc-counter))(newline))

  17. Let specifies binding of variables to a value - The variables bound by let are visible only within the body of the let - The variables are bound to fresh locations holding the results • let((variable init) ...) expression expression

  18. Sample Scheme Programs BRL.  The "Beautiful Report Language"; a framework for building server-side web applications. See http://sourceforge.net/projects/brl/. Naughty Dog.  The game developer Naughty Dog Inc have used Scheme in the development of a several of their games. See http://www.naughtydog.com/. Siag Office.  A free Office package for Unix that features Scheme as one of its extension languages. See http://siag.nu/index.shtml. ·Scribe.  A text processor for writing technical documents and producing output in a variety of formats. See http://www-sop.inria.fr/mimosa/fp/Scribe/. JACAL.  An interactive symbolic mathematics program. See http://swissnet.ai.mit.edu/~jaffer/JACAL.html.

  19. Some Scheme Implementations • Bigloo http://www-sop.inria.fr/mimosa/fp/Bigloo/ • Chez Scheme http://www.scheme.com/ • DrScheme http://drscheme.org • Chicken http://www.call-with-current-continuation.org/ • EdScheme http://www.schemers.com/ • Guile http://www.gnu.org/software/guile/ • JScheme http://jscheme.sourceforge.net/ • Luna http://sourceforge.net/projects/luna-scheme/ • MIT Scheme http://www.swiss.ai.mit.edu/projects/scheme/ • MScheme http://drscheme.org • OpenScheme http://www.open-scheme.com/

  20. Links • Scheme Documentations • IEEE:http://standards.ieee.org/reading/ieee/std_public/description/busarch/1178-990_desc.htm • R5RS:http://schemers.org/Documents/Standards/R5RS/

More Related