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.