FACTOID # 88: Venezuela is one of the happiest and most murderous places in the world.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Append

In computer programming, append is the name of a procedure for concatenating (linked) lists or arrays in some high-level programming languages. Computer code (HTML with JavaScript) in a tool that uses colors to help the developer see the function of each piece of code. ... A procedure is a series of activities, tasks, steps, decisions, calculations and other processes, that when undertaken in the sequence laid down produces the described result, product or outcome. ... In computer science, a linked list is one of the fundamental data structures used in computer programming. ... In computer programming, an array, also known as a vector or list (for one-dimensional arrays) or a matrix (for two-dimensional arrays), is one of the simplest data structures. ... A high-level programming language is a programming language that is easier to program in, to some extent platform-independent, and abstract from low-level computer processor operations such as memory accesses. ...

Contents


Lisp

Append originates in the Lisp programming language. The append procedure takes two or more (linked) lists as arguments, and returns the concatenation of these lists. Lisp is a family of computer programming languages with a long history and a distinctive fully-parenthesized syntax. ... In computer science, a linked list is one of the fundamental data structures used in computer programming. ...

 (append '(1 2 3) '(a b) '() '(6)) ;Output: (1 2 3 a b 6) 

Since the append procedure must completely copy all of its arguments except the last, both its time and space complexity are O(n) for a list of n elements. It may thus be a source of inefficiency if used injudiciously in code. In computer science, computational complexity theory is the branch of the theory of computation that studies the resources, or cost, of the computation required to solve a given problem. ... It has been suggested that Landau notation be merged into this article or section. ...


The nconc procedure (called append! in Scheme) performs the same function as append, but destructively: it alters the cdr of each argument (save the last), pointing it to the next list. Scheme is a functional programming language and a dialect of Lisp. ... In computer science, an in-place algorithm is an algorithm which transforms a data structure using a small, constant amount of extra storage space. ... In the Lisp programming language, car and cdr (IPA [kədər] or [kudər]) are a pair of primitive functions to extract the left and right half (respectively) of a cons cell. ...


Implementation

Append can easily be defined in terms of cons. The following is a simple implementation in Scheme, for two arguments only: CONS, Connection-Oriented Network Service, is one of the two OSI stack network layer protocols, the other being CLNS (Connectionless Network Service). ...

 (define (append l1 l2) (if (null? l1) l2 (cons (car l1) (append (cdr l1) l2)))) 

Other languages

Following Lisp, other high-level languages which feature linked lists as primitive data structures have adopted an append. Other languages use the + or ++ symbols for nondestructive string/list/array concatenation. A high-level programming language is a programming language that is more user-friendly, to some extent platform-independent, and abstract from low-level computer processor operations such as memory accesses. ... In computer science, a linked list is one of the fundamental data structures used in computer programming. ... A binary tree, a simple type of branching linked data structure. ... In computer programming and some branches of mathematics, strings are sequences of various simple objects. ...


Prolog

The logic programming language Prolog features a built-in append predicate, which can be implemented as follows: Prolog is a logic programming language. ...

 append([],Ys,Ys). append([X|Xs],Ys,[X|Zs]) :- append(Xs,Ys,Zs). 

This predicate can be used for appending, but also for picking lists apart. Calling

 ?- append(L,R,[1,2,3]). 

yields the solutions:

 L = [], R = [1, 2, 3] ; L = [1], R = [2, 3] ; L = [1, 2], R = [3] ; L = [1, 2, 3], R = [] 

References

Steele, Guy L. Jr. Common Lisp: The Language, Second Edition. 1990. pg. 418, description of append. Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, standardised by ANSI X3. ...


  Results from FactBites:
 
Computer virus - Wikipedia, the free encyclopedia (4871 words)
Append the virus code to the executable file
Anti-virus software also needs to be regularly updated in order to gain knowledge about the latest threats and hoaxes.
@mm is an extension commonly appended to the end of a mass mailing computer virus.
StringBuffer (Java 2 Platform SE 5.0) (3470 words)
Whenever an operation occurs involving a source sequence (such as appending or inserting from a source sequence) this class synchronizes only on the string buffer performing the operation, not on the source.
As long as the length of the character sequence contained in the string buffer does not exceed the capacity, it is not necessary to allocate a new internal buffer array.
Appends the specified string to this character sequence.
  More results at FactBites »


 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m