<s>
Scheme	O
is	O
a	O
dialect	O
of	O
the	O
Lisp	B-Language
family	O
of	O
programming	O
languages	O
.	O
</s>
<s>
It	O
was	O
the	O
first	O
dialect	O
of	O
Lisp	B-Language
to	O
choose	O
lexical	O
scope	O
and	O
the	O
first	O
to	O
require	O
implementations	O
to	O
perform	O
tail-call	B-Language
optimization	I-Language
,	O
giving	O
stronger	O
support	O
for	O
functional	B-Language
programming	I-Language
and	O
associated	O
techniques	O
such	O
as	O
recursive	O
algorithms	O
.	O
</s>
<s>
It	O
had	O
a	O
significant	O
influence	O
on	O
the	O
effort	O
that	O
led	O
to	O
the	O
development	O
of	O
Common	B-Language
Lisp	I-Language
.	O
</s>
<s>
The	O
Scheme	B-Language
language	I-Language
is	O
standardized	O
in	O
the	O
official	O
IEEE	O
standard	O
and	O
a	O
de	O
facto	O
standard	O
called	O
the	O
Revised	O
Report	O
on	O
the	O
Algorithmic	B-Language
Language	I-Language
Scheme	O
(	O
RnRS	B-Language
)	O
.	O
</s>
<s>
A	O
widely	O
implemented	O
standard	O
is	O
R5RS	B-Language
(	O
1998	O
)	O
.	O
</s>
<s>
Both	O
trace	O
their	O
descent	O
from	O
R5RS	B-Language
;	O
the	O
timeline	O
below	O
reflects	O
the	O
chronological	O
order	O
of	O
ratification	O
.	O
</s>
<s>
Scheme	O
started	O
in	O
the	O
1970s	O
as	O
an	O
attempt	O
to	O
understand	O
Carl	O
Hewitt	O
's	O
Actor	B-Application
model	I-Application
,	O
for	O
which	O
purpose	O
Steele	O
and	O
Sussman	O
wrote	O
a	O
"	O
tiny	O
Lisp	B-Language
interpreter	B-Application
"	O
using	O
Maclisp	B-Language
and	O
then	O
"	O
added	O
mechanisms	O
for	O
creating	O
actors	O
and	O
sending	O
messages	O
"	O
.	O
</s>
<s>
Scheme	O
was	O
originally	O
called	O
"	O
Schemer	O
"	O
,	O
in	O
the	O
tradition	O
of	O
other	O
Lisp-derived	O
languages	O
such	O
as	O
Planner	B-Application
or	O
Conniver	O
.	O
</s>
<s>
The	O
current	O
name	O
resulted	O
from	O
the	O
authors	O
 '	O
