<s>
In	O
computer	B-General_Concept
programming	I-General_Concept
,	O
append	B-Application
is	O
the	O
operation	O
for	O
concatenating	O
linked	B-Data_Structure
lists	I-Data_Structure
or	O
arrays	O
in	O
some	O
high-level	B-Language
programming	I-Language
languages	I-Language
.	O
</s>
<s>
Append	B-Application
originates	O
in	O
the	O
Lisp	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
The	O
append	B-Application
procedure	O
takes	O
zero	O
or	O
more	O
(	O
linked	O
)	O
lists	O
as	O
arguments	O
,	O
and	O
returns	O
the	O
concatenation	O
of	O
these	O
lists	O
.	O
</s>
<s>
Since	O
the	O
append	B-Application
procedure	O
must	O
completely	O
copy	O
all	O
of	O
its	O
arguments	O
except	O
the	O
last	O
,	O
both	O
its	O
time	O
and	O
space	O
complexity	O
are	O
O(n )	O
for	O
a	O
list	O
of	O
elements	O
.	O
</s>
<s>
The	O
nconc	O
procedure	O
(	O
called	O
append	B-Application
!	O
</s>
<s>
in	O
Scheme	B-Language
)	O
performs	O
the	O
same	O
function	O
as	O
append	B-Application
,	O
but	O
destructively	B-Algorithm
:	O
it	O
alters	O
the	O
cdr	B-Language
of	O
each	O
argument	O
(	O
save	O
the	O
last	O
)	O
,	O
pointing	O
it	O
to	O
the	O
next	O
list	O
.	O
</s>
<s>
Append	B-Application
can	O
easily	O
be	O
defined	O
recursively	O
in	O
terms	O
of	O
cons	B-Protocol
.	O
</s>
<s>
The	O
following	O
is	O
a	O
simple	O
implementation	O
in	O
Scheme	B-Language
,	O
for	O
two	O
arguments	O
only	O
:	O
</s>
<s>
Append	B-Application
can	O
also	O
be	O
implemented	O
using	O
fold-right	O
:	O
</s>
<s>
Following	O
Lisp	B-Language
,	O
other	O
high-level	B-Language
languages	I-Language
which	O
feature	O
linked	B-Data_Structure
lists	I-Data_Structure
as	O
primitive	O
data	B-General_Concept
structures	I-General_Concept
have	O
adopted	O
an	O
append	B-Application
.	O
</s>
<s>
Haskell	B-Language
uses	O
the	O
++	O
operator	O
to	O
append	B-Application
lists	O
.	O
</s>
<s>
OCaml	B-Language
uses	O
the	O
@	O
operator	O
to	O
append	B-Application
lists	O
.	O
</s>
<s>
The	O
logic	B-Language
programming	I-Language
language	I-Language
Prolog	B-Language
features	O
a	O
built-in	O
append	B-Application
predicate	O
,	O
which	O
can	O
be	O
implemented	O
as	O
follows	O
:	O
</s>
<s>
This	O
right-fold	O
,	O
from	O
Hughes	O
(	O
1989:5-6	O
)	O
,	O
has	O
the	O
same	O
semantics	O
(	O
by	O
example	O
)	O
as	O
the	O
Scheme	B-Language
implementation	O
above	O
,	O
for	O
two	O
arguments	O
.	O
</s>
<s>
Where	O
reduce	O
is	O
Miranda	O
's	O
name	O
for	O
fold	B-Application
,	O
and	O
cons	B-Protocol
constructs	O
a	O
list	O
from	O
two	O
values	O
or	O
lists	O
.	O
</s>
<s>
This	O
right-fold	O
has	O
the	O
same	O
effect	O
as	O
the	O
Scheme	B-Language
implementation	O
above	O
:	O
</s>
<s>
This	O
is	O
essentially	O
a	O
reimplementation	O
of	O
Haskell	B-Language
's	O
++	O
operator	O
.	O
</s>
<s>
In	O
Perl	B-Language
,	O
the	O
push	O
function	O
is	O
equivalent	O
to	O
the	O
append	B-Application
method	O
,	O
and	O
can	O
be	O
used	O
in	O
the	O
following	O
way	O
.	O
</s>
<s>
When	O
opening	O
a	O
file	O
,	O
use	O
the	O
"	O
>>	O
 "	O
mode	O
to	O
append	B-Application
rather	O
than	O
over	O
write	O
.	O
</s>
<s>
In	O
Python	B-Language
,	O
use	O
the	O
list	O
method	O
"	O
extend	O
"	O
or	O
the	O
infix	O
operators	O
+	O
and	O
+	O
=	O
to	O
append	B-Application
lists	O
.	O
</s>
<s>
Do	O
not	O
confuse	O
with	O
the	O
list	O
method	O
"	O
append	B-Application
"	O
,	O
which	O
adds	O
a	O
single	O
element	O
to	O
a	O
list	O
:	O
</s>
<s>
In	O
Bash	B-Operating_System
the	O
append	B-Application
redirect	O
is	O
the	O
usage	O
of	O
"	O
>>	O
 "	O
for	O
adding	O
a	O
stream	O
to	O
something	O
,	O
like	O
in	O
the	O
following	O
series	O
of	O
shell	O
commands	O
:	O
</s>
