Scheme is a programming language, and is one of the two major LISP dialects in use today (the other one being Common LISP).

The primary design goal has always been elegancy rather than practicality. Thus, it is the antithesis of Perl

Some features of Scheme are: weak typing, lexical scope, garbage-collection, iteration expressed using tail recursion, and LISPish syntax.

(Reason (hate Hai-Etlik Scheme) (> numberOfParenthesis tooMany)) ARgh

bitter_engineer: the statement that Scheme lacks "programming loops" is incorrect: it has do which is a looping construct.

In my experience, recursive procedures in Scheme are not that common, unless you would have used recursion in other languages too. Many things you would use loops for in C are done with map and for-each, together with some utility-procedures for creating lists of integers and the like.

core10k: Your second example certainly does not belong in the real world of real code: it is syntactically invalid, it does not work even when the parenthesis are moved to the right places, and it is strange in other ways too (nested conds?). You are probably looking for something like

(define (print-list l)
  (do ((i 0 (+ i 1))
       (l l (cdr l)))
      ((null? l))
    (format #t "~a: ~a~%" i (car l))))

(format is not in R5RS, but neither is print.) Of course, often you might not need to print the index in front of every list member, and then you can simply use the builtin functions write or display to print lists.

This is the genealogy of the programming language Scheme:

Scheme is a child of Lisp.
Scheme was born in year 1975.
It became Scheme MIT in year 1978.
It became Scheme 84 in year 1984.
It became Scheme IEEE in year 1990.
It became Scheme R5RS in year 1996, and has not changed much since that time.

This genealogy is brought to you by the Programming Languages Genealogy Project.

The beauty of the programming language Scheme is its simplicity and power. The simplicity lies in its lack of feature overload. It draws its power from a small number of concepts, orthogonally applicable to all data types.

An R5RS compliant version of the kill_me_now function would be:

(define (kill_me_now aList)
  (let ((idx 0))
    (map (lambda (element) 
           (display idx) 
           (display ":") 
           (display element)
           (set! idx (+ idx 1))
It illustrates some of the aforementioned concepts:
  • creation of evaluation environments with let
  • application of function object to each member of aList with map
  • Use of annonymous functions defined with the lambda operator
  • lexical scoping allows the annonymous function to modify idx defined in the enclosing let definition
  • as everything returns a value a meaningfull return value should be provided (here: aList)
It should be noted that almost everything in Scheme is usable as a so called first class object. Examples would be
  • procedures (pretty common nowadays)
  • evaluation environments
  • continuations
First class objects can be stored in variables and other data structures (e.g. lists). This would allow to create a selection of environments to evaluate an expression E with (eval E environments(i)).
A continuation is a specific point in the flow of control in program execution, somewhat like a breakpoint in a debugger. But the "breakpoint" is stored together with the environment that is active when the breakpoint is stored. So a continuation is like a breakpoint with environment. That makes it similar to wainting thread, or a context in context switching. With Scheme the programmer has full access to these continuations and can manipulate or store them. Among other applications this allows the implementation fo any number of multi threading or concurrency mechanisms.

core10k: Nice try at creating obfuscated Scheme code. When your preferred language can't express things as cleanly as Scheme, such a smokescreen is a good idea.

I'm assuming the definition of the non-standard print function you used is something like this:

(define print
  (lambda args
    (for-each display args)

If you want to print the contents of a list, the function is defined thus:

(define (all-is-better mylist)
  (for-each print mylist))

There's no reason why you have to associate sequential numbers with a list in order to use it. In Scheme, you simply deal with the first item on the list and then the rest of the list. You wanted to deemphasize the needlessnes of a numeric index, so you made that index part of the output.

Some languages index starting at 1, some zero. Here's Scheme code that handles either case.

(define (number-list mylist starting-index)
  (if (pair? mylist) ; i.e. non-empty list
        (print starting-index ": " (first mylist))
        (number-list (rest mylist) (+ starting-index 1)))))

Oh yes, you wanted to always index at zero. Fine.

(define (all-is-well mylist) (number-list mylist 0))

Scheme (?), n. [L. schema a rhetorical figure, a shape, figure, manner, Gr. , , form, shape, outline, plan, fr. , , to have or hold, to hold out, sustain, check, stop; cf. Skr. sah to be victorious, to endure, to hold out, AS. sige victory, G. sieg. Cf. Epoch, Hectic, School.]


A combination of things connected and adjusted by design; a system.

The appearance and outward scheme of things. Locke.

Such a scheme of things as shall at once take in time and eternity. Atterbury.

Arguments . . . sufficient to support and demonstrate a whole scheme of moral philosophy. J. Edwards.

The Revolution came and changed his whole scheme of life. Macaulay.


A plan or theory something to be done; a design; a project; as, to form a scheme.

The stoical scheme of supplying our wants by lopping off our desires, is like cuttig off our feet when we want shoes. Swift.


Any lineal or mathematical diagram; an outline.

To draw an exact scheme of Constantinople, or a map of France. South.

4. Astrol.

A representation of the aspects of the celestial bodies for any moment o at a given event.

A blue case, from which was drawn a scheme of nativity. Sir W. Scott.

Syn. -- Plan; project; contrivance; purpose; device; plot. -- Scheme, Plan. Scheme and plan are subordinate to design; they propose modes of carrying our designs into effect. Scheme is the least definite of the two, and lies more in speculation. A plan is drawn out into details with a view to being carried into effect. As schemes are speculative, they often prove visionary; hence the opprobrious use of the words schemer and scheming. Plans, being more practical, are more frequently carried into effect.

He forms the well-concerted scheme of mischief; 'T is fixed, 't is done, and both are doomed to death. Rowe.

Artists and plans relieved my solemn hours; I founded palaces, and planted bowers. prior.


© Webster 1913.

Scheme, v. t. [imp. & p. p. Schemed (?); p. pr. & vb. n. Scheming.]

To make a scheme of; to plan; to design; to project; to plot.

That wickedness which schemed, and executed, his destruction. G. Stuart.


© Webster 1913.

Scheme, v. i.

To form a scheme or schemes.


© Webster 1913.

Log in or register to write something here or to contact authors.