Home >> Computers >> Software >> Operating Systems >> x86 >> DOS >> Programming >> Languages


  ABC
Ada
Assembly
BASIC
Batch
C
  Eiffel
Euphoria
Forth
Logo
Modula-2
Oberon
  Objective-C
Pascal
Perl
Rexx
Squeak


Scheme occurs as functional programming language and a dialect of Lisp. It was developed by Guy L. Steele and Gerald Jay Sussman in the 1970s initially as an attempt to understand the Actor model and introduced to the academic world via a series of papers now referred to as Sussman and Steele's Lambda Papers. Minor implementation details tend to differ slightly, and so occasionally Scheme is known as the personal of closely related programing language.

Scheme's philosophy is shamelessly minimalist. Its goal is does'nt to pile feature upon feature, however to dislodge weaknesses & restrictions that produce fresh features come out necessary. So, Scheme will bring when pack primitive notions when imaginable, & around which this is practical in an implementation, tends to let all about else exist as provided by Programming Libraries that are repose on top of the two. E.g., a independent mechanism for governing control flow is tail recursion.

Scheme was a foremost idiom of Lisp to apply lexical variable scoping (aka static scoping, as opposed to dynamic variable scoping) exclusively. It was as well one of a number 1 programing language to trend lines expressed continuations. Scheme as well supports garbage collection of unreferenced data.

Scheme utilizes lists when a primary information structure, however as well has serious trend lines for arrays. Owing to the minimalist specification, no standard syntax for even creating structures by owning known as fields, or for doing object oriented programming, but several single implementations use such features.

Origin of Scheme
In their paper on the evolution of Lisp, Richard Gabriel & Guy Steele explain the origin of Scheme when follows: Scheme was originally known as "Schemer", in the tradition of the languages Planner and Conniver. A todays title resulted from either a authors' have of the ITS operating system, which limited filenames to two components of at the most sextet characters both. Presently, "Schemer" is ordinarily wont to refer to the Scheme coder.

Advantages

Scheme, when completely Lisp dialects, has very little syntax in comparison numbers of more programing language. It has there are no operator precedence rules because fully nested notation is used for completely work calls, & no ambiguities every bit come obtained within infix notation, which mimics conventional algebraic notation.

A bit of humans come at number one put murder by all the parentheses utilized within Scheme notation. Even so, Scheme is commonly made & displayed utilizing editors which automatically indent a code in the conventional manner, & fallowing the short period of accommodation the parentheses be unnoticeable. As well, R6RS, a next version of the Scheme standard, will specify that square brackets (& even curly braces) can be utilized for S-expressions.

Scheme's macro facilities allow it to be adapted to several different condition domains. It may be utilized to add trend lines for object-oriented programming. Scheme will bring the hygienical macro body which, patch non quite when mighty when Common Lisp's macro system, is much safer and often easier to work with. the benefit of a hygienical macro models (equally obtained inside Scheme & more languages like Dylan) is that any name clashes in the macro instruction & encompassing code is automatically avoided. A hygienical macro body is universally build upon a select few sale-subordinate facility which will bring a to the full power of non-hygienic macro instruction, including arbitrary syntax-instance computations.

Scheme encourages functional programming. Purely functional programs have there are no state & don't develop side-effects, and come so automatically thread-safe and considerably gentler to verify than imperative programs.

Within Scheme, functions come first-class objects. This provide higher-order functions which can more abstract program logic. Functions can too become created anonymously.

Scheme has the minimalistic standard. When this may exist as seen as a disadvantage, it can besides be worthful. E.g., writing the conformist Scheme compiler is more easygoing (since there are fewer features to implement) than the Most common Lisp 1; embedding Lisp in low-memory hardware could as well exist as additional viable by having Scheme than Most common Lisp. Plotter buy it amusing to note that a whole Scheme standard is little than a stock to Guy Steele's Common Lisp: The Language (that is, about 50 pages).

Disadvantages