use	O
of	O
the	O
ITS	B-Application
operating	I-Application
system	I-Application
,	O
which	O
limited	O
filenames	O
to	O
two	O
components	O
of	O
at	O
most	O
six	O
characters	O
each	O
.	O
</s>
<s>
This	O
process	O
broke	O
with	O
the	O
earlier	O
RnRS	B-Language
approach	O
of	O
unanimity	O
.	O
</s>
<s>
Compliant	O
implementations	O
are	O
now	O
required	O
to	O
support	O
Scheme	O
's	O
full	O
numeric	O
tower	O
,	O
and	O
the	O
semantics	O
of	O
numbers	O
have	O
been	O
expanded	O
,	O
mainly	O
in	O
the	O
direction	O
of	O
support	O
for	O
the	O
IEEE	O
754	O
standard	O
for	O
floating	O
point	O
numerical	O
representation	O
.	O
</s>
<s>
Scheme	O
is	O
primarily	O
a	O
functional	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
It	O
shares	O
many	O
characteristics	O
with	O
other	O
members	O
of	O
the	O
Lisp	B-Language
programming	I-Language
language	I-Language
family	O
.	O
</s>
<s>
Scheme	O
's	O
very	O
simple	O
syntax	O
is	O
based	O
on	O
s-expressions	B-Protocol
,	O
parenthesized	O
lists	O
in	O
which	O
a	O
prefix	O
operator	O
is	O
followed	O
by	O
its	O
arguments	O
.	O
</s>
<s>
Scheme	O
programs	O
thus	O
consist	O
of	O
sequences	O
of	O
nested	B-General_Concept
lists	O
.	O
</s>
<s>
The	O
reliance	O
on	O
lists	O
as	O
data	O
structures	O
is	O
shared	O
by	O
all	O
Lisp	B-Language
dialects	O
.	O
</s>
<s>
Scheme	O
inherits	O
a	O
rich	O
set	O
of	O
list-processing	O
primitives	O
such	O
as	O
cons	B-Protocol
,	O
car	B-Language
and	I-Language
cdr	I-Language
from	O
its	O
Lisp	B-Language
progenitors	O
.	O
</s>
<s>
Scheme	O
uses	O
strictly	O
but	O
dynamically	O
typed	O
variables	O
and	O
supports	O
first	B-Application
class	I-Application
procedures	I-Application
.	O
</s>
<s>
This	O
section	O
concentrates	O
mainly	O
on	O
innovative	O
features	O
of	O
the	O
language	O
,	O
including	O
those	O
features	O
that	O
distinguish	O
Scheme	O
from	O
other	O
Lisps	B-Language
.	O
</s>
<s>
Unless	O
stated	O
otherwise	O
,	O
descriptions	O
of	O
features	O
relate	O
to	O
the	O
R5RS	B-Language
standard	O
.	O
</s>
<s>
This	O
is	O
the	O
same	O
convention	O
used	O
in	O
R5RS	B-Language
.	O
</s>
<s>
Scheme	O
is	O
a	O
very	O
simple	O
language	O
,	O
much	O
easier	O
to	O
implement	O
than	O
many	O
other	O
languages	O
of	O
comparable	O
expressive	B-Language
power	I-Language
.	O
</s>
<s>
This	O
ease	O
is	O
attributable	O
to	O
the	O
use	O
of	O
lambda	B-Language
calculus	I-Language
to	O
derive	O
much	O
of	O
the	O
syntax	O
of	O
the	O
language	O
from	O
more	O
primitive	O
forms	O
.	O
</s>
<s>
For	O
instance	O
of	O
the	O
23	O
s-expression-based	O
syntactic	O
constructs	O
defined	O
in	O
the	O
R5RS	B-Language
Scheme	I-Language
standard	O
,	O
14	O
are	O
classed	O
as	O
derived	O
or	O
library	O
forms	O
,	O
which	O
can	O
be	O
written	O
as	O
macros	O
involving	O
more	O
fundamental	O
forms	O
,	O
principally	O
lambda	O
.	O
</s>
<s>
As	O
R5RS	B-Language
( §	O
3.1	O
)	O
says	O
:	O
"	O
The	O
most	O
fundamental	O
of	O
the	O
variable	O
binding	O
constructs	O
is	O
the	O
lambda	O
expression	O
,	O
because	O
all	O
other	O
variable	O
binding	O
constructs	O
can	O
be	O
explained	O
in	O
terms	O
of	O
lambda	O
expressions.	O
"	O
</s>
<s>
Fundamental	O
forms	O
:	O
define	O
,	O
lambda	O
,	O
quote	O
,	O
if	O
,	O
define-syntax	O
,	O
let-syntax	O
,	O
letrec-syntax	O
,	O
syntax-rules	O
,	O
set	B-Language
!	I-Language
</s>
<s>
Thus	O
using	O
let	O
as	O
defined	O
above	O
a	O
Scheme	O
implementation	O
would	O
rewrite	O
"	O
(	O
let	O
((a 1 )	O
(	O
b	O
2	O
)	O
)	O
( +	O
b	O
a	O
)	O
)	O
"	O
as	O
"	O
( ( 	O
lambda	O
(	O
a	O
b	O
)	O
( +	O
b	O
a	O
)	O
)	O
1	O
2	O
)	O
"	O
,	O
which	O
reduces	O
implementation	O
's	O
task	O
to	O
that	O
of	O
coding	O
procedure	O
instantiations	O
.	O
</s>
<s>
"	O
We	O
were	O
actually	O
trying	O
to	O
build	O
something	O
complicated	O
and	O
discovered	O
,	O
serendipitously	O
,	O
that	O
we	O
had	O
accidentally	O
designed	O
something	O
that	O
met	O
all	O
our	O
goals	O
but	O
was	O
much	O
simpler	O
than	O
we	O
had	O
intended	O
....	O
we	O
realized	O
that	O
the	O
lambda	B-Language
calculus	I-Language
—	O
a	O
small	O
,	O
simple	O
formalism	O
—	O
could	O
serve	O
as	O
the	O
core	O
of	O
a	O
powerful	O
and	O
expressive	O
programming	O
language.	O
"	O
</s>
<s>
Like	O
most	O
modern	O
programming	O
languages	O
and	O
unlike	O
earlier	O
Lisps	B-Language
such	O
as	O
Maclisp	B-Language
,	O
Scheme	O
is	O
lexically	O
scoped	O
:	O
all	O
possible	O
variable	O
bindings	O
in	O
a	O
program	O
unit	O
can	O
be	O
analyzed	O
by	O
reading	O
the	O
text	O
of	O
the	O
program	O
unit	O
without	O
consideration	O
of	O
the	O
contexts	O
in	O
which	O
it	O
may	O
be	O
called	O
.	O
</s>
<s>
This	O
contrasts	O
with	O
dynamic	O
scoping	O
which	O
was	O
characteristic	O
of	O
early	O
Lisp	B-Language
dialects	O
,	O
because	O
of	O
the	O
processing	O
costs	O
associated	O
with	O
the	O
primitive	O
textual	O
substitution	O
methods	O
used	O
to	O
implement	O
lexical	O
scoping	O
algorithms	O
in	O
compilers	B-Language
and	O
interpreters	B-Application
of	O
the	O
day	O
.	O
</s>
<s>
In	O
those	O
Lisps	B-Language
,	O
it	O
was	O
perfectly	O
possible	O
for	O
a	O
reference	O
to	O
a	O
free	O
variable	O
inside	O
a	O
procedure	O
to	O
refer	O
to	O
quite	O
distinct	O
bindings	O
external	O
to	O
the	O
procedure	O
,	O
depending	O
on	O
the	O
context	O
of	O
the	O
call	O
.	O
</s>
<s>
The	O
impetus	O
to	O
incorporate	O
lexical	O
scoping	O
,	O
which	O
was	O
an	O
unusual	O
scoping	O
model	O
in	O
the	O
early	O
1970s	O
,	O
into	O
their	O
new	O
version	O
of	O
Lisp	B-Language
,	O
came	O
from	O
Sussman	O
's	O
studies	O
of	O
ALGOL	B-Language
.	O
</s>
<s>
He	O
suggested	O
that	O
ALGOL-like	B-Language
lexical	O
scoping	O
mechanisms	O
would	O
help	O
to	O
realize	O
their	O
initial	O
goal	O
of	O
implementing	O
Hewitt	O
's	O
Actor	B-Application
model	I-Application
in	O
Lisp	B-Language
.	O
</s>
<s>
The	O
key	O
insights	O
on	O
how	O
to	O
introduce	O
lexical	O
scoping	O
into	O
a	O
Lisp	B-Language
dialect	O
were	O
popularized	O
in	O
Sussman	O
and	O
Steele	O
's	O
1975	O
Lambda	O
Paper	O
,	O
"	O
Scheme	O
:	O
An	O
Interpreter	B-Application
for	O
Extended	O
Lambda	B-Language
Calculus	I-Language
"	O
,	O
where	O
they	O
adopted	O
the	O
concept	O
of	O
the	O
lexical	B-Language
closure	I-Language
(	O
on	O
page	O
21	O
)	O
,	O
which	O
had	O
been	O
described	O
in	O
an	O
AI	O
Memo	O
in	O
1970	O
by	O
Joel	O
Moses	O
,	O
who	O
attributed	O
the	O
idea	O
to	O
Peter	O
J	O
.	O
Landin	O
.	O
</s>
<s>
Alonzo	O
Church	O
's	O
mathematical	O
notation	O
,	O
the	O
lambda	B-Language
calculus	I-Language
,	O
has	O
inspired	O
Lisp	B-Language
's	O
use	O
of	O
"	O
lambda	O
"	O
as	O
a	O
keyword	O
for	O
introducing	O
a	O
procedure	O
,	O
as	O
well	O
as	O
influencing	O
the	O
development	O
of	O
functional	B-Language
programming	I-Language
techniques	O
involving	O
the	O
use	O
of	O
higher-order	B-Language
functions	I-Language
in	O
Lisp	B-Language
.	O
</s>
<s>
But	O
early	O
Lisps	B-Language
were	O
not	O
suitable	O
expressions	O
of	O
the	O
lambda	B-Language
calculus	I-Language
because	O
of	O
their	O
treatment	O
of	O
free	O
variables	O
.	O
</s>
<s>
The	O
syntax	O
of	O
lambda	B-Language
calculus	I-Language
follows	O
the	O
recursive	O
expressions	O
from	O
x	O
,	O
y	O
,	O
z	O
,	O
...	O
,	O
parentheses	O
,	O
spaces	O
,	O
the	O
period	O
and	O
the	O
symbol	O
λ	O
.	O
</s>
<s>
Finally	O
,	O
the	O
lambda	O
calculation	O
created	O
a	O
substantial	O
meta-theory	O
.	O
</s>
<s>
Sussman	O
and	O
Steele	O
showed	O
that	O
the	O
new	O
language	O
could	O
be	O
used	O
to	O
elegantly	O
derive	O
all	O
the	O
imperative	B-Application
and	O
declarative	O
semantics	O
of	O
other	O
programming	O
languages	O
including	O
ALGOL	B-Language
and	O
Fortran	B-Application
,	O
and	O
the	O
dynamic	O
scope	O
of	O
other	O
Lisps	B-Language
,	O
by	O
using	O
lambda	O
expressions	O
not	O
as	O
simple	O
procedure	O
instantiations	O
but	O
as	O
"	O
control	O
structures	O
and	O
environment	O
modifiers	O
"	O
.	O
</s>
<s>
They	O
introduced	O
continuation-passing	B-Application
style	I-Application
along	O
with	O
their	O
first	O
description	O
of	O
Scheme	O
in	O
the	O
first	O
of	O
the	O
Lambda	O
Papers	O
,	O
and	O
in	O
subsequent	O
papers	O
,	O
they	O
proceeded	O
to	O
demonstrate	O
the	O
raw	O
power	O
of	O
this	O
practical	O
use	O
of	O
lambda	B-Language
calculus	I-Language
.	O
</s>
<s>
Scheme	O
inherits	O
its	O
block	O
structure	O
from	O
earlier	O
block	O
structured	O
languages	O
,	O
particularly	O
ALGOL	B-Language
.	O
</s>
<s>
Blocks	O
can	O
be	O
nested	B-General_Concept
to	O
create	O
arbitrarily	O
complex	O
block	O
structures	O
according	O
to	O
the	O
need	O
of	O
the	O
programmer	O
.	O
</s>
<s>
The	O
other	O
variant	O
,	O
letrec	O
,	O
is	O
designed	O
to	O
enable	O
mutually	B-Algorithm
recursive	I-Algorithm
procedures	O
to	O
be	O
bound	O
to	O
one	O
another	O
.	O
</s>
<s>
(	O
See	O
Hofstadter	O
's	O
male	O
and	O
female	O
sequences	O
for	O
the	O
definitions	O
used	O
in	O
this	O
example	O
.	O
)	O
</s>
<s>
The	O
named	O
let	O
is	O
widely	O
used	O
to	O
implement	O
iteration	B-Algorithm
.	O
</s>
<s>
Scheme	O
has	O
an	O
iteration	B-Algorithm
construct	O
,	O
do	O
,	O
but	O
it	O
is	O
more	O
idiomatic	O
in	O
Scheme	O
to	O
use	O
tail	B-Language
recursion	I-Language
to	O
express	O
iteration	B-Algorithm
.	O
</s>
<s>
Standard-conforming	O
Scheme	O
implementations	O
are	O
required	O
to	O
optimize	O
tail	B-Language
calls	I-Language
so	O
as	O
to	O
support	O
an	O
unbounded	O
number	O
of	O
active	O
tail	B-Language
calls	I-Language
(	O
R5RS	B-Language
sec	O
.	O
</s>
<s>
3.5	O
)	O
—	O
a	O
property	O
the	O
Scheme	O
report	O
describes	O
as	O
proper	B-Language
tail	I-Language
recursion	I-Language
—	O
making	O
it	O
safe	O
for	O
Scheme	O
programmers	O
to	O
write	O
iterative	B-Algorithm
algorithms	O
using	O
recursive	O
structures	O
,	O
which	O
are	O
sometimes	O
more	O
intuitive	O
.	O
</s>
<s>
Tail	B-Language
recursive	I-Language
procedures	O
and	O
the	O
named	O
let	O
form	O
provide	O
support	O
for	O
iteration	B-Algorithm
using	O
tail	B-Language
recursion	I-Language
.	O
</s>
<s>
(	O
R5RS	B-Language
sec	O
.	O
</s>
<s>
6.4	O
)	O
First-class	O
continuations	O
enable	O
the	O
programmer	O
to	O
create	O
non-local	O
control	O
constructs	O
such	O
as	O
iterators	O
,	O
coroutines	B-Architecture
,	O
and	O
backtracking	B-Algorithm
.	O
</s>
<s>
Continuations	O
can	O
be	O
used	O
to	O
emulate	O
the	O
behavior	O
of	O
return	B-Language
statements	I-Language
in	O
imperative	B-Application
programming	I-Application
languages	I-Application
.	O
</s>
<s>
The	O
following	O
example	O
,	O
a	O
traditional	O
programmer	O
's	O
puzzle	O
,	O
shows	O
that	O
Scheme	O
can	O
handle	O
continuations	O
as	O
first-class	O
objects	O
,	O
binding	O
them	O
to	O
variables	O
and	O
passing	O
them	O
as	O
arguments	O
to	O
procedures	O
.	O
</s>
<s>
In	O
contrast	O
to	O
Common	B-Language
Lisp	I-Language
,	O
all	O
data	O
and	O
procedures	O
in	O
Scheme	O
share	O
a	O
common	O
namespace	O
,	O
whereas	O
in	O
Common	B-Language
Lisp	I-Language
functions	O
and	O
data	O
have	O
separate	O
namespaces	O
making	O
it	O
possible	O
for	O
a	O
function	O
and	O
a	O
variable	O
to	O
have	O
the	O
same	O
name	O
,	O
and	O
requiring	O
special	O
notation	O
for	O
referring	O
to	O
a	O
function	O
as	O
a	O
value	O
.	O
</s>
<s>
This	O
is	O
sometimes	O
known	O
as	O
the	O
"	O
Lisp-1	O
vs.	O
Lisp-2	O
"	O
distinction	O
,	O
referring	O
to	O
the	O
unified	O
namespace	O
of	O
Scheme	O
and	O
the	O
separate	O
namespaces	O
of	O
Common	B-Language
Lisp	I-Language
.	O
</s>
<s>
There	O
is	O
no	O
equivalent	O
of	O
Common	B-Language
Lisp	I-Language
's	O
defun	O
and	O
#	O
 '	O
