<s>
In	O
computer	B-General_Concept
programming	I-General_Concept
and	O
particularly	O
in	O
Lisp	B-Language
,	O
an	O
association	B-Data_Structure
list	I-Data_Structure
,	O
often	O
referred	O
to	O
as	O
an	O
alist	O
,	O
is	O
a	O
linked	B-Data_Structure
list	I-Data_Structure
in	O
which	O
each	O
list	O
element	O
(	O
or	O
node	B-Data_Structure
)	O
comprises	O
a	O
key	B-Application
and	I-Application
a	I-Application
value	I-Application
.	O
</s>
<s>
The	O
association	B-Data_Structure
list	I-Data_Structure
is	O
said	O
to	O
associate	O
the	O
value	O
with	O
the	O
key	O
.	O
</s>
<s>
In	O
order	O
to	O
find	O
the	O
value	O
associated	O
with	O
a	O
given	O
key	O
,	O
a	O
sequential	B-Algorithm
search	I-Algorithm
is	O
used	O
:	O
each	O
element	O
of	O
the	O
list	O
is	O
searched	O
in	O
turn	O
,	O
starting	O
at	O
the	O
head	O
,	O
until	O
the	O
key	O
is	O
found	O
.	O
</s>
<s>
Associative	B-Application
lists	I-Application
provide	O
a	O
simple	O
way	O
of	O
implementing	O
an	O
associative	B-Application
array	I-Application
,	O
but	O
are	O
efficient	O
only	O
when	O
the	O
number	O
of	O
keys	O
is	O
very	O
small	O
.	O
</s>
<s>
An	O
associative	B-Application
array	I-Application
is	O
an	O
abstract	O
data	O
type	O
that	O
can	O
be	O
used	O
to	O
maintain	O
a	O
collection	O
of	O
key	B-Application
–	I-Application
value	I-Application
pairs	I-Application
and	O
look	O
up	O
the	O
value	O
associated	O
with	O
a	O
given	O
key	O
.	O
</s>
<s>
The	O
association	B-Data_Structure
list	I-Data_Structure
provides	O
a	O
simple	O
way	O
of	O
implementing	O
this	O
data	O
type	O
.	O
</s>
<s>
To	O
test	O
whether	O
a	O
key	O
is	O
associated	O
with	O
a	O
value	O
in	O
a	O
given	O
association	B-Data_Structure
list	I-Data_Structure
,	O
search	O
the	O
list	O
starting	O
at	O
its	O
first	O
node	B-Data_Structure
and	O
continuing	O
either	O
until	O
a	O
node	B-Data_Structure
containing	O
the	O
key	O
has	O
been	O
found	O
or	O
until	O
the	O
search	O
reaches	O
the	O
end	O
of	O
the	O
list	O
(	O
in	O
which	O
case	O
the	O
key	O
is	O
not	O
present	O
)	O
.	O
</s>
<s>
To	O
add	O
a	O
new	O
key	B-Application
–	I-Application
value	I-Application
pair	I-Application
to	O
an	O
association	B-Data_Structure
list	I-Data_Structure
,	O
create	O
a	O
new	O
node	B-Data_Structure
for	O
that	O
key-value	B-Application
pair	I-Application
,	O
set	O
the	O
node	B-Data_Structure
's	O
link	O
to	O
be	O
the	O
previous	O
first	O
element	O
of	O
the	O
association	B-Data_Structure
list	I-Data_Structure
,	O
and	O
replace	O
the	O
first	O
element	O
of	O
the	O
association	B-Data_Structure
list	I-Data_Structure
with	O
the	O
new	O
node	B-Data_Structure
.	O
</s>
<s>
Although	O
some	O
implementations	O
of	O
association	B-Data_Structure
lists	I-Data_Structure
disallow	O
having	O
multiple	O
nodes	O
with	O
the	O
same	O
keys	O
as	O
each	O
other	O
,	O
such	O
duplications	O
are	O
not	O
problematic	O
for	O
this	O
search	O
algorithm	O
:	O
duplicate	O
keys	O
that	O
appear	O
later	O
in	O
the	O
list	O
are	O
ignored	O
.	O
</s>
<s>
It	O
is	O
also	O
possible	O
to	O
delete	O
a	O
key	O
from	O
an	O
association	B-Data_Structure
list	I-Data_Structure
,	O
by	O
scanning	O
the	O
list	O
to	O
find	O
each	O
occurrence	O
of	O
the	O
key	O
and	O
splicing	O
the	O
nodes	O
containing	O
the	O
key	O
out	O
of	O
the	O
list	O
.	O
</s>
<s>
The	O
disadvantage	O
of	O
association	B-Data_Structure
lists	I-Data_Structure
is	O
that	O
the	O
time	O
to	O
search	O
is	O
,	O
where	O
is	O
the	O
length	O
of	O
the	O
list	O
.	O
</s>
<s>
For	O
large	O
lists	O
,	O
this	O
may	O
be	O
much	O
slower	O
than	O
the	O
times	O
that	O
can	O
be	O
obtained	O
by	O
representing	O
an	O
associative	B-Application
array	I-Application
as	O
a	O
binary	B-Language
search	I-Language
tree	I-Language
or	O
as	O
a	O
hash	B-Algorithm
table	I-Algorithm
.	O
</s>
<s>
One	O
advantage	O
of	O
association	B-Data_Structure
lists	I-Data_Structure
is	O
that	O
a	O
new	O
element	O
can	O
be	O
added	O
in	O
constant	O
time	O
.	O
</s>
<s>
Additionally	O
,	O
when	O
the	O
number	O
of	O
keys	O
is	O
very	O
small	O
,	O
searching	O
an	O
association	B-Data_Structure
list	I-Data_Structure
may	O
be	O
more	O
efficient	O
than	O
searching	O
a	O
binary	B-Language
search	I-Language
tree	I-Language
or	O
hash	B-Algorithm
table	I-Algorithm
,	O
because	O
of	O
the	O
greater	O
simplicity	O
of	O
their	O
implementation	O
.	O
</s>
<s>
In	O
the	O
early	O
development	O
of	O
Lisp	B-Language
,	O
association	B-Data_Structure
lists	I-Data_Structure
were	O
used	O
to	O
resolve	O
references	O
to	O
free	O
variables	O
in	O
procedures	O
.	O
</s>
<s>
In	O
this	O
application	O
,	O
it	O
is	O
convenient	O
to	O
augment	O
association	B-Data_Structure
lists	I-Data_Structure
with	O
an	O
additional	O
operation	O
,	O
that	O
reverses	O
the	O
addition	O
of	O
a	O
key	B-Application
–	I-Application
value	I-Application
pair	I-Application
without	O
scanning	O
the	O
list	O
for	O
other	O
copies	O
of	O
the	O
same	O
key	O
.	O
</s>
<s>
In	O
this	O
way	O
,	O
the	O
association	B-Data_Structure
list	I-Data_Structure
can	O
function	O
as	O
a	O
stack	B-Application
,	O
allowing	O
local	O
variables	O
to	O
temporarily	O
shadow	B-Language
other	O
variables	O
with	O
the	O
same	O
names	O
,	O
without	O
destroying	O
the	O
values	O
of	O
those	O
other	O
variables	O
.	O
</s>
<s>
Lisp	B-Language
,	O
</s>
<s>
Scheme	B-Language
,	O
</s>
<s>
Haskell	B-Language
have	O
functions	O
for	O
handling	O
association	B-Data_Structure
lists	I-Data_Structure
in	O
their	O
standard	B-Library
libraries	I-Library
.	O
</s>