A Scheme standard is very minimalist, specifying simply a core language. This means that there are numbers of different implementations, every sustaining their have incompatible extensions to the language & libraries. A Scheme Requests for Implementation ([http://srfi.schemers.org/ SRFI]) run seeks to guide this.

A select few Common Lispers see the fact that functions & variables lie in the equivalent namespace as a disadvantage. Scheme coder don't underst& this as the condition, and like a language that encourages utilizing higher-order functions rather than a additional verboseness that such code takes within Most common Lisp. (Them communities typically own yearn fights all over such issues.)

Standards

There are deuce standards that define a Scheme language: a official IEEE standard, and a de facto standard known as the Revisednorth Report on the Algorithmic Language Scheme, about universally abbreviated RnRS, inorth which n is the total of the revision. A latest RnorthRS version is R5RS, as well available [http://www.schemers.org/Documents/Standards/R5RS/ online].

a freshly language standardization run was begun at a 2003 Scheme workshop that has the remitment of producing an R6RS standard within 2006. It breaks by having a earliest RnRS approach of unanimity. Their todays progress may be witnessed [http://schemers.org/Documents/Standards/Charter/ on the web].

Even the first newly feature within R6RS is a standard module technique (presently existence designed). This might allow a split between the core language & libraries.

Language elements

Comments

Comments come preceded by the semicolon (;) and prove my point for the rest of the line.

Variables

Variables come dynamically typed. Variables are bound by the define, the let expression, & two or three more Scheme forms. Variables attached at the top level by owning a define come inside spherical scope.

(define var1 value)

Variables attached witharound a let come in scope for the body of the let.

(let ((var1 value)) ... scope of var1 ...)

Functions

Functions come 1st-class objects inside Scheme. It may be assigned to variables. E.g. the work using deuce arguments arg1 & arg2 may be defined as

(define fun (lambda (arg1 arg2) ...))

which may be abbreviated when follows:

(define (amusing arg1 arg2) ...)

Functions come applied by using a resulting syntax:

(amusive value1 value2)

Note that a work existence applied is in a number one position of a listing when the rest of the names contain the arguments. A use work may require a foremost argument & use it to a given listings of arguments, then the former work call for can too exist as written as

(use diverting (names value1 value2))

Inside Scheme, functions come divided into 2 basic categories: procedures & primitives. 100% primitives come procedures, but not 100% procedures come primitives. Primitives come pre-defined functions in the Scheme language. These include +, -, *, /, placed!, car, cdr, & more basic procedures. Procedures come user-defined functions. Within many variations of Scheme, the user may redefine a primitive. E.g., a code

(define (+ ten y) (- ten y))

actually redefines a + primitive to perform subtraction, like than addition.

Lists
Scheme utilizes a linked list data structure around the same form when it lives in Lisp.

Data types

More most common information types inside Scheme besides functions & lists come: integer, rational, real, complex numbers, symbols, strings, ports. Virtually all Scheme implementations besides offer association lists, hash tables, vectors, arrays and structures. Since a IEEE Scheme standard & a R4RS Scheme standard, Scheme has asserted that a lot of the above types come disjoint, that is there are no value could belong to additional than one of these types; still occasionally ancient implementations of scheme predate these standards & use at times #f & '() to exist when a equivalent value, as is the instance within Most common Lisp.

Virtually all Scheme implementations offer the fully numerical tower as well as exact and inexact arithmetic.

Admittedly & treasonably come represented per #t & #f. Actually simply #f is really faithlessly after a Boolean nature and severity is called upon, all about else is considered avowedly, including the empty names.

Symbols may be created inside at least a as punishment ways:

'symbol (string->symbol "symbol")

Equality

Scheme has tierce different types of equality:

; equivalent weight? : Is restored #t inside case its parameters represent a equivalent information object in memory. ; eqv? : Typically a equivalent when eq? however treats occasionally objects (eg. characters & figures) specially thus that figures that come = come eqv? potentially whenever it is non combining weight? ; peer? : Equivalence information structures like lists, vectors & strings to determine in case it use congruent structure & eqv? contents.

Nature and severity dependent equivalence operations likewise survive inside Scheme: ; string=? : To compare 2 strings ; char=? : To compare characters ; = : To compare numbers

Control structures

Conditional evaluation

(in case line 2 text so-expr else-expr)

A line 3 text expression is evaluated, & whenever a evaluation effect is admittedly (anything differently #f) so a so-expr is evaluated, otherwise else-expr is evaluated.

The form that is additional ready to hand while conditionals come nested is cond:

(cond (test1 expr1) (test2 expr2) ... (else exprn))

A 1st expression for which a end line text evaluates to avowedly is evaluated. inside case everthing tests effect in #f, a else clause is evaluated.

The variant of the cond clause is

(cond ... (end line text => expr) ...)

In that outbreak, expr should evaluate to the work that will require 1 argument. Whenever trial evaluates to avowedly, a work is known as by using a go to value of end line text.

Loops

Loops around Scheme unremarkably choose a form of tail recursion. Scheme implementations come needed to optimize hindquarters recursion therefore when to eliminate utilize of fold space in which imaginable, then haphazardly yearn loops may be executed utilizing this system.

The authoritative case is the factorial work, which may be defined non-fanny-recursively:

(define (factorial north) (in case (= north Nought) 1 (* north (factorial (- north One)))))

(factorial Cinque) ;; => 120

This occurs as straight translation of a mathematical recursive definition of the factorial: the factorial of zero (commonly written Nought!) is adequate to I, whenorth a factorial of any greater natural total n is defined whenorth n! = north * (north-One)!.

Even so, patently recursion is naturally less effective, since a Scheme patterns must keep track of the is restored of all the nested work calls. a hindquarters-recursive definition is 1 that ensures that in the recursive instance, the outmost call for is a single back to the top of the revenant work. Therein out break, i recur non on the factorial work itself, however in a helper routine by owning deuce parameters representing the state of the iteration:

(define (factorial north) (let loop ((sum Ace) (north north)) (whenever (= north Nought) total (loop (* north amount) (- north Ace)))))

(factorial Phoebe) ;; => 120

The higher sequentially work prefer map which applies the work to each element of the names, & may be defined non-stern-recursively:

(define (map f lst) (whenever (void? lst) lst (cons (f (car lst)) (map f (cdr lst)))))

(map (lambda (ten) (* 10 x)) '(One Two Three Four)) ;; => (One Four 9 16)

This can likewise exist as defined rump-recursively:

(define (map f lst) (let loop ((lst lst) (reticuloendothelial system '())) (in case (void? lst) (reverse reticuloendothelial system) (loop (cdr lst) (cons (f (car lst)) reticuloendothelial system)))))

(map (lambda (10) (* 10 x)) '(One Two Three Four)) ;; => (One Four 9 16)

Within each subjects a tail end-recursive version is preferred due to its reduced utilize of space.

Input/output

Scheme has a construct of ports to review from either or even to write to. R5RS defines ii default ports, accessible by having a functions: todays-input-port, todays-output-port. Virtually all implementations besides provide todays-error-port.

Examples

Hello World

(define (hello-globe) (display "Hello, World!") (newline)) (hello-globe)

Or simpler:

(display "Hello, World!\n")

Scheme code may be detected in the as a result articles: Arithmetic-geometric mean, Church numeral, Continuation passing style, Currying, Fibonacci number program, Hello world program, Levenshtein distance, Tail recursion, Queue.

Implementations
[http://www-sop.inria.fr/mimosa/fp/Bigloo/ Bigloo] occurs as Scheme-to-C, Scheme-to-.NET & Scheme-to-Java compiler. It has good deal other to offer than simply a compiler: Bigloo features an expressed nature & severity technique which improves the readability and debugging of code. Bigloo occurs as skillful Scheme implementation should you be searching to write numerical applications. [http://www.scheme.com/ Chez Scheme] occurs as proprietary freeware Scheme interpreter & commercial Scheme compiler for Microsoft Windows, Mac OS X, Linux, and SunOS. [http://www.call-with-current-continuation.org/chicken.html Chicken] occurs as Scheme-to-C compiler. [http://www.iro.umontreal.ca/~gambit/ The Gambit Scheme System] occurs as Scheme interpreter & high-vet Scheme-to-C compiler. Gauche is an R5RS Scheme implementation developed to be the convenient script interpreter. Guile is the GNU project's official extension language. This Scheme interpreter is packaged as a library to provide scripting to applications. [http://jscheme.sf.net JScheme] occurs as Scheme environment, implemented within Java, that will bring a natural & transparent interface to Java known as the Javadot notation. [http://www.gnu.org/software/kawa/ Kawa] occurs as Scheme environment, written within Java, that compiles Scheme source code into Java bytecode. Any Java library may be well utilized around Kawa. [http://www.lispme.de/lispme/ LispMe] is an open-source Scheme environment for the PalmOS family of PDAs. [http://www.eblong.com/zarf/if.html#lists Lists and Lists] is an implementation of Scheme when a portion of an escapade game, implemented on the Z-machine; it can be begin in virtually all platforms. [http://www.gnu.org/software/mit-scheme/ MIT/GNU Scheme] occurs as loose (GPL-licensed) implementation for the x86 architecture exclusively. It diarrhea in GNU/Linux, FreeBSD, IBM OS/2, and Microsoft Windows (95, 98, ME, NT, 2000, and XP) Oaklisp is an object-oriented dialect of Scheme sustaining number 1-class classes. [http://www.plt-scheme.org/ PLT Scheme] occurs as suite of Scheme software download for Windows, Mackintosh, & Unix platforms including an interpreter (MzScheme), the in writing toolkit (MrEd), the pedagogically-oriented graphic editor (DrScheme), & various more components including Component object model and ODBC libraries. scsh (SCheme casing) occurs as Unix shell language inside Scheme. These are derived from [http://www.s48.org/ Scheme48] [http://www.s48.org/ Scheme48] occurs as implementation of scheme utilizing the bytecode interpreter. These are designed for experimentation for implementation techniques. [http://sisc.sf.net SISC (Second Interpreter of Scheme Code)] is aFully R5RS Scheme environment written within Java, which can access Java libraries. A GIMP currently embeds SIOD very successfully for scripting image manipulation (scripts produce a GUI & call for plugins & internal functions) however the new project is to replenish SIOD by having Guile. Stalin is an aggressively optimizing Scheme compiler, which for numerical codes is typically sooner than native C. [http://www.stklos.net STklos] occurs as Scheme implementation which will bring an object patterns similar to CLOS and a elementary interface to the GTK toolkit T is an implementation of Scheme designed for efficiency. [http://marijn.haverbeke.nl/unlikely/ Unlikely Scheme] is an open-source lightweight implementation of Scheme within C++. XLISP is a superset of Scheme developed by David Betz. Several extra implementations come employed in the [http://www.schemers.org/Documents/FAQ/ schemers.org FAQ].

LIDO Command Interpreter
A shell running on DOS that converts Linux shell commands to DOS.


Computers: Programming: Languages






© 2005 GeneralAnswers.org