primitives	O
.	O
</s>
<s>
Scheme	O
specifies	O
a	O
comparatively	O
full	O
set	O
of	O
numerical	O
datatypes	O
including	O
complex	O
and	O
rational	O
types	O
,	O
which	O
is	O
known	O
in	O
Scheme	O
as	O
the	O
numerical	O
tower	O
(	O
R5RS	B-Language
sec	O
.	O
</s>
<s>
The	O
R5RS	B-Language
standard	O
specifies	O
procedures	O
exact->inexact	O
and	O
inexact->exact	O
which	O
can	O
be	O
used	O
to	O
change	O
the	O
exactness	O
of	O
a	O
number	O
.	O
</s>
<s>
The	O
R6RS	O
standard	O
omits	O
these	O
procedures	O
from	O
the	O
main	O
report	O
,	O
but	O
specifies	O
them	O
as	O
R5RS	B-Language
compatibility	O
procedures	O
in	O
the	O
standard	O
library	O
(	O
rnrs	B-Language
r5rs	B-Language
(	O
6	O
)	O
)	O
.	O
</s>
<s>
In	O
the	O
R5RS	B-Language
standard	O
,	O
Scheme	O
implementations	O
are	O
not	O
required	O
to	O
implement	O
the	O
whole	O
numerical	O
tower	O
,	O
but	O
they	O
must	O
implement	O
"	O
a	O
coherent	O
subset	O
consistent	O
with	O
both	O
the	O
purposes	O
of	O
the	O
implementation	O
and	O
the	O
spirit	O
of	O
the	O
Scheme	B-Language
language	I-Language
"	O
(	O
R5RS	B-Language
sec	O
.	O
</s>
<s>
Both	O
implementations	O
conform	O
to	O
the	O
R5RS	B-Language
standard	O
but	O
the	O
second	O
does	O
not	O
conform	O
to	O
R6RS	O
because	O
it	O
does	O
not	O
implement	O
the	O
full	O
numerical	O
tower	O
.	O
</s>
<s>
Scheme	O
supports	O
delayed	B-Application
evaluation	I-Application
through	O
the	O
delay	O
form	O
and	O
the	O
procedure	O
force	O
.	O
</s>
<s>
These	O
primitives	O
,	O
which	O
produce	O
or	O
handle	O
values	O
known	O
as	O
promises	B-Operating_System
,	O
can	O
be	O
used	O
to	O
implement	O
advanced	O
lazy	O
evaluation	O
constructs	O
such	O
as	O
streams	O
.	O
</s>
<s>
In	O
the	O
R6RS	O
standard	O
,	O
these	O
are	O
no	O
longer	O
primitives	O
,	O
but	O
instead	O
,	O
are	O
provided	O
as	O
part	O
of	O
the	O
R5RS	B-Language
compatibility	O
library	O
(	O
rnrs	B-Language
r5rs	B-Language
(	O
6	O
)	O
)	O
.	O
</s>
<s>
In	O
R5RS	B-Language
,	O
a	O
suggested	O
implementation	O
of	O
delay	O
and	O
force	O
is	O
given	O
,	O
implementing	O
the	O
promise	O
as	O
a	O
procedure	O
with	O
no	O
arguments	O
(	O
a	O
thunk	B-Application
)	O
and	O
using	O
memoization	O
to	O
ensure	O
that	O
it	O
is	O
only	O
ever	O
evaluated	O
once	O
,	O
irrespective	O
of	O
the	O
number	O
of	O
times	O
force	O
is	O
called	O
(	O
R5RS	B-Language
sec	O
.	O
</s>
<s>
For	O
example	O
,	O
this	O
is	O
a	O
definition	O
of	O
the	O
fibonacci	B-Algorithm
sequence	I-Algorithm
using	O
the	O
functions	O
defined	O
in	O
SRFI	O
41	O
:	O
</s>
<s>
Most	O
Lisps	B-Language
specify	O
an	O
order	O
of	O
evaluation	O
for	O
procedure	O
arguments	O
.	O
</s>
<s>
(	O
R5RS	B-Language
sec	O
.	O
</s>
<s>
In	O
contrast	O
with	O
other	O
Lisps	B-Language
,	O
the	O
appearance	O
of	O
an	O
expression	O
in	O
the	O
operator	O
position	O
(	O
the	O
first	O
item	O
)	O
of	O
a	O
Scheme	O
expression	O
is	O
quite	O
legal	O
,	O
as	O
long	O
as	O
the	O
result	O
of	O
the	O
expression	O
in	O
the	O
operator	O
position	O
is	O
a	O
procedure	O
.	O
</s>
<s>
In	O
the	O
R5RS	B-Language
standard	O
and	O
also	O
in	O
later	O
reports	O
,	O
the	O
syntax	O
of	O
Scheme	O
can	O
easily	O
be	O
extended	O
via	O
the	O
macro	O
system	O
.	O
</s>
<s>
The	O
R5RS	B-Language
standard	O
introduced	O
a	O
powerful	O
hygienic	O
macro	O
system	O
that	O
allows	O
the	O
programmer	O
to	O
add	O
new	O
syntactic	O
constructs	O
to	O
the	O
language	O
using	O
a	O
simple	O
pattern	B-Language
matching	I-Language
sublanguage	O
(	O
R5RS	B-Language
sec	O
4.3	O
)	O
.	O
</s>
<s>
Prior	O
to	O
this	O
,	O
the	O
hygienic	O
macro	O
system	O
had	O
been	O
relegated	O
to	O
an	O
appendix	O
of	O
the	O
R4RS	B-Language
standard	O
,	O
as	O
a	O
"	O
high	O
level	O
"	O
system	O
alongside	O
a	O
"	O
low	O
level	O
"	O
macro	O
system	O
,	O
both	O
of	O
which	O
were	O
treated	O
as	O
extensions	O
to	O
Scheme	O
rather	O
than	O
an	O
essential	O
part	O
of	O
the	O
language	O
.	O
</s>
<s>
R6RS	O
specifies	O
a	O
more	O
sophisticated	O
transformation	O
system	O
,	O
syntax-case	O
,	O
which	O
has	O
been	O
available	O
as	O
a	O
language	O
extension	O
to	O
R5RS	B-Language
Scheme	I-Language
for	O
some	O
time	O
.	O
</s>
<s>
Invocations	O
of	O
macros	O
and	O
procedures	O
bear	O
a	O
close	O
resemblance	O
—	O
both	O
are	O
s-expressions	B-Protocol
—	O
but	O
they	O
are	O
treated	O
differently	O
.	O
</s>
<s>
When	O
the	O
compiler	B-Language
encounters	O
an	O
s-expression	B-Protocol
in	O
the	O
program	O
,	O
it	O
first	O
checks	O
to	O
see	O
if	O
the	O
symbol	O
is	O
defined	O
as	O
a	O
syntactic	O
keyword	O
within	O
the	O
current	O
lexical	O
scope	O
.	O
</s>
<s>
If	O
so	O
,	O
it	O
then	O
attempts	O
to	O
expand	O
the	O
macro	O
,	O
treating	O
the	O
items	O
in	O
the	O
tail	O
of	O
the	O
s-expression	B-Protocol
as	O
arguments	O
without	O
compiling	B-Language
code	O
to	O
evaluate	O
them	O
,	O
and	O
this	O
process	O
is	O
repeated	O
recursively	O
until	O
no	O
macro	O
invocations	O
remain	O
.	O
</s>
<s>
If	O
it	O
is	O
not	O
a	O
syntactic	O
keyword	O
,	O
the	O
compiler	B-Language
compiles	B-Language
code	O
to	O
evaluate	O
the	O
arguments	O
in	O
the	O
tail	O
of	O
the	O
s-expression	B-Protocol
and	O
then	O
to	O
evaluate	O
the	O
variable	O
represented	O
by	O
the	O
symbol	O
at	O
the	O
head	O
of	O
the	O
s-expression	B-Protocol
and	O
call	O
it	O
as	O
a	O
procedure	O
with	O
the	O
evaluated	O
tail	O
expressions	O
passed	O
as	O
actual	O
arguments	O
to	O
it	O
.	O
</s>
<s>
Among	O
popular	O
ones	O
are	O
syntactic	O
closures	B-Language
,	O
explicit	O
renaming	O
macros	O
and	O
define-macro	O
,	O
a	O
non-hygienic	O
macro	O
system	O
similar	O
to	O
defmacro	O
system	O
provided	O
in	O
Common	B-Language
Lisp	I-Language
.	O
</s>
<s>
Prior	O
to	O
R5RS	B-Language
,	O
Scheme	O
had	O
no	O
standard	O
equivalent	O
of	O
the	O
eval	O
procedure	O
which	O
is	O
ubiquitous	O
in	O
other	O
Lisps	B-Language
,	O
although	O
the	O
first	O
Lambda	O
Paper	O
had	O
described	O
evaluate	O
as	O
"	O
similar	O
to	O
the	O
LISP	B-Language
function	O
EVAL	O
"	O
and	O
the	O
first	O
Revised	O
Report	O
in	O
1978	O
replaced	O
this	O
with	O
enclose	O
,	O
which	O
took	O
two	O
arguments	O
.	O
</s>
<s>
R5RS	B-Language
resolves	O
this	O
confusion	O
by	O
specifying	O
three	O
procedures	O
that	O
return	O
environments	O
and	O
providing	O
a	O
procedure	O
eval	O
that	O
takes	O
an	O
s-expression	B-Protocol
and	O
an	O
environment	O
and	O
evaluates	O
the	O
expression	O
in	O
the	O
environment	O
provided	O
.	O
</s>
<s>
(	O
R5RS	B-Language
sec	O
.	O
</s>
<s>
With	O
modern	O
scheme	O
(	O
usually	O
compatible	O
with	O
R5RS	B-Language
)	O
to	O
evaluate	O
this	O
expression	O
,	O
one	O
needs	O
to	O
define	O
a	O
function	O
evaluate	O
which	O
can	O
look	O
like	O
this	O
:	O
</s>
<s>
interaction-environment	O
is	O
the	O
interpreter	B-Application
's	O
global	O
environment	O
.	O
</s>
<s>
In	O
most	O
dialects	O
of	O
Lisp	B-Language
including	O
Common	B-Language
Lisp	I-Language
,	O
by	O
convention	O
the	O
value	O
NIL	O
evaluates	O
to	O
the	O
value	O
false	O
in	O
a	O
boolean	O
expression	O
.	O
</s>
<s>
In	O
Scheme	O
,	O
since	O
the	O
IEEE	O
standard	O
in	O
1991	O
,	O
all	O
values	O
except	O
#f	O
,	O
including	O
NIL	O
's	O
equivalent	O
in	O
Scheme	O
which	O
is	O
written	O
as	O
'	O
(	O
)	O
,	O
evaluate	O
to	O
the	O
value	O
true	O
in	O
a	O
boolean	O
expression	O
.	O
</s>
<s>
(	O
R5RS	B-Language
sec	O
.	O
</s>
<s>
Where	O
the	O
constant	O
representing	O
the	O
boolean	O
value	O
of	O
true	O
is	O
T	B-Language
in	O
most	O
Lisps	B-Language
,	O
in	O
Scheme	O
it	O
is	O
#t	O
.	O
</s>
<s>
(	O
R5RS	B-Language
sec	O
.	O
</s>
<s>
Up	O
to	O
the	O
R5RS	B-Language
standard	O
,	O
the	O
standard	O
comment	O
in	O
Scheme	O
was	O
a	O
semicolon	O
,	O
which	O
makes	O
the	O
rest	O
of	O
the	O
line	O
invisible	O
to	O
Scheme	O
.	O
</s>
<s>
Numerous	O
implementations	O
have	O
supported	O
alternative	O
conventions	O
permitting	O
comments	O
to	O
extend	O
for	O
more	O
than	O
a	O
single	O
line	O
,	O
and	O
the	O
R6RS	O
standard	O
permits	O
two	O
of	O
them	O
:	O
an	O
entire	O
s-expression	B-Protocol
may	O
be	O
turned	O
into	O
a	O
comment	O
(	O
or	O
"	O
commented	O
out	O
"	O
)	O
by	O
preceding	O
it	O
with	O
#	O
;	O
(	O
introduced	O
in	O
SRFI	O
62	O
)	O
and	O
a	O
multiline	O
comment	O
or	O
"	O
block	O
comment	O
"	O
may	O
be	O
produced	O
by	O
surrounding	O
text	O
with	O
#|	O
and	O
|#	O
.	O
</s>
<s>
Scheme	O
's	O
input	O
and	O
output	O
is	O
based	O
on	O
the	O
port	O
datatype	O
.	O
</s>
<s>
(	O
R5RS	B-Language
sec	O
6.6	O
)	O
R5RS	B-Language
defines	O
two	O
default	O
ports	O
,	O
accessible	O
with	O
the	O
procedures	O
current-input-port	O
and	O
current-output-port	O
,	O
which	O
correspond	O
to	O
the	O
Unix	O
notions	O
of	O
standard	B-Operating_System
input	I-Operating_System
and	I-Operating_System
standard	I-Operating_System
output	I-Operating_System
.	O
</s>
<s>
Redirection	B-Device
of	O
input	O
and	O
standard	O
output	O
is	O
supported	O
in	O
the	O
standard	O
,	O
by	O
standard	O
procedures	O
such	O
as	O
with-input-from-file	O
and	O
with-output-to-file	O
.	O
</s>
<s>
Most	O
implementations	O
provide	O
string	O
ports	O
with	O
similar	O
redirection	B-Device
capabilities	O
,	O
enabling	O
many	O
normal	O
input-output	O
operations	O
to	O
be	O
performed	O
on	O
string	O
buffers	O
instead	O
of	O
files	O
,	O
using	O
procedures	O
described	O
in	O
SRFI	O
6	O
.	O
</s>
<s>
The	O
following	O
examples	O
are	O
written	O
in	O
strict	O
R5RS	B-Language
Scheme	I-Language
.	O
</s>
<s>
R5RS	B-Language
Scheme	I-Language
provides	O
the	O
predicates	O
input-port	O
?	O
</s>
<s>
In	O
addition	O
to	O
the	O
standard	O
,	O
SRFI	O
28	O
defines	O
a	O
basic	O
formatting	O
procedure	O
resembling	O
Common	B-Language
Lisp	I-Language
's	O
format	O
function	O
,	O
after	O
which	O
it	O
is	O
named	O
.	O
</s>
<s>
At	O
R5RS	B-Language
the	O
language	O
standard	O
formally	O
mandated	O
that	O
programs	O
may	O
change	O
the	O
variable	O
bindings	O
of	O
built-in	O
procedures	O
,	O
effectively	O
redefining	O
them	O
.	O
</s>
<s>
(	O
R5RS	B-Language
"	O
Language	O
changes	O
"	O
)	O
For	O
example	O
,	O
one	O
may	O
extend	O
+	O
to	O
accept	O
strings	O
as	O
well	O
as	O
numbers	O
by	O
redefining	O
it	O
:	O
</s>
<s>
As	O
in	O
other	O
Lisps	B-Language
,	O
the	O
term	O
"	O
thunk	B-Application
"	O
is	O
used	O
in	O
Scheme	O
to	O
refer	O
to	O
a	O
procedure	O
with	O
no	O
arguments	O
.	O
</s>
<s>
The	O
term	O
"	O
proper	B-Language
tail	I-Language
recursion	I-Language
"	O
refers	O
to	O
the	O
property	O
of	O
all	O
Scheme	O
implementations	O
,	O
that	O
they	O
perform	O
tail-call	B-Language
optimization	I-Language
so	O
as	O
to	O
support	O
an	O
indefinite	O
number	O
of	O
active	O
tail	B-Language
calls	I-Language
.	O
</s>
<s>
The	O
form	O
of	O
the	O
titles	O
of	O
the	O
standards	O
documents	O
since	O
R3RS	O
,	O
"	O
Revisedn	O
Report	O
on	O
the	O
Algorithmic	B-Language
Language	I-Language
Scheme	O
"	O
,	O
is	O
a	O
reference	O
to	O
the	O
title	O
of	O
the	O
ALGOL	B-Language
60	I-Language
standard	O
document	O
,	O
"	O
Revised	O
Report	O
on	O
the	O
Algorithmic	B-Language
Language	I-Language
Algol	B-Language
60	I-Language
,	O
"	O
The	O
Summary	O
page	O
of	O
R3RS	O
is	O
closely	O
modeled	O
on	O
the	O
Summary	O
page	O
of	O
the	O
ALGOL	B-Language
60	I-Language
Report	O
.	O
</s>
<s>
The	O
language	O
is	O
formally	O
defined	O
in	O
the	O
standards	O
R5RS	B-Language
(	O
1998	O
)	O
and	O
R6RS	O
(	O
2007	O
)	O
.	O
</s>
<s>
Note	O
that	O
begin	O
is	O
defined	O
as	O
a	O
library	O
syntax	O
in	O
R5RS	B-Language
,	O
but	O
the	O
expander	O
needs	O
to	O
know	O
about	O
it	O
to	O
achieve	O
the	O
splicing	O
functionality	O
.	O
</s>
<s>
The	O
following	O
two	O
tables	O
describe	O
the	O
standard	O
procedures	O
in	O
R5RS	B-Language
Scheme	I-Language
.	O
</s>
<s>
Implementations	O
of	O
-	O
and	O
/	O
that	O
take	O
more	O
than	O
two	O
arguments	O
are	O
defined	O
but	O
left	O
optional	O
at	O
R5RS	B-Language
.	O
</s>
<s>
Because	O
of	O
Scheme	O
's	O
minimalism	O
,	O
many	O
common	O
procedures	O
and	O
syntactic	O
forms	O
are	O
not	O
defined	O
by	O
the	O
standard	O
.	O
</s>
<s>
17	O
:	O
generalized	O
set	B-Language
!	I-Language
</s>
<s>
The	O
elegant	O
,	O
minimalist	O
design	O
has	O
made	O
Scheme	O
a	O
popular	O
target	O
for	O
language	O
designers	O
,	O
hobbyists	O
,	O
and	O
educators	O
,	O
and	O
because	O
of	O
its	O
small	O
size	O
,	O
that	O
of	O
a	O
typical	O
interpreter	B-Application
,	O
it	O
is	O
also	O
a	O
popular	O
choice	O
for	O
embedded	B-Architecture
systems	I-Architecture
and	O
scripting	B-Language
.	O
</s>
<s>
Almost	O
all	O
implementations	O
provide	O
a	O
traditional	O
Lisp-style	O
read	B-Application
–	I-Application
eval	I-Application
–	I-Application
print	I-Application
loop	I-Application
for	O
development	O
and	O
debugging	O
.	O
</s>
<s>
Many	O
also	O
compile	B-Language
Scheme	O
programs	O
to	O
executable	O
binary	O
.	O
</s>
<s>
Support	O
for	O
embedding	O
Scheme	O
code	O
in	O
programs	O
written	O
in	O
other	O
languages	O
is	O
also	O
common	O
,	O
as	O
the	O
relative	O
simplicity	O
of	O
Scheme	O
implementations	O
makes	O
it	O
a	O
popular	O
choice	O
for	O
adding	O
scripting	B-Language
capabilities	O
to	O
larger	O
systems	O
developed	O
in	O
languages	O
such	O
as	O
C	B-Language
.	O
The	O
Gambit	B-Language
,	O
Chicken	B-Language
,	O
and	O
Bigloo	B-General_Concept
Scheme	O
interpreters	B-Application
compile	B-Language
Scheme	O
to	O
C	B-Language
,	O
which	O
makes	O
embedding	O
particularly	O
easy	O
.	O
</s>
<s>
In	O
addition	O
,	O
Bigloo	B-General_Concept
's	O
compiler	B-Language
can	O
be	O
configured	O
to	O
generate	O
JVM	B-Language
bytecode	O
,	O
and	O
it	O
also	O
features	O
an	O
experimental	O
bytecode	O
generator	O
for	O
.NET	B-Application
.	O
</s>
<s>
For	O
example	O
,	O
Kawa	B-Language
and	O
JScheme	B-Language
provide	O
integration	O
with	O
Java	O
classes	O
,	O
and	O
the	O
Scheme	O
to	O
C	B-Language
compilers	B-Language
often	O
make	O
it	O
easy	O
to	O
use	O
external	O
libraries	O
written	O
in	O
C	B-Language
,	O
up	O
to	O
allowing	O
the	O
embedding	O
of	O
actual	O
C	B-Language
code	O
in	O
the	O
Scheme	O
source	O
.	O
</s>
<s>
Another	O
example	O
is	O
Pvts	B-Language
,	O
which	O
offers	O
a	O
set	O
of	O
visual	O
tools	O
for	O
supporting	O
the	O
learning	O
of	O
Scheme	O
.	O
</s>
<s>
Scheme	O
is	O
widely	O
used	O
by	O
a	O
number	O
of	O
schools	O
;	O
in	O
particular	O
,	O
a	O
number	O
of	O
introductory	O
Computer	B-General_Concept
Science	I-General_Concept
courses	O
use	O
Scheme	O
in	O
conjunction	O
with	O
the	O
textbook	O
Structure	B-Language
and	I-Language
Interpretation	I-Language
of	I-Language
Computer	I-Language
Programs	I-Language
(	O
SICP	B-Language
)	O
.	O
</s>
<s>
For	O
the	O
past	O
12	O
years	O
,	O
PLT	B-Operating_System
has	O
run	O
the	O
ProgramByDesign	B-Language
(	O
formerly	O
TeachScheme	B-Language
!	I-Language
)	O
</s>
<s>
MIT	O
's	O
old	O
introductory	O
programming	O
class	O
6.001	O
was	O
taught	O
in	O
Scheme	O
,	O
Although	O
6.001	O
has	O
been	O
replaced	O
by	O
more	O
modern	O
courses	O
,	O
SICP	B-Language
continues	O
to	O
be	O
taught	O
at	O
MIT	O
.	O
</s>
<s>
Likewise	O
,	O
the	O
introductory	O
class	O
at	O
UC	O
Berkeley	O
,	O
CS	B-Language
61A	O
,	O
was	O
until	O
2011	O
taught	O
entirely	O
in	O
Scheme	O
,	O
save	O
minor	O
diversions	O
into	O
Logo	B-Device
to	O
demonstrate	O
dynamic	O
scope	O
.	O
</s>
<s>
Today	O
,	O
like	O
MIT	O
,	O
Berkeley	O
has	O
replaced	O
the	O
syllabus	O
with	O
a	O
more	O
modern	O
version	O
that	O
is	O
primarily	O
taught	O
in	O
Python	B-Language
3	I-Language
,	O
but	O
the	O
current	O
syllabus	O
is	O
still	O
based	O
on	O
the	O
old	O
curriculum	O
,	O
and	O
parts	O
of	O
the	O
class	O
are	O
still	O
taught	O
in	O
Scheme	O
.	O
</s>
<s>
The	O
textbook	O
How	O
to	O
Design	O
Programs	O
by	O
Matthias	O
Felleisen	O
,	O
currently	O
at	O
Northeastern	O
University	O
,	O
is	O
used	O
by	O
some	O
institutes	O
of	O
higher	O
education	O
for	O
their	O
introductory	O
computer	B-General_Concept
science	I-General_Concept
courses	O
.	O
</s>
<s>
Both	O
Northeastern	O
University	O
and	O
Worcester	O
Polytechnic	O
Institute	O
use	O
Scheme	O
exclusively	O
for	O
their	O
introductory	O
courses	O
Fundamentals	O
of	O
Computer	B-General_Concept
Science	I-General_Concept
(	O
CS2500	O
)	O
and	O
Introduction	O
to	O
Program	O
Design	O
(	O
CS1101	O
)	O
,	O
respectively	O
.	O
</s>
<s>
Brandeis	O
University	O
's	O
core	O
course	O
,	O
Structure	O
and	O
Interpretations	O
of	O
Computer	O
Programs	O
(	O
COSI121b	O
)	O
,	O
is	O
also	O
taught	O
exclusively	O
in	O
Scheme	O
by	O
theoretical	O
computer	O
scientist	O
Harry	O
Mairson	O
.	O
</s>
<s>
Indiana	O
University	O
's	O
introductory	O
class	O
,	O
C211	O
,	O
is	O
taught	O
entirely	O
in	O
Scheme	O
.	O
</s>
<s>
A	O
self-paced	O
version	O
of	O
the	O
course	O
,	O
CS	B-Language
61AS	O
,	O
continues	O
to	O
use	O
Scheme	O
.	O
</s>
<s>
The	O
introductory	O
computer	B-General_Concept
science	I-General_Concept
courses	O
at	O
Yale	O
and	O
Grinnell	O
College	O
are	O
also	O
taught	O
in	O
Scheme	O
.	O
</s>
<s>
Programming	O
Design	O
Paradigms	O
,	O
a	O
mandatory	O
course	O
for	O
the	O
Computer	B-General_Concept
science	I-General_Concept
Graduate	O
Students	O
at	O
Northeastern	O
University	O
,	O
also	O
extensively	O
uses	O
Scheme	O
.	O
</s>
<s>
The	O
former	O
introductory	O
Computer	B-General_Concept
Science	I-General_Concept
course	O
at	O
the	O
University	O
of	O
Minnesota	O
-	O
Twin	O
Cities	O
,	O
CSCI	O
1901	O
,	O
also	O
used	O
Scheme	O
as	O
its	O
primary	O
language	O
,	O
followed	O
by	O
a	O
course	O
that	O
introduced	O
students	O
to	O
the	O
Java	O
programming	O
language	O
;	O
however	O
,	O
following	O
the	O
example	O
of	O
MIT	O
,	O
the	O
department	O
replaced	O
1901	O
with	O
the	O
Python-based	O
CSCI	O
1133	O
,	O
while	O
functional	B-Language
programming	I-Language
is	O
covered	O
in	O
detail	O
in	O
the	O
third-semester	O
course	O
CSCI	O
2041	O
.	O
</s>
<s>
In	O
the	O
software	O
industry	O
,	O
Tata	O
Consultancy	O
Services	O
,	O
Asia	O
's	O
largest	O
software	O
consultancy	O
firm	O
,	O
uses	O
Scheme	O
in	O
their	O
month-long	O
training	O
program	O
for	O
fresh	O
college	O
graduates	O
.	O
</s>
<s>
The	O
Document	B-Language
Style	I-Language
Semantics	I-Language
and	I-Language
Specification	I-Language
Language	I-Language
(	O
DSSSL	B-Language
)	O
,	O
which	O
provides	O
a	O
method	O
of	O
specifying	O
SGML	B-Language
stylesheets	O
,	O
uses	O
a	O
Scheme	O
subset	O
.	O
</s>
<s>
The	O
well-known	O
open	B-Application
source	I-Application
raster	B-Application
graphics	I-Application
editor	I-Application
GIMP	B-Application
uses	O
TinyScheme	B-Language
as	O
a	O
scripting	B-Language
language	I-Language
.	O
</s>
<s>
Guile	B-Application
has	O
been	O
adopted	O
by	O
GNU	B-Operating_System
project	O
as	O
its	O
official	O
scripting	B-Language
language	I-Language
,	O
and	O
that	O
implementation	O
of	O
Scheme	O
is	O
embedded	O
in	O
such	O
applications	O
as	O
GNU	B-Application
LilyPond	I-Application
and	O
GnuCash	B-Language
as	O
a	O
scripting	B-Language
language	I-Language
for	O
extensions	O
.	O
</s>
<s>
Likewise	O
,	O
Guile	B-Application
used	O
to	O
be	O
the	O
scripting	B-Language
language	I-Language
for	O
the	O
desktop	O
environment	O
GNOME	B-Application
,	O
and	O
GNOME	B-Application
still	O
has	O
a	O
project	O
that	O
provides	O
Guile	B-Application
bindings	O
to	O
its	O
library	O
stack	O
.	O
</s>
<s>
There	O
is	O
a	O
project	O
to	O
incorporate	O
Guile	B-Application
into	O
GNU	B-Application
Emacs	I-Application
,	O
GNU	B-Operating_System
's	O
flagship	O
program	O
,	O
replacing	O
the	O
current	O
Emacs	B-Operating_System
Lisp	I-Operating_System
interpreter	B-Application
.	O
</s>
<s>
Elk	B-Language
Scheme	I-Language
is	O
used	O
by	O
Synopsys	O
as	O
a	O
scripting	B-Language
language	I-Language
for	O
its	O
technology	O
CAD	O
(	O
TCAD	O
)	O
tools	O
.	O
</s>
<s>
Shiro	O
Kawai	O
,	O
senior	O
programmer	O
on	O
the	O
movie	O
Final	O
Fantasy	O
:	O
The	O
Spirits	O
Within	O
,	O
used	O
Scheme	O
as	O
a	O
scripting	B-Language
language	I-Language
for	O
managing	O
the	O
real-time	O
rendering	O
engine	O
.	O
</s>
<s>
Google	B-Application
App	I-Application
Inventor	I-Application
for	O
Android	B-Application
uses	O
Scheme	O
,	O
where	O
Kawa	B-Language
is	O
used	O
to	O
compile	B-Language
the	O
Scheme	O
code	O
down	O
to	O
byte-codes	O
for	O
the	O
Java	B-Language
Virtual	I-Language
Machine	I-Language
running	O
on	O
Android	B-Application
devices	O
.	O
</s>
