https://en.wikipedia.org/w/api.php?action=feedcontributions&feedformat=atom&user=PuercoPopWikipedia - User contributions [en]2024-11-06T20:51:04ZUser contributionsMediaWiki 1.44.0-wmf.1https://en.wikipedia.org/w/index.php?title=Mmap&diff=848901493Mmap2018-07-05T03:47:27Z<p>PuercoPop: Removed unnecesary conector</p>
<hr />
<div>{{lowercase|title=mmap}}<br />
In [[computing]], '''<code>mmap(2)</code>''' is a [[POSIX]]-compliant [[Unix]] [[system call]] that maps files or devices into memory. It is a method of [[memory-mapped file]] I/O. It implements [[demand paging]], because file contents are not read from disk initially and do not use physical RAM at all. The actual reads from disk are performed in a "[[lazy evaluation|lazy]]" manner, after a specific location is accessed. After the memory is no longer needed, it is important to <code>munmap(2)</code> the pointers to it. Protection information can be managed using <code>mprotect(2)</code>, and special treatment can be enforced using <code>madvise(2)</code>.<br />
<br />
In [[Linux]], [[Mac OS X]] and the [[BSD]]s, <code>mmap</code> can create several types of mappings.<br />
<br />
==History==<br />
<code>mmap</code> and associated systems calls were designed as part of the [[Berkeley Software Distribution]] (BSD) version of Unix. Their API was already described in the 4.2BSD System Manual, even though it was neither implemented in that release, nor in 4.3BSD.<ref>{{cite report |author1=[[Bill Joy|William Joy]] |author2=Eric Cooper |author3=[[Bob Fabry|Robert Fabry]] |author4=[[Samuel Leffler]] |author5=[[Marshall Kirk McKusick|Kirk McKusick]] |author6=David Mosher |title=4.2BSD System Manual |year=1983 |publisher=[[Computer Systems Research Group]], [[University of California, Berkeley]]}}</ref> [[Sun Microsystems]] had implemented this very API, though, in their [[SunOS]] operating system. The BSD developers at [[University of California, Berkeley|U.C. Berkeley]] requested Sun to donate its implementation, but these talks never led to any transfer of code; 4.3BSD-Reno was shipped instead with an implementation based on the virtual memory system of [[Mach (kernel)|Mach]].<ref name="opensources">{{cite encyclopedia |title=Twenty Years of Berkeley Unix: From AT&T-Owned to Freely Redistributable |first=Marshall Kirk |last=McKusick |authorlink=Marshall Kirk McKusick |encyclopedia=Open Sources: Voices from the Open Source Revolution |year=1999 |publisher=O'Reilly}}</ref><br />
<br />
== File-backed and anonymous ==<br />
''File-backed mapping'' maps an area of the process's [[virtual memory]] to files; i.e. reading those areas of memory causes the file to be read. It is the default mapping type.<br />
<br />
''Anonymous mapping'' maps an area of the process's virtual memory not backed by any file. The contents are initialized to zero.<ref>{{cite web |url=https://www.kernel.org/doc/man-pages/online/pages/man2/mmap.2.html |title=mmap(2) - Linux manual page}}</ref> In this respect an anonymous mapping is similar to <code>[[malloc]]</code>, and is used in some <code>malloc(3)</code> implementations for certain allocations. However, anonymous mappings are not part of the POSIX standard, though implemented by almost all operating systems by the <code>MAP_ANONYMOUS</code> and <code>MAP_ANON</code> flags.<br />
<br />
== Memory visibility ==<br />
If the mapping is ''shared'' (the <code>MAP_SHARED</code> flag is set), then it is preserved across a [[Fork (computing)|fork(2)]] system call. This means that writes to a mapped area in one process are immediately visible in all related (parent, child or sibling) processes. If the mapping is ''shared'' and backed by a file (not <code>MAP_ANONYMOUS</code>) the underlying file media is only guaranteed to be written after it is msync(2)'ed.<br />
<br />
If the mapping is ''private'' (the <code>MAP_PRIVATE</code> flag is set), the changes will neither be seen by other processes nor written to the file.<br />
<br />
A process reading from or writing to the underlying file will not always see the same data as a process that has mapped the file, since the segment of the file is copied into RAM and periodically flushed to disk. Synchronization can be forced with the <code>[[msync]]</code> system call.<br />
<br />
mmap(2)ing files can significantly reduce memory overhead for applications accessing the same file; they can share the memory area the file encompasses, instead of loading the file for each application that wants access to it. This means that mmap(2) is sometimes used for [[Interprocess Communication]] (IPC). On modern [[operating system]]s mmap(2) is typically preferred to the [[System V]] IPC [[Shared memory (interprocess communication)|Shared Memory]] facility.<br />
<br />
The main difference between System V shared memory (shmem) and memory mapped I/O (mmap) is that SystemV shared memory is persistent: unless explicitly removed by a process, it is kept in memory and remains available until the system is shut down. mmap'd memory is not persistent between application executions (unless it is backed by a file).<br />
<br />
== Example of usage under the C programming language ==<br />
<syntaxhighlight lang="c"><br />
#include <sys/types.h><br />
#include <sys/mman.h><br />
#include <err.h><br />
#include <fcntl.h><br />
#include <stdio.h><br />
#include <stdlib.h><br />
#include <string.h><br />
#include <unistd.h><br />
<br />
/* Does not work on OS X, as you can't mmap over /dev/zero */<br />
int main(void)<br />
{<br />
const char str1[] = "string 1";<br />
const char str2[] = "string 2";<br />
pid_t parpid = getpid(), childpid;<br />
int fd = -1;<br />
char *anon, *zero;<br />
<br />
if ((fd = open("/dev/zero", O_RDWR, 0)) == -1)<br />
err(1, "open");<br />
<br />
anon = (char*)mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);<br />
zero = (char*)mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);<br />
<br />
if (anon == MAP_FAILED || zero == MAP_FAILED)<br />
errx(1, "either mmap");<br />
<br />
strcpy(anon, str1);<br />
strcpy(zero, str1);<br />
<br />
printf("PID %d:\tanonymous %s, zero-backed %s\n", parpid, anon, zero);<br />
switch ((childpid = fork())) {<br />
case -1:<br />
err(1, "fork");<br />
/* NOTREACHED */<br />
case 0:<br />
childpid = getpid();<br />
printf("PID %d:\tanonymous %s, zero-backed %s\n", childpid, anon, zero);<br />
sleep(3);<br />
<br />
printf("PID %d:\tanonymous %s, zero-backed %s\n", childpid, anon, zero);<br />
munmap(anon, 4096);<br />
munmap(zero, 4096);<br />
close(fd);<br />
return EXIT_SUCCESS;<br />
}<br />
<br />
sleep(2);<br />
strcpy(anon, str2);<br />
strcpy(zero, str2);<br />
<br />
printf("PID %d:\tanonymous %s, zero-backed %s\n", parpid, anon, zero);<br />
munmap(anon, 4096);<br />
munmap(zero, 4096);<br />
close(fd);<br />
return EXIT_SUCCESS;<br />
}<br />
</syntaxhighlight><br />
<br />
sample output:<br />
<pre><nowiki><br />
PID 22475: anonymous string 1, zero-backed string 1<br />
PID 22476: anonymous string 1, zero-backed string 1<br />
PID 22475: anonymous string 2, zero-backed string 2<br />
PID 22476: anonymous string 2, zero-backed string 2<br />
</nowiki></pre><br />
<br />
== See also ==<br />
* [[Virtual memory]] for when there is more address space than physical memory<br />
* [[Paging]] for the implementation of virtual memory<br />
* [[Page cache]] for a disk caching mechanism utilized by mmap<br />
* [[Demand paging]] for a scheme implemented by mmap<br />
<br />
== References and further reading ==<br />
{{Reflist}}<br />
*[http://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html Description from POSIX standard]<br />
*Differences:<br />
**[http://www.freebsd.org/cgi/man.cgi?query=mmap FreeBSD]<br />
**[http://illumos.org/man/2/mmap illumos]<br />
**[https://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/mmap.2.html Mac OS X]<br />
**[http://docs.oracle.com/cd/E23824_01/html/821-1463/mmap-2.html#scrolltoc Solaris]<br />
**[https://archive.is/20070310090003/http://devrsrc1.external.hp.com/STKS/cgi-bin/man2html?debug=0&manpage=/usr/share/man/man2.Z/mmap.2 HP-UX]<br />
**[http://www.qnx.com/developers/docs/6.4.1/neutrino/lib_ref/m/mmap.html QNX]<br />
*Windows<br />
**[http://msdn.microsoft.com/en-us/library/aa366761.aspx MapViewOfFile] win32 function is somewhat equivalent to mmap.<br />
*More example source code:<br />
** [https://github.com/simonhf/sharedhashfile SharedHashFile], An open source, shared memory hash table implemented using mmap().<br />
<br />
{{IPC}}<br />
<br />
[[Category:Inter-process communication]]<br />
[[Category:C POSIX library]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Eduardo_Uribe&diff=841917795Eduardo Uribe2018-05-18T23:07:18Z<p>PuercoPop: Fix typo</p>
<hr />
<div>{{Infobox football biography<br />
| name = Eduardo Uribe<br />
| image = <br />
| fullname = Eduardo Alberto Uribe Oshiro<br />
| birth_date = {{Birth date and age|1985|9|2|df=yes}} <br />
| birth_place = [[Lima]], [[Peru]]<br />
| height = {{height|m=1.80|precision=0}}<br />
| currentclub = [[Carlos A. Mannucci]]<br />
| clubnumber = <br />
| position = [[Midfielder]]<br />
| youthyears1 = <br />
| youthclubs1 = [[Alianza Lima]]<br />
| years1 = 2003–2005 <br />
| years2 = 2005–2006 <br />
| years3 = 2007–2008 <br />
| years4 = 2009–2010<br />
| years5 = 2011<br />
| years6 = 2012 <br />
| years7 = 2013<br />
| years8 = 2014<br />
| years9 = 2015<br />
| years10 = 2016<br />
| years11 = 2017–<br />
| clubs1 = [[Alianza Lima]] <br />
| clubs2 = [[Unión Huaral]] <br />
| clubs3 = [[Coronel Bolognesi]] <br />
| clubs4 = [[Alianza Lima]]<br />
| clubs5 = [[Juan Aurich]]<br />
| clubs6 = [[Real Garcilaso]]<br />
| clubs7 = [[Sporting Cristal]]<br />
| clubs8 = [[Universidad Técnica de Cajamarca|UT Cajamarca]]<br />
| clubs9 = [[FBC Melgar|Melgar]]<br />
| clubs10 = [[Alianza Lima]] <br />
| clubs11 = [[Carlos A. Mannucci]] <br />
| caps1 = | goals1 = 0<br />
| caps2 = | goals2 = 0 <br />
| caps3 = 75 | goals3 = 4 <br />
| caps4 = 55 | goals4 = 1 <br />
| caps5 = 26 | goals5 = 1 <br />
| caps6 = 45 | goals6 = 3<br />
| caps7 = 34 | goals7 = 0<br />
| caps8 = 27 | goals8 = 0<br />
| caps9 = 17 | goals9 = 2<br />
| caps10 = 30 | goals10 = 0<br />
| caps11 = 0 | goals11 = 0<br />
| pcupdate = 1 February 2014<br />
| nationalyears1 = <br />
| nationalteam1 = <br />
| nationalcaps1 = <br />
| nationalgoals1 = <br />
| ntupdate =<br />
| medaltemplates = {{Medal|Team| [[Juan Aurich]]}}<br />
{{Medal|W|[[Primera División Peruana|Peruvian League]]|[[2011 Torneo Descentralizado|2011]]}}<br />
{{Medal|Team| [[FBC Melgar]]}}<br />
{{Medal|W|[[Primera División Peruana|Peruvian League]]|[[2015 Torneo Descentralizado|2015]]}}<br />
}}<br />
<br />
'''Eduardo Alberto "Lalo" Uribe Oshiro''' (born 2 September 1985 in [[Lima]]) is a [[Peruvian]] [[association football|footballer]] currently playing for [[Carlos A. Mannucci]] in the [[Peruvian Segunda División]]. He mainly plays as a [[central midfielder]].<br />
<br />
==Club career==<br />
<br />
{{Empty section|date=December 2012}}<br />
<br />
== Honours ==<br />
=== Club ===<br />
;[[Juan Aurich]]<br />
* [[Torneo Descentralizado]] (1): [[2011 Torneo Descentralizado|2011]]<br />
;[[FBC Melgar|Melgar]]<br />
* [[Torneo Descentralizado]] (1): [[2015 Torneo Descentralizado|2015]]<br />
<br />
==References==<br />
{{Reflist}}<br />
<br />
==External links==<br />
* {{ESPN FC|72086}}<br />
* {{FootballDatabase.eu|eduardo.uribe.39231}}<br />
* {{Soccerway|eduardo-alberto-uribe/23477}}<br />
<br />
{{DEFAULTSORT:Uribe, Eduardo}}<br />
[[Category:1985 births]]<br />
[[Category:Living people]]<br />
[[Category:Sportspeople from Lima]]<br />
[[Category:Association football midfielders]]<br />
[[Category:Peruvian footballers]]<br />
[[Category:Alianza Lima footballers]]<br />
[[Category:Unión Huaral footballers]]<br />
[[Category:Coronel Bolognesi footballers]]<br />
[[Category:Juan Aurich footballers]]<br />
[[Category:Real Garcilaso footballers]]<br />
[[Category:Sporting Cristal footballers]]<br />
[[Category:Universidad Técnica de Cajamarca footballers]]<br />
[[Category:FBC Melgar footballers]]<br />
[[Category:Peruvian Primera División players]]<br />
<br />
<br />
{{Peru-footy-bio-stub}}</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Wish_(Unix_shell)&diff=839772065Wish (Unix shell)2018-05-05T15:31:13Z<p>PuercoPop: Fixed URL to the manpage</p>
<hr />
<div>{{notability|Products|date=November 2016}}<br />
{{lowercase}}<br />
{{Infobox software<br />
| name = Wish<br />
| logo = <!-- Image name is enough. --><br />
| logo alt = <br />
| logo caption = <br />
| screenshot = <!-- Image name is enough. --><br />
| screenshot alt = <br />
| caption = <br />
| collapsible = <!-- Any text here will collapse the screenshot. --><br />
| author = <br />
| developer = <br />
| released = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} --><br />
| discontinued = <!-- Set to yes if software is discontinued, otherwise omit. --><br />
| ver layout = <!-- simple (default) or stacked --><br />
| latest release version = <br />
| latest release date = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} --><br />
| latest preview version = <br />
| latest preview date = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} --><br />
| repo = <!-- {{URL|example.org}} --><br />
| status = <br />
| programming language = <br />
| operating system = <br />
| platform = <br />
| size = <br />
| language = <br />
| language count = <!-- Number only --><br />
| language footnote = <br />
| genre = <br />
| license = <br />
| alexa = <br />
| website = {{URL|http://linux.die.net/man/1/wish}}<br />
| standard = <br />
| AsOf = <br />
}}<br />
'''wish''' (Windowing Shell) is a [[Tcl]] interpreter extended with the [[Tk (software)|Tk commands]]<ref>{{Cite book<br />
| last1=Welch<br />
| first1=Brent B.<br />
| last2=Jones<br />
| first2=Ken<br />
| last3=Hobbs<br />
| first3=Jeffrey<br />
| date=2003 <br />
| title=Practical Programming in Tcl and Tk<br />
| url=<br />
| location=Upper Saddle River<br />
| publisher=Pearson Education, Inc. - Prentice Hall PTTR<br />
| page=25<br />
| edition=4th<br />
| isbn=0-13-038560-3<br />
}}</ref> available for [[Unix-like]] [[operating system]]s with [[X Window System]], [[MacOS]], [[Microsoft Windows]]<ref>{{Cite web<br />
| url=https://www.activestate.com/activetcl<br />
| title=ActiveTcl<br />
| publisher=ActiveState}}</ref><ref>{{Cite web<br />
| url=http://wiki.tcl.tk/1866<br />
| title=Cygwin<br />
| date=2017-05-04<br />
}}</ref> and [[Android (operating system)|Android]]<ref>{{Cite web<br />
| url=http://wiki.tcl.tk/39022<br />
| title=AndroWish<br />
| date=2013-12-04<br />
}}</ref>. It provides developers with the facility to create [[Widget (GUI)|GUI widgets]] using the [[Tk (framework)|Tk toolkit]] in the [[Tcl]] programming language.<ref><br />
{{Citation<br />
| title=Wish &ndash; A Window-Based Shell for X<br />
| last=Gray<br />
| first=Mary<br />
| publisher=Computer Science Department, University of California, Berkeley<br />
| date=May 20, 1988<br />
| url=https://www2.eecs.berkeley.edu/Pubs/TechRpts/1988/CSD-88-420.pdf<br />
| access-date=November 8, 2016<br />
}}</ref><ref>{{Cite book<br />
| last=Flynt<br />
| first=Clif<br />
| date=2012-01-17<br />
| title=Tcl/Tk: A Developer's Guide<br />
| edition=3rd<br />
| url=<br />
| location=Elsevier<br />
| publisher=Morgan Kaufman<br />
| page=17<br />
| isbn=978-0-12-384717-1}}</ref><br />
<br />
wish is [[open source]] and is currently part of the [[Tcl/Tk]] programming suite.<br />
<br />
== Usage ==<br />
<code>wish</code> can be run without parameters. Then the <code>%</code> prompt is displayed and the interpreter awaits for commands entered interactively by the user. An empty window is opened in which the widgets created by user commands are displayed. This mode is suitable for experimenting.<br />
<br />
More often <code>wish</code> is run with a name of a file containing a Tcl/Tk script as a parameter. It is also possible to run directly Tcl/Tk scripts; in [[Unix]] using the [[Shebang (Unix)|shebang]] construction; in [[Windows]] by associating the <code>.tcl</code> extension with the wish program.<br />
<br />
== See also ==<br />
* [[Tcl/Tk]]<br />
<br />
== References ==<br />
{{reflist}}<br />
<br />
== External links ==<br />
* [http://linux.die.net/man/1/wish A man page for wish]<br />
<br />
{{Unix Shells}}<br />
<br />
[[Category:Software that uses Tk]]<br />
[[Category:Unix shells]]<br />
<br />
{{programming-software-stub}}</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Peephole_optimization&diff=839614202Peephole optimization2018-05-04T15:25:16Z<p>PuercoPop: /* Replacement rules */Minor style correction</p>
<hr />
<div>In [[compiler theory]], '''peephole optimization''' is a kind of [[optimization (computer science)|optimization]] performed over a very small set of instructions in a segment of generated code. The set is called a "peephole" or a "window". It works by recognising sets of instructions that can be replaced by shorter or faster sets of instructions.<br />
<br />
==Replacement rules==<br />
Common techniques applied in peephole optimization:<ref>Crafting a Compiler with C++, Fischer/LeBlanc</ref><br />
* Null sequences – Delete useless operations.<br />
* Combine operations – Replace several operations with one equivalent.<br />
* Algebraic laws – Use algebraic laws to simplify or reorder instructions.<br />
* Special case instructions – Use instructions designed for special operand cases.<br />
* Address mode operations – Use address modes to simplify code.<br />
<br />
There can be other types of peephole optimizations.<br />
<br />
==Examples==<br />
{{unreferenced section|date=March 2013}}<br />
===Replacing slow instructions with faster ones===<br />
The following [[Java bytecode]]<br />
<br />
...<br />
aload 1<br />
aload 1<br />
mul<br />
...<br />
<br />
can be replaced by<br />
<br />
...<br />
aload 1<br />
dup<br />
mul<br />
...<br />
<br />
This kind of optimization, like most peephole optimizations, makes certain assumptions about the efficiency of instructions. For instance, in this case, it is assumed that the <code>dup</code> operation (which duplicates and pushes the top of the [[stack (data structure)|stack]]) is more efficient than the <code>aload X</code> operation (which loads a local [[Variable (programming)|variable]] identified as <code>X</code> and pushes it on the stack).<br />
<br />
===Removing redundant code===<br />
Another example is to eliminate redundant load stores.<br />
a = b + c;<br />
d = a + e;<br />
is straightforwardly implemented as<br />
<br />
<source lang="asm"><br />
MOV b, R0 # Copy b to the register<br />
ADD c, R0 # Add c to the register, the register is now b+c<br />
MOV R0, a # Copy the register to a<br />
MOV a, R0 # Copy a to the register<br />
ADD e, R0 # Add e to the register, the register is now a+e [(b+c)+e]<br />
MOV R0, d # Copy the register to d<br />
</source><br />
but can be optimised to<br />
<source lang="asm"><br />
MOV b, R0 # Copy b to the register<br />
ADD c, R0 # Add c to the register, which is now b+c (a)<br />
MOV R0, a # Copy the register to a<br />
ADD e, R0 # Add e to the register, which is now b+c+e [(a)+e]<br />
MOV R0, d # Copy the register to d<br />
</source><br />
<br />
===Removing redundant stack instructions===<br />
If the compiler saves registers on the stack before calling a subroutine and restores them when returning, consecutive calls to subroutines may have redundant stack instructions.<br />
<br />
Suppose the compiler generates the following [[Z80]] instructions for each procedure call:<br />
<br />
<source lang="asm"><br />
PUSH AF<br />
PUSH BC<br />
PUSH DE<br />
PUSH HL<br />
CALL _ADDR<br />
POP HL<br />
POP DE<br />
POP BC<br />
POP AF<br />
</source><br />
<br />
If there were two consecutive subroutine calls, they would look like this:<br />
<br />
<source lang="asm"><br />
PUSH AF<br />
PUSH BC<br />
PUSH DE<br />
PUSH HL<br />
CALL _ADDR1<br />
POP HL<br />
POP DE<br />
POP BC<br />
POP AF<br />
PUSH AF<br />
PUSH BC<br />
PUSH DE<br />
PUSH HL<br />
CALL _ADDR2<br />
POP HL<br />
POP DE<br />
POP BC<br />
POP AF<br />
</source><br />
<br />
The sequence POP regs followed by PUSH for the same registers is generally redundant. In cases where it is redundant, a peephole optimization would remove these instructions. In the example, this would cause another redundant POP/PUSH pair to appear in the peephole, and these would be removed in turn. Removing all of the [[redundant code]] in the example above would eventually leave the following code:<br />
<br />
<source lang="asm"><br />
PUSH AF<br />
PUSH BC<br />
PUSH DE<br />
PUSH HL<br />
CALL _ADDR1<br />
CALL _ADDR2<br />
POP HL<br />
POP DE<br />
POP BC<br />
POP AF<br />
</source><br />
<br />
==Implementation==<br />
Modern architectures typically allow for many hundreds of different kinds of peephole optimizations, and it is therefore often appropriate for [[compiler]] [[computer programming|programmers]] to implement them using a [[pattern matching]] [[algorithm]]. <ref>Compilers – Principles, Techniques, and Tools 2e, p560</ref><br />
<br />
==See also==<br />
*[[Object code optimizer]]s, discussion in relation to general [[algorithmic efficiency]]<br />
*[[Capex Corporation]] – produced the [[COBOL]] [[program optimization|optimizer]], an early mainframe [[object code optimizer]] for [[IBM]] Cobol<br />
*[[Superoptimization]]<br />
<br />
==References==<br />
<references /><br />
<br />
==External links==<br />
* [ftp://ftp.cs.princeton.edu/pub/lcc/contrib/copt.shar The copt general-purpose peephole optimizer by Christopher W. Fraser]<br />
* [http://portal.acm.org/citation.cfm?id=365000 The original paper]<br />
{{wti}}<br />
<br />
{{Compiler optimizations}}<br />
<br />
[[Category:Compiler optimizations]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Bitap_algorithm&diff=820002037Bitap algorithm2018-01-12T14:29:08Z<p>PuercoPop: /* Fuzzy searching */There is nothing intuitive about 1 and 0 representing true and false</p>
<hr />
<div>The '''bitap algorithm''' (also known as the '''shift-or''', '''shift-and''' or '''Baeza-Yates–Gonnet''' algorithm) is an [[approximate string matching]] algorithm. The algorithm tells whether a given text contains a substring which is "approximately equal" to a given pattern, where approximate equality is defined in terms of [[Levenshtein distance]]{{snd}} if the substring and pattern are within a given distance ''k'' of each other, then the algorithm considers them equal. The algorithm begins by precomputing a set of [[bitmask]]s containing one bit for each element of the pattern. Then it is able to do most of the work with [[bitwise operation]]s, which are extremely fast.<br />
<br />
The bitap algorithm is perhaps best known as one of the underlying algorithms of the [[Unix]] [[programming tool|utility]] [[agrep]], written by [[Udi Manber]], [[Sun Wu (computer scientist)|Sun Wu]], and [[Burra Gopal]]. Manber and Wu's original paper gives extensions of the algorithm to deal with fuzzy matching of general [[regular expression]]s.<br />
<br />
Due to the data structures required by the algorithm, it performs best on patterns less than a constant length (typically the [[word length]] of the machine in question), and also prefers inputs over a small alphabet. Once it has been implemented for a given alphabet and word length ''m'', however, its [[running time]] is completely predictable{{snd}}it runs in [[Big O notation|O]](''mn'') operations, no matter the structure of the text or the pattern.<br />
<br />
The bitap algorithm for exact string searching was invented by Bálint Dömölki in 1964{{ref|Domolki64}}{{ref|Domolki68}} and extended by R. K. Shyamasundar in 1977{{ref|shyamasundar77}}, before being reinvented in the context of fuzzy string searching by [[Udi Manber|Manber]] and [[Sun Wu (computer scientist)|Wu]] in 1991{{ref|Manber91}}{{ref|Manber92}} based on work done by [[Ricardo Baeza-Yates]] and [[Gaston Gonnet]].{{ref|BYG89}} The algorithm was improved by Baeza-Yates and [[Gonzalo Navarro|Navarro]] in 1996{{ref|BN96}} and later by [[Gene Myers]] for long patterns in 1998.{{ref|M99}}<br />
<br />
__TOC__<br />
<br />
==Exact searching==<br />
The bitap algorithm for exact [[string searching algorithm|string searching]], in full generality, looks like this in pseudocode:<br />
<br />
'''algorithm''' bitap_search(text : string, pattern : string) '''returns''' string<br />
m := length(pattern)<br />
<br />
if m == 0<br />
return text<br />
<br />
/* Initialize the bit array R. */<br />
R := '''new''' array[m+1] '''of''' bit, initially all 0<br />
R[0] = 1<br />
<br />
'''for''' i = 0; i < length(text); i += 1:<br />
/* Update the bit array. */<br />
'''for''' k = m; k >= 1; k -= 1:<br />
R[k] = R[k-1] & (text[i] == pattern[k-1])<br />
<br />
'''if''' R[m]:<br />
'''return''' (text+i - m) + 1<br />
<br />
'''return''' nil<br />
<br />
Bitap distinguishes itself from other well-known string searching algorithms in its natural mapping onto simple bitwise operations, as in the following modification of the above program. Notice that in this implementation, counterintuitively, each bit with value&nbsp;zero indicates a match, and each bit with value&nbsp;1 indicates a non-match. The same algorithm can be written with the intuitive semantics for 0 and 1, but in that case we must introduce another instruction into the [[inner loop]] to set <code>R |= 1</code>. In this implementation, we take advantage of the fact that left-shifting a value shifts in zeros on the right, which is precisely the behavior we need.<br />
<br />
Notice also that we require <code>CHAR_MAX</code> additional bitmasks in order to convert the <code>(text[i] == pattern[k-1])</code> condition in the general implementation into bitwise operations. Therefore, the bitap algorithm performs better when applied to inputs over smaller alphabets.<br />
<br />
<source lang="c"><br />
#include <string.h><br />
#include <limits.h><br />
<br />
const char *bitap_bitwise_search(const char *text, const char *pattern)<br />
{<br />
int m = strlen(pattern);<br />
unsigned long R;<br />
unsigned long pattern_mask[CHAR_MAX+1];<br />
int i;<br />
<br />
if (pattern[0] == '\0') return text;<br />
if (m > 31) return "The pattern is too long!";<br />
<br />
/* Initialize the bit array R */<br />
R = ~1;<br />
<br />
/* Initialize the pattern bitmasks */<br />
for (i=0; i <= CHAR_MAX; ++i)<br />
pattern_mask[i] = ~0;<br />
for (i=0; i < m; ++i)<br />
pattern_mask[pattern[i]] &= ~(1UL << i);<br />
<br />
for (i=0; text[i] != '\0'; ++i) {<br />
/* Update the bit array */<br />
R |= pattern_mask[text[i]];<br />
R <<= 1;<br />
<br />
if (0 == (R & (1UL << m)))<br />
return (text + i - m) + 1;<br />
}<br />
<br />
return NULL;<br />
}<br />
</source><br />
<br />
==Fuzzy searching==<br />
To perform fuzzy string searching using the bitap algorithm, it is necessary to extend the bit array ''R'' into a second dimension. Instead of having a single array ''R'' that changes over the length of the text, we now have ''k'' distinct arrays ''R''<sub>1..''k''</sub>. Array ''R<sub>i</sub>'' holds a representation of the prefixes of ''pattern'' that match any suffix of the current string with ''i'' or fewer errors. In this context, an "error" may be an insertion, deletion, or substitution; see [[Levenshtein distance]] for more information on these operations.<br />
<br />
The implementation below performs [[fuzzy matching]] (returning the first match with up to ''k'' errors) using the fuzzy bitap algorithm. However, it only pays attention to substitutions, not to insertions or deletions{{snd}}in other words, a [[Hamming distance]] of ''k''. As before, the semantics of 0 and 1 are reversed from their conventional meanings.<br />
<br />
<source lang="c"><br />
#include <stdlib.h><br />
#include <string.h><br />
#include <limits.h><br />
<br />
const char *bitap_fuzzy_bitwise_search(const char *text, const char *pattern, int k)<br />
{<br />
const char *result = NULL;<br />
int m = strlen(pattern);<br />
unsigned long *R;<br />
unsigned long pattern_mask[CHAR_MAX+1];<br />
int i, d;<br />
<br />
if (pattern[0] == '\0') return text;<br />
if (m > 31) return "The pattern is too long!";<br />
<br />
/* Initialize the bit array R */<br />
R = malloc((k+1) * sizeof *R);<br />
for (i=0; i <= k; ++i)<br />
R[i] = ~1;<br />
<br />
/* Initialize the pattern bitmasks */<br />
for (i=0; i <= CHAR_MAX; ++i)<br />
pattern_mask[i] = ~0;<br />
for (i=0; i < m; ++i)<br />
pattern_mask[pattern[i]] &= ~(1UL << i);<br />
<br />
for (i=0; text[i] != '\0'; ++i) {<br />
/* Update the bit arrays */<br />
unsigned long old_Rd1 = R[0];<br />
<br />
R[0] |= pattern_mask[text[i]];<br />
R[0] <<= 1;<br />
<br />
for (d=1; d <= k; ++d) {<br />
unsigned long tmp = R[d];<br />
/* Substitution is all we care about */<br />
R[d] = (old_Rd1 & (R[d] | pattern_mask[text[i]])) << 1;<br />
old_Rd1 = tmp;<br />
}<br />
<br />
if (0 == (R[k] & (1UL << m))) {<br />
result = (text+i - m) + 1;<br />
break;<br />
}<br />
}<br />
<br />
free(R);<br />
return result;<br />
}<br />
</source><br />
<br />
==External links and references==<br />
#{{note|Domolki64}} Bálint Dömölki, An algorithm for syntactical analysis, Computational Linguistics 3, Hungarian Academy of Science pp. 29–46, 1964.<br />
#{{note|Domolki68}} Bálint Dömölki, A universal compiler system based on production rules, BIT Numerical Mathematics, 8(4), pp 262&ndash;275, 1968. {{doi|10.1007/BF01933436}}<br />
#{{note|shyamasundar77}} R. K. Shyamasundar, Precedence parsing using Dömölki's algorithm, International Journal of Computer Mathematics, 6(2)pp 105–114, 1977 <br />
#{{note|Manber91}} Udi Manber, Sun Wu. "Fast text searching with errors." Technical Report TR-91-11. Department of Computer Science, [[University of Arizona]], Tucson, June 1991. ([ftp://ftp.cs.arizona.edu/agrep/agrep.ps.1.Z gzipped PostScript])<br />
#{{note|Manber92}} Udi Manber, Sun Wu. "Fast text search allowing errors." ''[[Communications of the ACM]]'', 35(10): pp. 83&ndash;91, October 1992, {{doi|10.1145/135239.135244}}.<br />
#{{note|BYG89}} Ricardo A. Baeza-Yates, Gastón H. Gonnet. "A New Approach to Text Searching." ''Communications of the ACM'', 35(10): pp. 74&ndash;82, October 1992.<br />
#{{note|BN96}} R. Baeza-Yates and G. Navarro. A faster algorithm for approximate string matching. In Dan Hirchsberg and Gene Myers, editors, ''Combinatorial Pattern Matching'' (CPM'96), LNCS 1075, pages 1&ndash;23, Irvine, CA, June 1996.<br />
#{{note|M99}} G. Myers. "A fast bit-vector algorithm for approximate string matching based on dynamic programming." ''Journal of the ACM'' 46 (3), May 1999, 395&ndash;415. <br />
#[https://web.archive.org/web/20120122013152/http://www.cod5.ch/archive/l/libbitap.html libbitap], a free implementation that shows how the algorithm can easily be extended for most regular expressions. Unlike the code above, it places no limit on the pattern length.<br />
#Baeza-Yates. ''Modern Information Retrieval''. 1999. {{ISBN|0-201-39829-X}}.<br />
#[https://github.com/polovik/Algorithms/blob/master/bitap.py bitap.py] - Python implementation of Bitap algorithm with Wu-Manber modifications.<br />
<br />
{{Strings}}<br />
<br />
[[Category:String matching algorithms]]<br />
[[Category:Articles with example C code]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=List_of_rendering_APIs&diff=794293271List of rendering APIs2017-08-07T02:56:22Z<p>PuercoPop: Missing space after comma</p>
<hr />
<div>'''Rendering [[API]]s''' typically provide just enough functionality to abstract a [[graphics accelerator]], focussing on [[rendering primitive]]s, state management, command lists/[[command buffer]]s; and as such differ from fully fledged [[3D graphics libraries]], [[3D engine]]s (which handle [[scene graph]]s, lights, animation, materials etc.), and GUI frameworks; Some provide fallback [[software rasteriser]]s, which were important for compatibility and adoption before graphics accelerators became widespread.<br />
<br />
Some have been extended to include support for [[compute shader]]s.<br />
<br />
[[Low level]] rendering APIs typically leave more responsibility with the user for resource [[memory management]], and require more verbose control, but have significantly lower [[CPU]] overhead,<ref>{{cite web|title=imagination shows off vullkan gains|url=http://www.bit-tech.net/news/hardware/2015/08/11/imagination-vulkan/1}}</ref> ''and'' allow greater utilisation of [[multicore processor]]s.<br />
<br />
==2D rendering APIs==<br />
<br />
* [[OpenVG]]<br />
* [[Direct2D]]<br />
* [[Quartz 2D]]<br />
* [[Simple Direct Media Layer]]<br />
* [[X11]]<br />
* [[Cairo (graphics)|Cairo]]<br />
* [[Skia Graphics Engine|Skia]]<br />
* [[Qt (software)|Qt GUI]] primitive rendering abstractions, on which Qt widgets are built<br />
* [[HTML5]] [[Canvas element]]<br />
<br />
== Offline rendering ==<br />
<br />
* [[RenderMan Interface Specification|RenderMan]] aimed at offline rendering for CG films. <!--- not sure it fits in this list really ---><br />
<br />
== Software rasterising ==<br />
<br />
As of 2016, these are generally considered obsolete, but were still important during the transition to hardware acceleration:<br />
<br />
* [[Rendermorphic]]s<br />
* [[BRender]] by [[argonaut software]]<br />
* [[Surrender (software)|Surrender]]<br />
<br />
== 3D rendering APIs ==<br />
<br />
These libraries are designed explicitly to abstract 3D graphics hardware for [[Computer-aided design|CAD]] and [[video games]], with possible software fallbacks.<br />
<br />
=== Cross platform, high level ===<br />
* [[OpenGL]] and the [[OpenGL Shading Language]]<br />
* [[OpenGL ES]] 3D API for embedded devices<br />
* [[OpenGL SC]] a version of openGL for safety critical systems.<br />
* [[RenderWare]] (combined game engine and cross platform rendering API. Became popular since the [[PlayStation 2]] had no rendering API, initially relying on [[bare metal]] programming.)<br />
<br />
=== Cross platform, low level ===<br />
* [[Vulkan (API)|Vulkan]]<br />
<br />
=== Vendor specific, high level ===<br />
<br />
* [[Direct3D]] (a subset of [[DirectX]])<br />
* [[Glide API]] for the pioneering [[3DFX]] accelerators<br />
* [[QuickDraw 3D]] developed by Apple Computer starting in 1995, abandoned in 1998<br />
* [[PSGL]] for the [[PlayStation 3]], designed to work in a manner similar to openGL<br />
<br />
=== Vendor specific, low level ===<br />
* [[Direct3D 12]] (a subset of [[DirectX]])<br />
* [[Metal (API)|Metal]] developed by Apple.<br />
* [[Mantle (API)|Mantle]] developed by AMD.<br />
* [[LibGCM]] for the [[PlayStation 3]], a lower level API managing command lists directly<br />
* [[LibGXM]] for the [[PlayStation Vita]]<br />
* [[GNM (API)|LibGNM]] for the [[PlayStation 4]]<br />
* [[Redline]] , for the obsolete [[Rendition Verite]] accelerator<br />
* ''Kamui'' for the Dreamcast <ref>{{cite web|title=dreamcast development board|url=https://forum.beyond3d.com/threads/dreamcast-development-board.49555/}}kamui manual,naomi board,DC</ref><br />
<br />
{{reflist}}<br />
<br />
<br />
<br />
[[Category:Application programming interfaces]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=The_Whole_Truth_(2016_film)&diff=781597370The Whole Truth (2016 film)2017-05-22T05:03:26Z<p>PuercoPop: /* Plot */</p>
<hr />
<div>{{Use mdy dates|date=March 2016}}<br />
{{Infobox film<br />
| name = The Whole Truth<br />
| image = TheWholeTruth 2016poster.jpg<br />
| alt = <br />
| caption = Theatrical release poster<br />
| director = [[Courtney Hunt]]<br />
| producer = {{Plainlist|<br />
* [[Likely Story|Anthony Bregman]]<br />
* Elon Dershowitz<br />
* [[Kevin Frakes]]<br />
}}<br />
| writer = [[Nicholas Kazan]]<br />
| starring = {{Plainlist|<br />
* [[Keanu Reeves]]<br />
* [[Renée Zellweger]]<br />
* [[Gugu Mbatha-Raw]]<br />
* [[Gabriel Basso]]<br />
* [[Jim Belushi]]<br />
}}<br />
| music = {{Plainlist|<br />
* {{Interlanguage link multi|Evgueni Galperine|fr}}<br />
* {{Interlanguage link multi|Sacha Galperine|fr}}<br />
}}<br />
| cinematography = Jules O'Loughlin<br />
| editing = Kate Williams<br />
| studio = {{Plainlist|<br />
* [[Atlas Entertainment]]<br />
* [[Likely Story]]<br />
* Merced Media Partners<br />
* PalmStar Media<br />
}}<br />
| distributor = [[Lionsgate Premiere]]<br />
| released = {{Film date|2016|10|21|United States}}<br />
| runtime = 93 minutes<!--Theatrical runtime: 93:31--><ref>{{cite web | url=http://www.bbfc.co.uk/releases/whole-truth-film | title=''THE WHOLE TRUTH'' (15) | work=[[British Board of Film Classification]] | date=March 24, 2016 | accessdate=March 25, 2016}}</ref><br />
| country = United States<br />
| language = English<br />
| budget = <br />
| gross = <br />
}}<br />
'''''The Whole Truth''''' is a 2016 American [[Thriller (genre)|thriller film]] directed by [[Courtney Hunt]] and written by [[Nicholas Kazan]]. The film stars [[Keanu Reeves]], [[Gabriel Basso]], [[Gugu Mbatha-Raw]], [[Renée Zellweger]], and [[Jim Belushi]].<br />
<br />
Filming began on July 7, 2014 in [[New Orleans]].<ref name=TheWrapProdStart>{{cite web|author1=Linda Ge|title=Jim Belushi Joins Keanu Reeves, Renee Zellweger in Courtney Hunt’s ‘The Whole Truth’|url=http://www.thewrap.com/jim-belushi-joins-keanu-reeves-renee-zellweger-in-courtney-hunts-the-whole-truth/|publisher=The Wrap News Inc.|accessdate=3 October 2015|date=2014-07-10|quote=The film began production this week in New Orleans}}</ref> The film was released on October 21, 2016.<br />
<br />
==Plot==<br />
Defense attorney Richard Ramsay works on a tough case to defend 17 year-old Mike Lassiter, who is suspected of murdering his wealthy father. Ramsay enlists the help of a young lawyer Janelle, who is determined to find out the truth about what happened. Mike was mostly quiet during the trial, which makes Defense attorney Richard Ramsay's job harder. To make things even more difficult, all the witnesses in the murder case lie about the abusive father, including Mike. Mike claims that his mother was abused by his father. But even so, defense attorney Richard somehow manages to convince the jury that Mike is innocent. In the end, it is reveled that Richard is the killer after having an affair with Mike's mother.<br />
<br />
==Cast==<br />
* [[Keanu Reeves]] as Richard Ramsay, a defense attorney<br />
* [[Renée Zellweger]] as Loretta Lassiter, Mike's mother<br />
* [[Gugu Mbatha-Raw]] as Janelle Brady, a younger lawyer<br />
* [[Gabriel Basso]] as Mike Lassiter, a seventeen-year-old suspected of murdering his father<br />
* [[Jim Belushi]] as Boone Lassiter, Mike's father<ref name="Belushi" /><br />
* Jim Klock as Leblanc, the prosecutor<ref name="Klock" /><br />
* [[Sean Bridgers]] as Arthur Westin<br />
* [[Christopher Berry]] as Jack Legrand<br />
<br />
==Production==<br />
[[Daniel Craig]] was originally set to star since January 2014. In April, just a few days before filming was set to commence, he dropped out of the project for unknown reasons.<ref>{{cite news|title=Daniel Craig Abruptly Drops Out of 'The Whole Truth'|url=http://www.hollywoodreporter.com/news/daniel-craig-abruptly-drops-truth-694642|accessdate=4 October 2014|publisher=deadline|date=4 August 2014}}</ref> Craig was replaced by [[Keanu Reeves]] in June.<br />
<br />
On July 10, 2014, [[Jim Belushi]] joined the cast of the film to play Mike's father, and Zellweger would play his mother.<ref name=Belushi>{{cite news|last1=Ge|first1=Linda|title=Jim Belushi Joins Keanu Reeves, Renee Zellweger in Courtney Hunt's ‘The Whole Truth’|url=http://www.thewrap.com/jim-belushi-joins-keanu-reeves-renee-zellweger-in-courtney-hunts-the-whole-truth/|accessdate=July 11, 2014|publisher=thewrap.com|date=July 10, 2014}}</ref> On August 12, Jim Klock was added to the cast to play the prosecutor, who has a rock-solid case against the teen.<ref name=Klock>{{cite news|title=Jim Klock Joins ‘The Whole Truth’|url=http://deadline.com/2014/08/kathryn-morris-the-perfect-guy-jim-klock-the-whole-truth-818175/|accessdate=August 13, 2014|publisher=deadline.com|date=August 12, 2014}}</ref><br />
<br />
===Filming===<br />
[[Principal photography]] of the film began on July 7, 2014, in [[New Orleans]], [[Louisiana]].<ref>{{cite news|title=ON THE SET FOR 7/07/14: Owen Wilson & Kristen Wiff start relativity armored car project, Mel Gibson wraps on ''Blood Father'' |url=http://www.studiosystemnews.com/on-the-set-for-70714-owen-wilson-kristen-wiig-start-relativity-armored-car-project-mel-gibson-wraps-on-blood-father/|accessdate=July 11, 2014|publisher=studiosystemnews.com|date=July 7, 2014}}</ref><ref name="Belushi" /> Previously the filming was slated to take place in [[Boston]].<ref>{{cite news|last1=Banks|first1=Paul|title=New Orleans courts The Whole Truth|url=http://www.kftv.com/news/2014/07/02/New-Orleans-courts-The-Whole-Truth|accessdate=July 14, 2014|publisher=kftv.com|date=July 2, 2014}}</ref><br />
<br />
==References==<br />
{{Reflist}}<br />
<br />
==External links==<br />
* {{IMDb title|3503406|The Whole Truth}}<br />
* {{Rotten Tomatoes|the_whole_truth_2016|The Whole Truth}}<br />
<br />
{{DEFAULTSORT:Whole Truth, The (2016 film)}}<br />
[[Category:2016 films]]<br />
[[Category:American films]]<br />
[[Category:English-language films]]<br />
[[Category:2010s drama films]]<br />
[[Category:2010s thriller films]]<br />
[[Category:American drama films]]<br />
[[Category:American thriller films]]<br />
[[Category:American thriller drama films]]<br />
[[Category:Courtroom films]]<br />
[[Category:Films directed by Courtney Hunt]]<br />
[[Category:Films set in Louisiana]]<br />
[[Category:Films set in New Orleans]]<br />
[[Category:Films shot in Louisiana]]<br />
[[Category:Films shot in New Orleans]]<br />
[[Category:Atlas Entertainment films]]<br />
[[Category:Lions Gate Entertainment films]]<br />
<br />
{{2010s-thriller-film-stub}}</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=The_Whole_Truth_(2016_film)&diff=781597218The Whole Truth (2016 film)2017-05-22T05:01:53Z<p>PuercoPop: /* Plot */ remove extra space before punctuation</p>
<hr />
<div>{{Use mdy dates|date=March 2016}}<br />
{{Infobox film<br />
| name = The Whole Truth<br />
| image = TheWholeTruth 2016poster.jpg<br />
| alt = <br />
| caption = Theatrical release poster<br />
| director = [[Courtney Hunt]]<br />
| producer = {{Plainlist|<br />
* [[Likely Story|Anthony Bregman]]<br />
* Elon Dershowitz<br />
* [[Kevin Frakes]]<br />
}}<br />
| writer = [[Nicholas Kazan]]<br />
| starring = {{Plainlist|<br />
* [[Keanu Reeves]]<br />
* [[Renée Zellweger]]<br />
* [[Gugu Mbatha-Raw]]<br />
* [[Gabriel Basso]]<br />
* [[Jim Belushi]]<br />
}}<br />
| music = {{Plainlist|<br />
* {{Interlanguage link multi|Evgueni Galperine|fr}}<br />
* {{Interlanguage link multi|Sacha Galperine|fr}}<br />
}}<br />
| cinematography = Jules O'Loughlin<br />
| editing = Kate Williams<br />
| studio = {{Plainlist|<br />
* [[Atlas Entertainment]]<br />
* [[Likely Story]]<br />
* Merced Media Partners<br />
* PalmStar Media<br />
}}<br />
| distributor = [[Lionsgate Premiere]]<br />
| released = {{Film date|2016|10|21|United States}}<br />
| runtime = 93 minutes<!--Theatrical runtime: 93:31--><ref>{{cite web | url=http://www.bbfc.co.uk/releases/whole-truth-film | title=''THE WHOLE TRUTH'' (15) | work=[[British Board of Film Classification]] | date=March 24, 2016 | accessdate=March 25, 2016}}</ref><br />
| country = United States<br />
| language = English<br />
| budget = <br />
| gross = <br />
}}<br />
'''''The Whole Truth''''' is a 2016 American [[Thriller (genre)|thriller film]] directed by [[Courtney Hunt]] and written by [[Nicholas Kazan]]. The film stars [[Keanu Reeves]], [[Gabriel Basso]], [[Gugu Mbatha-Raw]], [[Renée Zellweger]], and [[Jim Belushi]].<br />
<br />
Filming began on July 7, 2014 in [[New Orleans]].<ref name=TheWrapProdStart>{{cite web|author1=Linda Ge|title=Jim Belushi Joins Keanu Reeves, Renee Zellweger in Courtney Hunt’s ‘The Whole Truth’|url=http://www.thewrap.com/jim-belushi-joins-keanu-reeves-renee-zellweger-in-courtney-hunts-the-whole-truth/|publisher=The Wrap News Inc.|accessdate=3 October 2015|date=2014-07-10|quote=The film began production this week in New Orleans}}</ref> The film was released on October 21, 2016.<br />
<br />
==Plot==<br />
Defense attorney Richard Ramsay works on a tough case to defend 17 year-old Mike Lassiter, who is suspected of murdering his wealthy father. Ramsay enlists the help of a young lawyer Janelle, who is determined to find out the truth about what happened. Mike was mostly quiet during the trial, which makes Defense attorney Richard Ramsay's job harder. To make things even more difficult, all the witnesses in the murder case lie about the abusive father, including Mike. Mike claims that his mother was abused by his father. But even so, defense attorney Richard somehow manages to convince the jurys to find Mike innocent. In the end, it is reveled that Richard is the killer after having an affair with Mike's mother.<br />
<br />
==Cast==<br />
* [[Keanu Reeves]] as Richard Ramsay, a defense attorney<br />
* [[Renée Zellweger]] as Loretta Lassiter, Mike's mother<br />
* [[Gugu Mbatha-Raw]] as Janelle Brady, a younger lawyer<br />
* [[Gabriel Basso]] as Mike Lassiter, a seventeen-year-old suspected of murdering his father<br />
* [[Jim Belushi]] as Boone Lassiter, Mike's father<ref name="Belushi" /><br />
* Jim Klock as Leblanc, the prosecutor<ref name="Klock" /><br />
* [[Sean Bridgers]] as Arthur Westin<br />
* [[Christopher Berry]] as Jack Legrand<br />
<br />
==Production==<br />
[[Daniel Craig]] was originally set to star since January 2014. In April, just a few days before filming was set to commence, he dropped out of the project for unknown reasons.<ref>{{cite news|title=Daniel Craig Abruptly Drops Out of 'The Whole Truth'|url=http://www.hollywoodreporter.com/news/daniel-craig-abruptly-drops-truth-694642|accessdate=4 October 2014|publisher=deadline|date=4 August 2014}}</ref> Craig was replaced by [[Keanu Reeves]] in June.<br />
<br />
On July 10, 2014, [[Jim Belushi]] joined the cast of the film to play Mike's father, and Zellweger would play his mother.<ref name=Belushi>{{cite news|last1=Ge|first1=Linda|title=Jim Belushi Joins Keanu Reeves, Renee Zellweger in Courtney Hunt's ‘The Whole Truth’|url=http://www.thewrap.com/jim-belushi-joins-keanu-reeves-renee-zellweger-in-courtney-hunts-the-whole-truth/|accessdate=July 11, 2014|publisher=thewrap.com|date=July 10, 2014}}</ref> On August 12, Jim Klock was added to the cast to play the prosecutor, who has a rock-solid case against the teen.<ref name=Klock>{{cite news|title=Jim Klock Joins ‘The Whole Truth’|url=http://deadline.com/2014/08/kathryn-morris-the-perfect-guy-jim-klock-the-whole-truth-818175/|accessdate=August 13, 2014|publisher=deadline.com|date=August 12, 2014}}</ref><br />
<br />
===Filming===<br />
[[Principal photography]] of the film began on July 7, 2014, in [[New Orleans]], [[Louisiana]].<ref>{{cite news|title=ON THE SET FOR 7/07/14: Owen Wilson & Kristen Wiff start relativity armored car project, Mel Gibson wraps on ''Blood Father'' |url=http://www.studiosystemnews.com/on-the-set-for-70714-owen-wilson-kristen-wiig-start-relativity-armored-car-project-mel-gibson-wraps-on-blood-father/|accessdate=July 11, 2014|publisher=studiosystemnews.com|date=July 7, 2014}}</ref><ref name="Belushi" /> Previously the filming was slated to take place in [[Boston]].<ref>{{cite news|last1=Banks|first1=Paul|title=New Orleans courts The Whole Truth|url=http://www.kftv.com/news/2014/07/02/New-Orleans-courts-The-Whole-Truth|accessdate=July 14, 2014|publisher=kftv.com|date=July 2, 2014}}</ref><br />
<br />
==References==<br />
{{Reflist}}<br />
<br />
==External links==<br />
* {{IMDb title|3503406|The Whole Truth}}<br />
* {{Rotten Tomatoes|the_whole_truth_2016|The Whole Truth}}<br />
<br />
{{DEFAULTSORT:Whole Truth, The (2016 film)}}<br />
[[Category:2016 films]]<br />
[[Category:American films]]<br />
[[Category:English-language films]]<br />
[[Category:2010s drama films]]<br />
[[Category:2010s thriller films]]<br />
[[Category:American drama films]]<br />
[[Category:American thriller films]]<br />
[[Category:American thriller drama films]]<br />
[[Category:Courtroom films]]<br />
[[Category:Films directed by Courtney Hunt]]<br />
[[Category:Films set in Louisiana]]<br />
[[Category:Films set in New Orleans]]<br />
[[Category:Films shot in Louisiana]]<br />
[[Category:Films shot in New Orleans]]<br />
[[Category:Atlas Entertainment films]]<br />
[[Category:Lions Gate Entertainment films]]<br />
<br />
{{2010s-thriller-film-stub}}</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=StumpWM&diff=762195628StumpWM2017-01-27T07:37:46Z<p>PuercoPop: properly reference License. Previously it pointed to ratpoison's license information</p>
<hr />
<div>{{Infobox software<br />
| name = StumpWM<br />
| screenshot = [[File:Stumpwm.png|250px]]<br />
| caption = StumpWM, a [[window manager]] in [[Common Lisp]]<br />
| developer = Shawn Betts<br />
| programming_language = [[Common Lisp]]<br />
| operating_system = [[Unix-like]]<br />
| genre = [[Window manager]]<br />
| license = [[GPLv2]]+<ref name="savannah">{{Citation | url = https://github.com/stumpwm/stumpwm/blob/master/COPYING | title = StumpWM COPYING file}}.</ref><br />
| website = {{url|https://github.com/stumpwm/stumpwm}}<br />
}}<br />
<br />
'''StumpWM''' is a [[tiling window manager]] that was created when developer Shawn Betts found [[ratpoison]] growing increasingly [[software bloat|large]] and "[[Lisp (programming language)|lispy]]". Intended as a successor to ratpoison, StumpWM is released under the terms of the [[GNU General Public License]], version 2 (GPLv2).<ref name="savannah"/><br />
<br />
As explained on the StumpWM wiki, the developers decided to largely re-implement ratpoison in [[Common Lisp]] using [[CLX (Common Lisp)|CLX]]:<ref>{{cite web |url=https://github.com/stumpwm/stumpwm/wiki/Background |title=Background |publisher=The StumpWM wiki |date=2006-10-05 |accessdate=2014-12-01}}</ref><br />
<br />
{{quote |StumpWM grew out of the authors' frustration with writing ratpoison in C. Very quickly we realized we were building into ratpoison lispy-[[emacs]] style paradigms. We had a [[Read-eval-print loop|REPL]] hanging off 'C-t&nbsp;:', hooks, and a growing subset of Common Lisp in the implementation... It was clear what we ''really'' wanted was a window manager written in Lisp from the ground up with lots of room for customizing and real-time hacking.}}<br />
<br />
The authors describe StumpWM in the following terms:<ref name=stumparch>{{cite web|url=http://wiki.archlinux.org/index.php/Stumpwm|title=Stumpwm - ArchWiki}}</ref><br />
<br />
{{quote|StumpWM attempts to be customizable yet visually minimal. There are no window decorations, no icons, and no buttons. It does have various hooks to attach your personal customizations, and variables to tweak.}}<br />
<br />
==Lisp and customization==<br />
StumpWM can be run in both [[Steel Bank Common Lisp]] (SBCL) and [[GNU]] [[CLISP]], with SBCL generally being preferred for better performance.<ref name=stumparch/> The [[SLIME]] environment is commonly used for applying real-time updates and customizations to StumpWM. There is also another program called ''stumpish'' ("StumpWM Interactive Shell") that provides a standard way to interface with the window manager from a terminal.<ref name=stumparch/><br />
<br />
Window manager customizations are stored in a ''.stumpwmrc'' file that is found in the home directory of each user. This file contains Lisp code for configuring StumpWM.<ref name=stumparch/><br />
<br />
==Development==<br />
StumpWM source code is hosted on [[Github]] and the [[version control system]] used is [[Git (software)|Git]].<ref>{{cite web|url=http://www.nongnu.org/stumpwm/download.html|title=The Stump Window Manager: Downloads}}</ref> A mailing list is also available for StumpWM related issues<ref>{{cite web|url=https://lists.nongnu.org/mailman/listinfo/stumpwm-devel|title=Stump-devel}}</ref>.<br />
<br />
==See also==<br />
{{Portal|Free software}}<br />
* [[Sawfish (window manager)|Sawfish]], a [[stacking window manager]] written in Lisp<br />
* [[Greenspun's tenth rule]]<br />
<br />
==References==<br />
{{reflist}}<br />
<br />
{{X desktop environments and window managers}}<br />
<br />
[[Category:Free X window managers]]<br />
[[Category:Tiling window managers]]<br />
[[Category:X window managers extensible by scripting]]<br />
[[Category:Free software programmed in Lisp]]<br />
[[Category:Common Lisp software]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=StumpWM&diff=762193755StumpWM2017-01-27T07:16:06Z<p>PuercoPop: Add reference to the maling list, hosted in Savannah</p>
<hr />
<div>{{Infobox software<br />
| name = StumpWM<br />
| screenshot = [[File:Stumpwm.png|250px]]<br />
| caption = StumpWM, a [[window manager]] in [[Common Lisp]]<br />
| developer = Shawn Betts<br />
| programming_language = [[Common Lisp]]<br />
| operating_system = [[Unix-like]]<br />
| genre = [[Window manager]]<br />
| license = [[GPLv2]]+<ref name="savannah">{{Citation | url = http://savannah.nongnu.org/projects/ratpoison | contribution = ratpoison summary page | title = Savannah | publisher = The Free Software Foundation}}.</ref><br />
| website = {{url|https://github.com/stumpwm/stumpwm}}<br />
}}<br />
<br />
'''StumpWM''' is a [[tiling window manager]] that was created when developer Shawn Betts found [[ratpoison]] growing increasingly [[software bloat|large]] and "[[Lisp (programming language)|lispy]]". Intended as a successor to ratpoison, StumpWM is released under the terms of the [[GNU General Public License]], version 2 (GPLv2).<ref name="savannah"/><br />
<br />
As explained on the StumpWM wiki, the developers decided to largely re-implement ratpoison in [[Common Lisp]] using [[CLX (Common Lisp)|CLX]]:<ref>{{cite web |url=https://github.com/stumpwm/stumpwm/wiki/Background |title=Background |publisher=The StumpWM wiki |date=2006-10-05 |accessdate=2014-12-01}}</ref><br />
<br />
{{quote |StumpWM grew out of the authors' frustration with writing ratpoison in C. Very quickly we realized we were building into ratpoison lispy-[[emacs]] style paradigms. We had a [[Read-eval-print loop|REPL]] hanging off 'C-t&nbsp;:', hooks, and a growing subset of Common Lisp in the implementation... It was clear what we ''really'' wanted was a window manager written in Lisp from the ground up with lots of room for customizing and real-time hacking.}}<br />
<br />
The authors describe StumpWM in the following terms:<ref name=stumparch>{{cite web|url=http://wiki.archlinux.org/index.php/Stumpwm|title=Stumpwm - ArchWiki}}</ref><br />
<br />
{{quote|StumpWM attempts to be customizable yet visually minimal. There are no window decorations, no icons, and no buttons. It does have various hooks to attach your personal customizations, and variables to tweak.}}<br />
<br />
==Lisp and customization==<br />
StumpWM can be run in both [[Steel Bank Common Lisp]] (SBCL) and [[GNU]] [[CLISP]], with SBCL generally being preferred for better performance.<ref name=stumparch/> The [[SLIME]] environment is commonly used for applying real-time updates and customizations to StumpWM. There is also another program called ''stumpish'' ("StumpWM Interactive Shell") that provides a standard way to interface with the window manager from a terminal.<ref name=stumparch/><br />
<br />
Window manager customizations are stored in a ''.stumpwmrc'' file that is found in the home directory of each user. This file contains Lisp code for configuring StumpWM.<ref name=stumparch/><br />
<br />
==Development==<br />
StumpWM source code is hosted on [[Github]] and the [[version control system]] used is [[Git (software)|Git]].<ref>{{cite web|url=http://www.nongnu.org/stumpwm/download.html|title=The Stump Window Manager: Downloads}}</ref> A mailing list is also available for StumpWM related issues<ref>{{cite web|url=https://lists.nongnu.org/mailman/listinfo/stumpwm-devel|title=Stump-devel}}</ref>.<br />
<br />
==See also==<br />
{{Portal|Free software}}<br />
* [[Sawfish (window manager)|Sawfish]], a [[stacking window manager]] written in Lisp<br />
* [[Greenspun's tenth rule]]<br />
<br />
==References==<br />
{{reflist}}<br />
<br />
{{X desktop environments and window managers}}<br />
<br />
[[Category:Free X window managers]]<br />
[[Category:Tiling window managers]]<br />
[[Category:X window managers extensible by scripting]]<br />
[[Category:Free software programmed in Lisp]]<br />
[[Category:Common Lisp software]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=StumpWM&diff=762193598StumpWM2017-01-27T07:13:59Z<p>PuercoPop: /* Development */ The source code is hosted on github</p>
<hr />
<div>{{Infobox software<br />
| name = StumpWM<br />
| screenshot = [[File:Stumpwm.png|250px]]<br />
| caption = StumpWM, a [[window manager]] in [[Common Lisp]]<br />
| developer = Shawn Betts<br />
| programming_language = [[Common Lisp]]<br />
| operating_system = [[Unix-like]]<br />
| genre = [[Window manager]]<br />
| license = [[GPLv2]]+<ref name="savannah">{{Citation | url = http://savannah.nongnu.org/projects/ratpoison | contribution = ratpoison summary page | title = Savannah | publisher = The Free Software Foundation}}.</ref><br />
| website = {{url|https://github.com/stumpwm/stumpwm}}<br />
}}<br />
<br />
'''StumpWM''' is a [[tiling window manager]] that was created when developer Shawn Betts found [[ratpoison]] growing increasingly [[software bloat|large]] and "[[Lisp (programming language)|lispy]]". Intended as a successor to ratpoison, StumpWM is released under the terms of the [[GNU General Public License]], version 2 (GPLv2).<ref name="savannah"/><br />
<br />
As explained on the StumpWM wiki, the developers decided to largely re-implement ratpoison in [[Common Lisp]] using [[CLX (Common Lisp)|CLX]]:<ref>{{cite web |url=https://github.com/stumpwm/stumpwm/wiki/Background |title=Background |publisher=The StumpWM wiki |date=2006-10-05 |accessdate=2014-12-01}}</ref><br />
<br />
{{quote |StumpWM grew out of the authors' frustration with writing ratpoison in C. Very quickly we realized we were building into ratpoison lispy-[[emacs]] style paradigms. We had a [[Read-eval-print loop|REPL]] hanging off 'C-t&nbsp;:', hooks, and a growing subset of Common Lisp in the implementation... It was clear what we ''really'' wanted was a window manager written in Lisp from the ground up with lots of room for customizing and real-time hacking.}}<br />
<br />
The authors describe StumpWM in the following terms:<ref name=stumparch>{{cite web|url=http://wiki.archlinux.org/index.php/Stumpwm|title=Stumpwm - ArchWiki}}</ref><br />
<br />
{{quote|StumpWM attempts to be customizable yet visually minimal. There are no window decorations, no icons, and no buttons. It does have various hooks to attach your personal customizations, and variables to tweak.}}<br />
<br />
==Lisp and customization==<br />
StumpWM can be run in both [[Steel Bank Common Lisp]] (SBCL) and [[GNU]] [[CLISP]], with SBCL generally being preferred for better performance.<ref name=stumparch/> The [[SLIME]] environment is commonly used for applying real-time updates and customizations to StumpWM. There is also another program called ''stumpish'' ("StumpWM Interactive Shell") that provides a standard way to interface with the window manager from a terminal.<ref name=stumparch/><br />
<br />
Window manager customizations are stored in a ''.stumpwmrc'' file that is found in the home directory of each user. This file contains Lisp code for configuring StumpWM.<ref name=stumparch/><br />
<br />
==Development==<br />
StumpWM source code is hosted on [[Github]] and the [[version control system]] used is [[Git (software)|Git]].<ref>{{cite web|url=http://www.nongnu.org/stumpwm/download.html|title=The Stump Window Manager: Downloads}}</ref> A mailing list is also available for StumpWM related issues.<br />
<br />
==See also==<br />
{{Portal|Free software}}<br />
* [[Sawfish (window manager)|Sawfish]], a [[stacking window manager]] written in Lisp<br />
* [[Greenspun's tenth rule]]<br />
<br />
==References==<br />
{{reflist}}<br />
<br />
{{X desktop environments and window managers}}<br />
<br />
[[Category:Free X window managers]]<br />
[[Category:Tiling window managers]]<br />
[[Category:X window managers extensible by scripting]]<br />
[[Category:Free software programmed in Lisp]]<br />
[[Category:Common Lisp software]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Amber_Smalltalk&diff=758327820Amber Smalltalk2017-01-04T19:54:49Z<p>PuercoPop: Updated the URL to the new repository</p>
<hr />
<div>{{Infobox software<br />
| name = Amber Smalltalk<br />
| logo = File:Amber Smalltalk Logo.svg<br />
| logo caption = An ancient flying insect caught in amber.<br />
| author = Nicolas Petton<br />
| developer = Amber Community<br />
| released = {{Start date and age|2011|09|13}}<br />
| latest release version = 0.15.1<br />
| latest release date = {{Start date and age|2016|02|06}}<br />
| latest preview version = <br />
| latest preview date = <!-- {{Start date and age|YYYY|MM|DD}} --><br />
| frequently updated = <!-- DO NOT include this parameter unless you know what it does --><br />
| status = Active<br />
| programming language = [[Smalltalk]], [[JavaScript]]<br />
| operating system = [[Cross-platform]]<br />
| platform = [[Web browser]]<br />
| size = <br />
| language = English<br />
| genre = [[Object-oriented programming]] language, [[Integrated development environment|IDE]]<br />
| license = [[MIT license|MIT]]<br />
| alexa = <br />
| website = {{URL|www.amber-lang.net}}<br />
| repo = {{URL|https://lolg.it/amber/amber}}<br />
| standard = <br />
| AsOf = <br />
}}<br />
'''Amber Smalltalk''', formerly named Jtalk, is an implementation of the [[Smalltalk]]-80 language that runs on the [[JavaScript]] runtime of a [[web browser]]. It is designed to enable client-side development using the Smalltalk programming language.<ref name=":0">[https://sites.google.com/a/world.st/worldofst/try/implementations Smalltalk Implementations] (brief comparative summaries describing Smalltalk dialects)</ref> The programming environment in Amber is named Helios.<ref name=":1" /><br />
<br />
== Key features ==<br />
Amber includes an [[integrated development environment]] (IDE) with a [[class browser]], Workspace, transcript, object inspector, and [[debugger]]. Amber is written in itself (is [[self-hosting]]), including the [[compiler]], and compiles into JavaScript, mapping one-to-one with the JavaScript equivalent.<ref>{{Cite web|title= Amber Smalltalk|url= http://amber-lang.net/|website= amber-lang.net|access-date= 2016-01-30|first= Nicolas|last= Petton}}</ref> This one-to-one mapping with JavaScript differentiates Amber from other Smalltalk variants such as [[Pharo]], [[Seaside (software)|Seaside]], and [[Squeak]].<ref name=":0"/> Starting the Amber IDE requires [[Node.js]]. Amber doesn't run slowly on a [[bytecode]] [[virtual machine]] due to its convenient mapping to JavaScript, which makes compiled code run fast.<br />
<br />
== History ==<br />
Amber was originally created by Nicolas Petton in 2011.<ref name="InfoQ-Shuster-2011-08-22">{{cite news |last= Schuster |first= Werner |date= August 22, 2011 |title= Smalltalk IDEs Come to the Browser: Jtalk, tODE, Lively Kernel 2.0 |url= http://www.infoq.com/news/2011/08/smalltalk-in-browser |accessdate= October 20, 2011}}</ref> Amber was influenced by an earlier Smalltalk in browser project, named ''Clamato'', created by Avi Bryant.<ref name="InfoQ-Shuster-2011-08-22" /><ref name="Clamato">{{cite web |title= Clamato |url= http://clamato.net/ }} (Clamato Smalltalk project website)<br />
</ref> Amber and Clamato both use [[parsing expression grammar]] (PEG) libraries to parse Smalltalk [[source code]]. Amber uses the [[JavaScript]] based PEG.js library<ref name="PEG.js">{{cite web |url= http://pegjs.majda.cz/ |title= PEG.js: Parser Generator for JavaScript |last= Majda |first= David |date= 2010–2016 |website= PEG.js.org |publisher= David Majda |access-date= 13 November 2016}}<br />
</ref><ref name="Amber">{{cite web |url= https://groups.google.com/d/topic/amber-lang/FsuX8geVXpk/discussion |title= Bye, bye Jtalk... Hello Amber! |last= Petton |first= Nicolas |date= 13 September 2011 |website= Google Groups |publisher= Google, Inc. |access-date= 13 November 2016 |quote=... we are now making a first release humbly numbered 0.9. We are also taking the opportunity to pick a slicker name for Jtalk - Amber!}}<br />
</ref> written by David Majda. Clamato uses PetitParser, a Smalltalk-based library written by Lukas Renggli.<ref name="InfoQ-Shuster-2011-08-22" /> Clamato and Amber were both influenced by earlier work by [[Dan Ingalls]] in developing the [[Lively Kernel]] implementation of [[Morphic (software)|Morphic]] to run in web browsers via JavaScript.<ref name="InfoQ-Shuster-2011-08-22" /><ref name="InfoQ-Shuster-2011-06-22">{{cite news |url= http://www.infoq.com/interviews/ingalls-smalltalk |title= Dan Ingalls on the History of Smalltalk and the Lively Kernel |date= June 22, 2010 |accessdate= October 26, 2011 |last= Shuster |first= Werner}}</ref><br />
<br />
Starting with version 0.12.0, Amber modules compile to [[asynchronous module definition]] (AMD).<ref>{{Cite web|title= amber-smalltalk/amber|url= https://github.com/amber-smalltalk/amber/wiki/Migration-from-0.11-to-0.12|website= GitHub|access-date= 2016-01-30}}</ref> Starting with version 0.12.6, the development helper [[command-line interface]] (CLI) tool is extracted to dedicated module <code>amber-cli</code>, which can be installed from [[npm (software)|npm]]; and setting up the project and its JavaScript ecosystem (bower, npm, grunt) is greatly simplified using this CLI tool by issuing <code>amber init</code> and answering a few questions.<ref>{{Cite web|title= amber-smalltalk/amber|url= https://github.com/amber-smalltalk/amber|website= GitHub|access-date= 2016-01-30}}</ref> This makes setting Amber Smalltalk easier for people with little JavaScript experience.<ref>{{Cite web|title= Installing Amber|url= http://docs.amber-lang.net/installing-amber.html|website= docs.amber-lang.net|access-date= 2016-01-30|first= Nicolas|last= Petton}}</ref><br />
<br />
== Installing ==<br />
To install Amber, [[Git (software)|Git]] must be installed first, if it is not already. The following commands will install Amber:<ref name=":1">{{Cite web|title= A Gentle Introduction to Amber: Engaging in Smalltalk with Her, Reads Like English, and It’s Still Succinct!, "It’s alive! It’s alive!", The All-seeing Helios, Testing D3|url= https://medium.com/smalltalk-talk/a-gentle-introduction-to-amber-8c532631e9ab#.dcps4c7i2|website= Medium|date= 2015-06-09|access-date= 2016-02-07|first= Richard|last= Eng}}</ref> <syntaxhighlight lang="bash"><br />
# for macOS and Linux, needs the following two commands: <br />
npm config set prefix=~/npm<br />
export PATH="$PATH:$HOME/npm/bin" # add to .bash_profile or .bashrc<br />
<br />
npm install -g amber-cli grunt-cli grunt-init<br />
</syntaxhighlight>To create a new project, write:<syntaxhighlight lang="bash"><br />
# Create the project structure<br />
mkdir example-project<br />
cd example-project<br />
<br />
# Create and initialize a new Amber project<br />
amber init<br />
</syntaxhighlight>"amber init" step will lead to some questions about the project. For most of them, a default answer can be set. The next step is to start the server:<br />
<pre><br />
amber serve<br />
</pre><br />
After that, typing <code>http://localhost:4000</code> in the browser will get to the application. Most browsers will block Helios pop-ups by default, so browser settings may need changing to allow the Helios application popup to appear.<br />
<br />
== Integrating external JavaScript libraries ==<br />
Bower software can be used to access a vast array of JavaScript libraries. A library can be integrated by following only four steps:<ref name=":1" /><br />
# Install the library using Bower.<br />
# If 'local.amd.json' files doesn't exist for the Bower package, create a 'libname.amd.json' file in the project root.<br />
# Run 'grunt devel' (or 'grunt deploy' if ready to deploy an application).<br />
# Add 'libname' to the application package's #imports: .<br />
<br />
==See also==<br />
{{Portal|Free software}}<br />
* [[Pharo]]<br />
* [[Seaside (software)]]<br />
* [[Squeak]]<br />
<br />
==References==<br />
{{Reflist}}<br />
<br />
==External links==<br />
* {{Official website|amber-lang.net}}<br />
* [http://nicolas-petton.fr/presentations/esug2011/ Jtalk, the Smalltalk for Web developers] Nicolas Petton, slides presented at ESUG 2011 (European Smalltalk User Group Conference). Edinburgh, Scotland, UK. (August, 2011)<br />
* [https://www.youtube.com/watch?v=07q67r0uBOY Helios tutorial]<br />
<br />
[[Category:Smalltalk programming language family]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Mercenary_(disambiguation)&diff=753354703Mercenary (disambiguation)2016-12-06T18:07:01Z<p>PuercoPop: /* Film */ film is no longer upcoming, it has been released</p>
<hr />
<div>{{wiktionary|mercenary}}<br />
A '''[[mercenary]]''' is a person primarily concerned with making money at the expense of ethics, most often used to refer to a soldier who fights for hire.<br />
<br />
'''Mercenary''' or '''mercenaries''' may also refer to:<br />
{{TOC right}}<br />
<br />
==Music==<br />
* [[Mercenary (band)]], a heavy metal band from Denmark<br />
* [[Mercenary (album)|''Mercenary'' (album)]], an album by the band Bolt Thrower<br />
* "Mercenary", a song by Brave Saint Saturn from the 2008 album [[Anti-Meridian (album)|''Anti-Meridian'']]<br />
* "The Mercenary", a song by Iron Maiden from the 2000 album, [[Brave New World (Iron Maiden album)|''Brave New World'']]<br />
* "Mercenary", a song by The Go-Go's from the 1984 album, [[Talk Show (The Go-Go's album)|''Talk Show'']]<br />
* "Mercenaries (Ready For War)", a song by John Cale from the 1979 album, ''[[Sabotage/Live]]''<br />
* "Mercenary", a song by Panic! at the Disco from the 2012 album ''[[Music of Batman: Arkham City#Batman: Arkham City – The Album|Batman: Arkham City – The Album]]''<br />
<br />
==Games==<br />
<br />
===Computer===<br />
* [[Mercenary (video game)|''Mercenary'' (video game)]], a computer game released by Novagen Software Ltd. in 1985<br />
** [[Mercenary (video game)#Mercenary III|''Mercenary III: The Dion Crisis'']], a 1992 sequel to the 1985 Novagen game<br />
* ''[[Mercenaries: Playground of Destruction]]'', an Xbox and PlayStation 2 video game released in 2005<br />
**[[Mercenaries (series)]]<br />
** ''[[Mercenaries 2: World in Flames]]'', the sequel to ''Mercenaries: Playground of Destruction'' in 2008<br />
** ''[[Mercs Inc]]'', the sequel to ''Mercenaries 2: World in Flames''<br />
* ''[[MechWarrior 2: 31st Century Combat#MechWarrior 2: Mercenaries|MechWarrior 2: Mercenaries]]'', a computer game released by Activision in 1996<br />
** ''[[MechWarrior 4: Mercenaries]]'', a computer game released by Cyberlore Studios and FASA Studio in 2002<br />
<!-- Above in order of similarity to original title as per Wikipedia:Manual_of_Style_(disambiguation_pages)#Order_of_entries --><br />
<br />
===Role-playing===<br />
* ''Traveller Book 4: Mercenary'', the fourth rulebook of the ''[[Traveller (role-playing game)]]''<br />
<br />
==Film==<br />
* [[Mercenaries (2011 film)|''Mercenaries'' (2011 film)]], a 2011 British film<br />
* [[Mercenaries (2014 film)|''Mercenaries'' (2014 film)]], an American action film<br />
* [[Mercenary (2008 film)|''Mercenary'' (2008 film)]], a 2008 short film starring [[Billy Lush]]<br />
* ''The Mercenaries'', also known as ''[[Dark of the Sun]]'', a 1968 film starring Rod Taylor<br />
* [[The Mercenary (film)|''The Mercenary'' (film)]], a 1968 spaghetti western film<br />
* [[Mercenary (1996 film)]] a 1996 film with John Ritter and Martin Kove<br />
* [[Mercenary (2016 film)|''Mercenary'' (2016 film)]], a 2016 French film<br />
<br />
==Television==<br />
*[[List of Mission: Impossible episodes#Season 3 .281968.E2.80.931969.29|The Mercenaries (Mission: Impossible)]], a 1968 episode from Season 3 of ''Mission: Impossible''<br />
<br />
==Sport==<br />
* [[Marburg Mercenaries]], an American football team from Marburg, Germany<br />
<br />
==Literature==<br />
* ''[[El Mercenario]]'' (English: ''The Mercenary''), an oil-painted fantasy graphic novel by Vicente Segrelles, published from 1980 to 2003<br />
* ''The Mercenaries'', a 1998 novel by [[Ed Greenwood]]<br />
<br />
{{disambiguation}}</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Val%C3%A9rie_Donzelli&diff=746691776Valérie Donzelli2016-10-28T23:21:47Z<p>PuercoPop: /* Features */ wikify link to 7 ans entry</p>
<hr />
<div>{{Infobox person<br />
| name = Valérie Donzelli<br />
| image = Valérie Donzelli.jpg<br />
| caption = Valérie Donzelli in 2011 at the Cabourg Film Festival<br />
| birth_date = {{Birth date and age|1973|03|02|df=yes}}<br />
| birth_place = [[Épinal]], [[Vosges]], France<br />
| residence =<br />
| nationality = French<br />
| citizenship =<br />
| education =<br />
| alma_mater =<br />
| occupation = Film director, actress, screenwriter<br />
| years_active = 1998–present<br />
| spouse =<br />
| partner =<br />
| children = 2<br />
| awards =<br />
| website = <!-- {{URL|Example.com}}--><br />
}}<br />
<br />
'''Valérie Donzelli''' (born 2 March 1973) is a French [[actress]], [[filmmaker]] and [[screenwriter]]. She has directed five feature films and two short films since 2008, including the film [[Declaration of War (film)|''Declaration of War'']] (2011).<br />
<br />
== Early life ==<br />
<br />
Valérie Donzelli was born in Épinal ([[France]]). She grew up in [[Créteil]], near [[Paris]]. She moved to [[Lille]] with her family when she was 14 years old before going back to Paris at the age of 19. Before starting to work in the cinema, Donzelli first studied architecture, but abandoned it quickly. She started playing theatre at the municipal conservatory of the [[10th arrondissement of Paris|10th arrondissement]] of Paris, but always kept a bad memory of this period. For a living, she worked at a bakery in Paris. She met [[Jérémie Elkaïm]] at that time, who becomes her partner, both in life and at work, and who encouraged her to quit the conservatory and her job at the bakery to become an actress. They now have two kids; the oldest one, Gabriel, inspired the movie [[Declaration of War (film)|''Declaration of War'']]. They are now separated, but still have a close relationship.<ref>http://www.lesinrocks.com/2011/09/03/cinema/valerie-donzelli-et-jeremie-elkaim-a-lassaut-de-la-vie-1110303/</ref><ref>http://www.telerama.fr/cinema/valerie-donzelli-et-jeremy-elkaim-l-epreuve-par-deux,72433.php</ref><br />
<br />
== Career ==<br />
<br />
In 2001, Valérie Donzelli was the leading actress in ''Martha Martha'', by [[Sandrine Veysset]], which was presented at [[Directors' Fortnight]]'', ''Le Plus Beau Jour de ma vie'', and also ''[[Entre ses mains]]''. She achieved great success among French public thanks to the French TV show ''[[Clara Sheller]]'' (2005), in which she plays Jeanne, best friend of the main character. <br />
Donzelli's first film, [[:imdbtitle:1483778|''The Queen of Hearts'']] ([[:fr:La Reine des pommes (film)|''La Reine des Pommes'']], 2009), in which she was the leading actress, was more successful than expected. Jérémie Elkaïm is also co-writer. The film was presented at [[Locarno International Film Festival]]. Despite of its low budget, the film can be considered as a success because of its 30 000 spectators.<ref>http://lemondedecess.over-blog.com/article-valerie-donzelli-reine-du-burlesque-54554103.html</ref><ref>http://www.lemonde.fr/culture/article/2013/08/22/valerie-donzelli-championne-de-triathlon_3465023_3246.html</ref> <br />
<br />
In 2011, with the help of her now ex-partner Jérémie Elkaïm, Valérie Donzelli directed her second full-length feature film, [[Declaration of War (film)|''Declaration of War'']]. This movie, presented during the [[2011 Cannes Film Festival|2011 Cannes Festival]], achieves great success, public and critic, in France. It is directly inspired by their private life, relating how their couple fought against their son's cancer when he was 18 months.<ref>http://www.telerama.fr/cinema/valerie-donzelli-et-jeremie-elkaim-du-cote-de-la-vie,68772.php?xtatc=INT-41</ref> The movie was selected at the [[Academy Award for Best Foreign Language Film]] in 2012, but was not part of the finalist.<br />
<br />
Donzelli directed once again [[Jérémie Elkaïm]] in ''Main dans la main'' (2012), with also [[Valérie Lemercier]] in the leading role.<br />
<br />
Donzelli considers that this is always a politic and engaged gesture to make films as women, and admires Agnès Varda for her work and her status of first women filmmaker into French Cinema.<ref>http://www.lesinrocks.com/2011/09/03/cinema/valerie-donzelli-et-jeremie-elkaim-a-lassaut-de-la-vie-1110303/</ref><br />
<br />
Valérie Donzelli is part of the jury during [[Locarno International Film Festival]] in 2013. She presents ''Que d'Amour!'', a TV adaptation from the play ''[[The Game of Love and Chance]]'' (''Le Jeu de l'Amour et du Hasard''), by ''[[Marivaux]]'', with [[Comédie-Française]]' [[Sociétaires of the Comédie-Française|sociétaires]].<ref>http://www.lemonde.fr/culture/article/2013/08/22/valerie-donzelli-championne-de-triathlon_3465023_3246.html</ref><br />
<br />
Her 2015 film ''[[Marguerite & Julien]]'' was selected to compete for the [[Palme d'Or]] at the [[2015 Cannes Film Festival]].<ref name="Cannes">{{cite web |url=http://www.festival-cannes.com/en/article/61306.html |title=2015 Official Selection |accessdate=16 April 2015 |work=Cannes}}</ref> She was named as the President of the Jury of the International Critics' Week section of the [[2016 Cannes Film Festival]].<ref name="SemaineJury">{{cite web |url=http://www.semainedelacritique.com/EN/jury.php |title=Jury 2016 |accessdate=22 March 2015 |work=Semaine de la Critique de Cannes}}</ref><br />
<br />
== Filmography ==<br />
<br />
=== Actress ===<br />
<br />
==== Features ====<br />
<br />
* 2001: ''Martha Martha'' by [[Sandrine Veysset]]: Martha <br />
* 2001: ''Les Âmes câlines'' by Thomas Bardinet: Émilie <br />
* 2003: ''[[Cette femme-là]]'' by Guillaume Nicloux: Claire Atken <br />
* 2003: ''[[Who Killed Bambi? (2003 film)|Who Killed Bambi?]]'' by Gilles Marchand: Nathalie <br />
* 2005: ''Mystification ou l'histoire des portraits'' by Sandrine Rinaldi: Emilie <br />
* 2005: ''Le Plus Beau Jour de ma vie'' by Julie Lipinski: Éléonore <br />
* 2005: ''[[Entre ses mains]]'' by [[Anne Fontaine]]: Valérie <br />
* 2005: ''Voici venu le temps'' by [[Alain Guiraudie]]: Soniéra Noubi-Datch <br />
* 2006: ''L'Intouchable'' by Benoît Jacquot: theatre actress <br />
* 2006: ''L'Homme qui rêvait d'un enfant'' by Delphine Gleize: Suzanne <br />
* 2007: ''Il fait beau dans la plus belle ville du monde'' by Valérie Donzelli <br />
* 2007: [[7 Years (film)|7 ans]] by Jean-Pascal Hattu : Maïté <br />
* 2009: ''The Queen of Hearts'' by Valérie Donzelli: Adèle <br />
* 2011: [[Declaration of War (film)|''Declaration of War'']] by Valérie Donzelli: Juliette <br />
* 2011: ''Belleville Tokyo'' by Élise Girard: Marie Tourelle <br />
* 2011: ''[[Iris in Bloom]]'' by Valérie Mréjen and Bertrand Schefer <br />
* 2011: ''Pourquoi tu pleures?'' by Katia Lewkowicz: Anna <br />
* 2011: ''L'Art de séduire'' by Guy Mazarguil: Estelle <br />
* 2013: ''[[The Big Bad Wolf (2013 Film)|The Big Bad Wolf]]'' by [[Nicolas Charlet]] and [[Bruno Lavaine]] <br />
* 2013: ''[[Longwave (film)|Les Grandes Ondes (à l'ouest)]]'' by Lionel Baier : Julie <br />
* 2013: ''Opium'' by [[Arielle Dombasle]] : Valentine Hugo <br />
* 2014: ''Orage'' by Fabrice Camoin<br />
* 2014: ''[[Saint Laurent (film)|Saint Laurent]]'' by [[Bertrand Bonello]] : Renée<br />
* 2015: ''[[The White Knights]]'' by [[Joachim Lafosse]] : Françoise Dubois<br />
<br />
==== Short films ====<br />
<br />
* 1998: ''Herbert C. Berliner'' by Marc Gibaja<br />
* 1999: ''Le Spectateur'' by Marc Gibaja : Cynthia<br />
* 2000: ''Demoiselle'' by Valérie Donzelli : Adèle<br />
* 2001: ''Confessions dans un bain'' by Marc Gibaja : Sophie<br />
* 2001: ''Le Chien, le chat et le cibachrome'' by Didier Blasco<br />
* 2003: ''Ni vue, ni connue'' by Dorothée Sebbagh : Alice<br />
* 2003: ''Le Lion volatil'' by [[Agnès Varda]] : La cliente en pleurs<br />
* 2004: ''Frédérique amoureuse'' by Pierre Lacan : Frédérique<br />
* 2004: ''Le Nécrophile'' by Philippe Barassat : La prostituée<br />
* 2005: ''On est mort un million de fois'' by Dorothée Sebbagh : Valentine<br />
* 2006: ''Odile...'' by Bénédicte Delgéhier : Odile<br />
* 2007: ''Abattoir'' by Didier Blasco : Judith<br />
* 2007: ''Il fait beau dans la plus belle ville du monde'' by Valérie Donzelli : Adèle<br />
* 2008: ''C'est pour quand?'' by Katia Lewkowicz : La jeune fille<br />
* 2009: ''Juliette'' by Sylvie Ballyot : Juliette<br />
* 2010: ''Madeleine et le facteur'' by Valérie Donzelli : Madeleine<br />
* 2010: ''Manu'' by [[Jérémie Elkaïm]] : Julie<br />
* 2012: ''Révolution'' by Nadia Jandeau<br />
<br />
==== Television ====<br />
<br />
* 1999: ''Dossier: disparus'' épisode ''Amanda'' by Frédéric Demont et [[Philippe Lefebvre (film director)|Philippe Lefebvre]]: Amanda/Muriel<br />
* 1999: ''Les Terres froides'' by [[Sébastien Lifshitz]]: Isabelle<br />
* 2002: ''Sous mes yeux'' by Virginie Wagon: Alison<br />
* 2003: ''Motus'' by [[Laurence Ferreira Barbosa]]: La stagiaire d'Antoine<br />
* 2005: ''Le Cocon, débuts à l'hôpital'' by Pascale Dallet: Nathalie<br />
* 2005: ''Clara Sheller'' by Renaud Bertrand: Jeanne<br />
* 2006: ''Mentir un peu'' by Agnès Obadia: Blandine<br />
* 2006: ''Passés troubles'' by Serge Meynard: Sophie Valatier<br />
* 2007: ''Les Camarades'' by François Luciani (minisérie): Julie<br />
* 2008: ''Sa raison d'être'' by Renaud Bertrand: Nathalie<br />
* 2008: [[Mafiosa (TV series)|''Mafiosa, le clan'']] Saison 2 d'[[Éric Rochant|Eric Rochant]]: L'avocate<br />
* 2009: ''La Belle vie'' by Virginie Wagon: Béa<br />
<br />
=== Screenwriter ===<br />
* 2000: ''Demoiselle''<br />
* 2007: ''Il fait beau dans la plus belle ville du monde''<br />
* 2009: ''The Queen of Hearts''<br />
* 2010: ''Madeleine et le facteur''<br />
* 2011: [[Declaration of War (film)|''Declaration of War'']]<br />
* 2012: ''La Vie parisienne'' de Vincent Dietschy (originale idea)<br />
* 2012: ''Main dans la main''<br />
<br />
=== Film director ===<br />
<br />
==== Short films ====<br />
<br />
* 2007: ''Il fait beau dans la plus belle ville du monde''<br />
* 2010: ''Madeleine et le facteur''<br />
<br />
==== Features ====<br />
<br />
* 2009: ''The Queen of Hearts''<br />
* 2010: [[Declaration of War (film)|''Declaration of War'']]<br />
* 2012: ''Main dans la main''<br />
* 2013: ''Que d'amour''<br />
* 2015: ''[[Marguerite & Julien]]''<br />
<br />
==== Television ====<br />
<br />
* 2013: ''Que d'amour!'' Adaptation from ''[[The Game of Love and Chance]]'', by ''[[Marivaux]]''<ref>http://www.lemonde.fr/culture/article/2013/08/22/valerie-donzelli-championne-de-triathlon_3465023_3246.html</ref><br />
<br />
== Awards and nominations ==<br />
* 2010: Public Prize at the [[Angers European First Film Festival]] for ''The Queen of Hearts''<br />
* 2011: Valois d’Or at Festival du film francophone d’Angoulême for '[[Declaration of War (film)|'Declaration of War'']]<br />
* 2012: Grand Prix at Cabourg Film Festival for [[Declaration of War (film)|''Declaration of War'']]<br />
* 2012: Jury Prize, Public Prize, and Bloggers Prix at the Festival Paris Cinéma for '[[Declaration of War (film)|'Declaration of War'']] <ref>http://www.lexpress.fr/actualites/1/culture/la-guerre-est-declaree-de-valerie-donzelli-triomphe-au-festival-de-paris_1011690.html</ref><br />
* 2012: [http://www.etoilesdorducinema.fr/palm-treize.html Étoile d'or du meilleur scénario] for [[Declaration of War (film)|''Declaration of War'']] <br />
* Nomination for [[César Award for Best Film|Best film]] for [[Declaration of War (film)|''Declaration of War'']], [[37th César Awards|Cesar Awards 2012]] <br />
* Nomination for [[César Award for Best Director|Best Director]] for [[Declaration of War (film)|''Declaration of War'']], [[37th César Awards|Cesar Awards 2012]] <br />
* Nomination for [[César Award for Best Actress|Best Actress]] for [[Declaration of War (film)|''Declaration of War'']], [[37th César Awards|Cesar Awards 2012]] <br />
* Nomination for [[César Award for Best Writing|Best Original Writing]] for [[Declaration of War (film)|''Declaration of War'']], [[37th César Awards|Cesar Awards 2012]]<br />
<br />
== References ==<br />
{{reflist}}<br />
<br />
== Further reading ==<br />
* [http://www.toutelatele.com/valerie-donzelli-se-tourne-vers-la-television-pour-son-prochain-film-49236 Valerie Donzelli se tourne vers la télévision pour son prochain film]<br />
* "Un film dansé pour Valérie Donzelli", ''Cahiers du cinéma'', no 670, septembre 2011, p.&nbsp;62<br />
* La Guerre est déclarée [archive], sur [http://www.jpbox-office.com/fichfilm.php?id=12348 jpbox-office.com] (consulted March 16, 2014)<br />
<br />
== External links ==<br />
{{commons category}}<br />
* {{IMDb name|0233123}}<br />
* Valérie Donzelli via [http://www.allocine.fr/personne/fichepersonne_gen_cpersonne=62868.html Allociné]<br />
<br />
{{Valérie Donzelli}}<br />
<br />
{{Authority control}}<br />
{{DEFAULTSORT:Donzelli, Valerie}}<br />
[[Category:1973 births]]<br />
[[Category:20th-century French actresses]]<br />
[[Category:21st-century French actresses]]<br />
[[Category:French film actresses]]<br />
[[Category:French film directors]]<br />
[[Category:French screenwriters]]<br />
[[Category:French television actresses]]<br />
[[Category:French women film directors]]<br />
[[Category:French women writers]]<br />
[[Category:Living people]]<br />
[[Category:French people of Italian descent]]<br />
[[Category:People from Épinal]]<br />
[[Category:French women screenwriters]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=7_Years_(film)&diff=7466915107 Years (film)2016-10-28T23:19:23Z<p>PuercoPop: /* Cast */ wiklfy link to Valérie Donzelli's entry</p>
<hr />
<div>{{Infobox film<br />
| name = 7 Years<br />
| image = 7 Years Poster.jpg<br />
| caption = Theatrical Release Poster<br />
| director = Jean-Pascal Hattu<br />
| producer = Justin Taurand<br />
| writer = Jean-Pascal Hattu<br />
| screenplay = Jean-Pascal Hattu<br>Gilles Taurand<br>Guillaume Daporta <br />
| starring = [[Valérie Donzelli]]<br>Cyril Troley<br>[[Bruno Todeschini]]<br />
| music = Franck Delabre<br />
| cinematography = Pascal Poucet<br />
| editing = Anne Klotz<br />
| studio = [[Les Films du Bélier]]<br />
| distributor = Pyramide Distribution<br />
| released = {{Film date|2006|09|03|Venice Film Festival|2007|02|21|France}}<br />
| runtime = 86 minutes<br />
| country = France<br />
| language = French<br />
}}<br />
'''''7 Years''''' ({{lang-fr|7 ans}}) is a 2006 French drama film starring [[Bruno Todeschini]], [[Valerie Donzelli]] and [[Cyril Troley]]. It is written and directed by [[Jean-Pascal Hattu]]. The film explores the sexual tension between a wife and a husband serving a long jail sentence. Valerie Donzelli's performance in the film won her awards at the [[Seattle International Film Festival]]<ref>Seattle International Film Festival [http://www.siff.net/press/detail.aspx?NID=123&year=2007 2007 Winners List] Retrieved on 2011-02-25.</ref> and at the [[Valencia Festival of Mediterranean Cinema]][http://www.mostravalencia.com/inicio.html]{{es icon}}.<ref>Awards for 2007 [http://www.imdb.com/event/ev0000674/2007 ''[[IMDB]]'' ]Retrieved on 2011-02-25.</ref><br />
<br />
==Plot==<br />
Maïté (Valerie Donzelli) is the devoted young wife of Vincent (Bruno Todeschini), who is serving 7 years in prison for an unspecified crime. She brings Vincent clean clothes, and puts money in his canteen account. She and Vincent obviously still need each other sexually, and it is difficult for both of them to be separated.<br />
<br />
One day Maïté is approached by a young man named Jean (Cyril Troley), who says his brother is also incarcerated for 7 years. They quickly embark on a sexual relationship, but Maïté is cold and unresponsive.<br />
<br />
She has a good relationship with her neighbour, Djamila, who has a small son, Julien. Maïté looks after him frequently whilst Djamila is at work, and the two are close. Eventually Maïté discovers that Jean is in fact a guard at her husband's prison. The affair takes a turn when Vincent finds out; instead of stopping them, he insists Jean tape their meetings. He advises Jean how to move Maïté emotionally and sexually, however, Jean tells him "she is empty".<br />
<br />
As Jean falls in love with Maïté, she tries to distance herself from both of them. However, as Jean leaves to take up a post in Lille, Vincent attempts suicide and in final scene she is seen walking confidently into the prison to visit him once again.<br />
<br />
==Cast==<br />
* [[Valérie Donzelli|Valérie Donzelli]] as Maïté<br />
* Cyril Troley as Jean<br />
* [[Bruno Todeschini]] as Vincent<br />
* Pablo de la Torre as Julien<br />
* Nadia Kaci as Djamila<br />
<br />
==Awards==<br />
* New Director's Showcase Special Jury Prize - Seattle International Film Festival 2007 - Won<br />
* Best Actress - Valencia Festival of Mediterranean Cinema 2007 - Won<br />
<br />
== References ==<br />
{{Reflist}}<br />
<br />
== External links ==<br />
* {{IMDb title|0808462|7 Years}}<br />
<br />
[[Category:French films]]<br />
[[Category:2006 films]]<br />
<br />
<br />
{{2000s-France-film-stub}}</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=The_Blair_Witch_Project&diff=740473392The Blair Witch Project2016-09-21T08:20:41Z<p>PuercoPop: Undid revision 740472064 by 1.129.96.187 (talk)</p>
<hr />
<div>{{pp-move-indef}}<br />
{{Use mdy dates|date=July 2016}}<br />
{{Infobox film<br />
| name = The Blair Witch Project<br />
| image = Blair Witch Project.jpg<br />
| alt = <br />
| caption = Theatrical release poster<br />
| directors = {{Plainlist|<br />
* [[Daniel Myrick]]<br />
* [[Eduardo Sánchez (director)|Eduardo Sánchez]]<br />
}}<br />
| producers = {{Plainlist|<br />
* Robin Cowie<br />
* [[Gregg Hale (producer)|Gregg Hale]]<br />
}}<br />
| writer = {{Plainlist|<br />
* Jacob Cruse<br />
* Eduardo Sánchez<br />
}}<br />
| starring = {{Plainlist|<br />
* [[Heather Donahue]]<br />
* [[Michael C. Williams]]<br />
* [[Joshua Leonard]]<br />
}}<br />
| music = Antonio Cora<br />
| cinematography = [[Neal Fredericks]]<br />
| editing = {{Plainlist|<br />
* Daniel Myrick<br />
* Eduardo Sánchez<br />
}}<br />
| studio = [[Haxan Films]]<br />
| distributor = [[Artisan Entertainment]]<br />
| released = {{Film date|1999|01|25|[[Sundance Film Festival|Sundance]]|1999|07|14|United States}}<br />
| runtime = 81 minutes<!--Theatrical runtime: 80:57--><ref>{{cite web | url=http://www.bbfc.co.uk/releases/blair-witch-project-1999-1 | title=''The Blair Witch Project'' (15) | work=[[British Board of Film Classification]] | date=August 4, 1999 | accessdate=July 28, 2016}}</ref><br />
| country = United States<br />
| language = English<br />
| budget = $60,000<ref name="BOM" /><br />
| gross = $248.6 million<ref name="BOM">{{cite web|accessdate=April 4, 2013|url=http://boxofficemojo.com/movies/?id=blairwitchproject.htm|title=The Blair Witch Project|publisher=Box Office Mojo}}</ref><br />
}}<br />
'''''The Blair Witch Project''''' is a 1999 American [[Found footage (pseudo-documentary)|found footage]] [[psychological horror]] [[film]] written, directed and edited by [[Daniel Myrick]] and [[Eduardo Sánchez (director)|Eduardo Sánchez]]. The film tells the fictional story of three student filmmakers ([[Heather Donahue]], [[Michael C. Williams]] and [[Joshua Leonard]]) who hike in the Black Hills near [[Burkittsville, Maryland]] in 1994 to film a documentary about a local legend known as the Blair Witch. The three disappeared, but their video and sound equipment (along with most of the footage they shot) was discovered a year later; this "[[Found footage (pseudo-documentary)|recovered footage]]" is the film the viewer is watching.<ref>{{cite web|url=http://www.dreadcentral.com/news/34337/editorial-paranormal-activity-shadows-the-blair-witch|title=Editorial: Paranormal Activity Shadows The Blair Witch|publisher=DreadCentral}}</ref><br />
<br />
While the film received unexpected acclaim from critics, audience reception was polarized.<ref name=Reception>{{cite web|accessdate=August 25, 2016|url=http://www.technobuffalo.com/2016/07/23/blair-witch-2016-official/|title=The Blair Witch Project is getting a proper sequel|publisher=TechnoBuffalo}}</ref> It became a resounding box office success&ndash;grossing over [[United States dollar|US$]]248 million worldwide,<ref>{{cite web | last = | first = | title = The Blair Witch Project | work = Box Office Mojo.com | date = 2006-01-01| url = http://boxofficemojo.com/movies/?id=blairwitchproject.htm| accessdate = 2006-07-28 }}</ref> making it one of the most successful [[independent film]]s of all time. The DVD was released on October 26, 1999 and, in 2010, a [[Blu-ray Disc|Blu-ray]] edition was released.<br />
<br />
A [[sequel]] was released on October 27, 2000 titled ''[[Book of Shadows: Blair Witch 2]]''. Another sequel was planned for the following year, but did not materialize. On September 2, 2009, it was announced that Sánchez and Myrick were pitching the third film.<ref>{{cite news| url=http://news.bbc.co.uk/1/hi/entertainment/8187275.stm | work=BBC News | title=The legend of the Witch lives on | date=2009-08-11 | accessdate=2010-05-25 | first=Kev | last=Geoghegan}}</ref> A [[Blair Witch (video games)|trilogy of video games]] based on the films was released in 2000. The [[Blair Witch|''Blair Witch'' franchise]] has since expanded to include various novels, dossiers, comic books and additional merchandise.<br />
<br />
On July 22, 2016, an official trailer for a sequel to the film, directed by [[Adam Wingard]] and entitled ''[[Blair Witch (film)|Blair Witch]]'', was released at [[San Diego Comic-Con International|San Diego Comic-Con]]. The film, produced by [[Lionsgate Films|Lionsgate]], was released on September 16, 2016.<ref name="latimes.com">{{cite web|last1=Woerner|first1=Meredith|title='Blair Witch' sequel surprises Comic-Con with a secret screening and trailer|url=http://www.latimes.com/entertainment/la-et-hc-comic-con-updates-blair-witch-sequel-surprises-1469247259-htmlstory.html|website=The Los Angeles Times|accessdate=23 July 2016}}</ref> ''Blair Witch'' is a direct sequel to ''The Blair Witch Project'', and does not acknowledge the events of ''Book of Shadows: Blair Witch 2''. However, Wingard has said that although ''Blair Witch'' does not reference any of the events that transpired in ''Book of Shadows: Blair Witch 2'', the film does not necessarily discredit the existence of ''Book of Shadows: Blair Witch 2''.<ref name="cinemablend.com">[http://www.cinemablend.com/news/1556209/]</ref><br />
<br />
==Fictional legend==<br />
The backstory for the movie is a legend fabricated by Sánchez and Myrick which is detailed in ''The Curse of the Blair Witch'', a [[mockumentary]] broadcast on the [[SciFi Channel]] in 1999 prior to the release of ''The Blair Witch Project''.<ref name=curseoftheblairwitch>{{cite web|title=Curse of the Blair witch|url=http://www.ew.com/article/1999/10/29/curse-blair-witch|publisher=Entertainment Weekly|accessdate=4 August 2016}}</ref> Sánchez and Myrick also maintain a website which adds further details to the legend.<ref name="Curse of the Blair Witch">{{cite web |url=http://www.blairwitch.com/mythology.html |title=The Blair Witch |accessdate=4 August 2016 |archiveurl=https://web.archive.org/web/20070707140445/http://www.blairwitch.com/mythology.html |archivedate=July 7, 2007 }}</ref><br />
<br />
The legend describes the murders and disappearances of some of the residents of Blair, Maryland (a fictitious town on the site of [[Burkittsville, Maryland]]) from the [[18th Century|18th]] to [[20th Century|20th centuries]]. Residents blamed these occurrences on the ghost of Elly Kedward, a Blair resident accused of practicing witchcraft in 1785 and sentenced to death by [[hypothermia|exposure]]. ''The Curse of the Blair Witch'' presents the legend as real, complete with manufactured newspaper articles, [[newsreels]], television news reports, and staged interviews.<br />
<ref name=curseoftheblairwitch /><br />
<br />
==Plot==<br />
In October 1994, film students [[Heather Donahue]], [[Michael C. Williams]], and [[Joshua Leonard]] set out to produce a documentary about the fabled Blair Witch. They travel to Burkittsville, Maryland, formerly Blair, and interview residents about the legend. Locals tell them of Rustin Parr, a [[hermit]] who lived in the woods, who kidnapped eight children in the 1940s. He would take the children down to his basement in pairs and make one of them stand in the corner while he killed the other one. After turning himself in to the police, Parr claimed that the spirit of Elly Kedward, a woman executed for witchcraft in the 18th century, had forced him to commit the murders. The students then interview Mary Brown, a Burkittsville resident deemed insane by the public. She claims to have encountered the Blair Witch in person, describing her as a hairy half-human, half-animal beast.<br />
<br />
On their second day, the students explore the woods in north Burkittsville to research the legend. Along the way, they meet two fishermen, one of whom warns them that the woods are haunted and recalls that in 1888, a young girl named Robin Weaver went missing, and when she returned three days later, she talked about "an old woman whose feet never touched the ground." His companion is, however, skeptical of the story. The students then hike to Coffin Rock, where five men were found [[Human sacrifice#Ritual murder|ritualistically murdered]] in the 19th century, their bodies later disappearing. The group then camps for the night.<br />
<br />
The next day they move deeper into the woods despite being uncertain of their location. They eventually locate what appears to be an old cemetery with seven small [[cairn]]s. They set up camp nearby and then return to the cemetery after dark. Josh accidentally disturbs a cairn and Heather hastily repairs it. Later that night, they hear the sound of twigs snapping from all directions but assume the noises are from animals or locals.<br />
<br />
On day three, they attempt to hike back to the car, but are unable to find it before dark, much to their frustrations, and again set camp. That night, they again hear twigs snapping but fail to find the source of the noises.<br />
<br />
On the fourth day they find three cairns have been built around their tent during the night, which unnerves them. As they continue, Heather realizes her map is missing, and Mike later reveals he kicked it into a creek the previous day out of frustration, which prompts Heather and Josh to attack him in a rage. They realize they are now lost and decide simply to head south. They eventually reach a section where they discover a multitude of humanoid stick figures suspended from trees, which further unnerves them. That night they hear sounds again, but this time includes the sounds of children laughing among other strange noises. When an unknown force shakes the tent, they flee in a panic and hide in the woods until dawn.<br />
<br />
Upon returning to their tent, they find that their possessions have been rifled through, and Josh's equipment is covered with a translucent slime. As they continue, they begin to show signs of mentally giving up, and it is made worse when they come across a log on a river identical to one they crossed earlier. They realize they have walked in a circle, despite having traveled south all day, and once again make camp, completely demoralized at having wasted an entire day. Josh suffers a mental breakdown while holding the camera, taunting Heather for their circumstances and her constant recording of the events.<br />
<br />
On the sixth morning, Heather and Mike awaken to find that Josh has disappeared. After trying in vain to find him, they slowly move on. That night, they hear Josh's agonized screams in the darkness but are unable to locate him.<br />
<br />
On their final day in the woods, Heather discovers a bundle of sticks and fabric outside her tent. As she searches through it she finds blood-soaked scraps of Josh's shirt as well as teeth, hair, and an unknown pink object. Although distraught by the discovery, she chooses not to tell Mike. That night, Heather records herself apologizing to her family, as well as to the families of Mike and Josh, taking full responsibility for their current predicament and stating her belief that something terrible is hunting them, and will ultimately take them.<br />
<br />
Afterward, they again hear Josh's agonized cries for help and follow them to a derelict, abandoned house containing runic symbols and children's bloody hand-prints on the walls. Mike races upstairs in an attempt to find Josh while Heather follows. Both are still filming all their actions. Mike then says he hears Josh in the basement. He runs downstairs while a hysterical Heather struggles to keep up. Upon reaching the basement, something attacks Mike, and causes him to drop the camera and go silent. Heather enters the basement screaming. Her camera captures Mike facing a corner. Something then attacks Heather, causing her to drop her camera and go silent as well. The footage then ends.<br />
<br />
==Cast==<br />
*[[Heather Donahue]] as a fictionalized version of herself.<br />
*[[Michael C. Williams]] as a fictionalized version of himself.<br />
*[[Joshua Leonard]] as a fictionalized version of himself.<br />
<br />
==Production==<br />
<br />
===Development===<br />
''The Blair Witch Project'' was developed during 1993<ref name = "onion"/> by the filmmakers. Myrick and Sanchez came across the idea for the film after realizing that they found [[documentaries]] on paranormal phenomena scarier than traditional horror films. The two decided to create a film that combined the styles of both.<ref name="Stilllegend">{{cite web|last1=Bowies|first1=Scott|title='Blair Witch Project': Still a legend 15 years later|url=http://www.usatoday.com/story/life/movies/2014/07/13/blair-witch-project-15th-anniversary-classic-legend/10707409/|website=USA Today|accessdate=22 February 2016}}</ref> The script began with a 35-page outline, with the dialogue to be improvised.<ref name = "onion"/> Accordingly, the directors advertised in ''[[Backstage (magazine)|Backstage]]'' magazine for actors with strong improvisational abilities.<ref name = "real"/> There was a very informal improvisational audition process to narrow the pool of 2,000 actors.<ref name="witch"/><ref name = "salon"/> In developing the mythology behind the movie, the filmmakers used many inspirations. Several character names are near-anagrams; Elly Kedward (The Blair Witch) is [[Edward Kelley]], a 16th-century mystic. Rustin Parr, the fictional 1940s child-murderer, began as an anagram for [[Rasputin]].<ref>{{cite web | last =Blake | first = Scott | title = An Interview With The Burkittsville 7's Ben Rock | work = IGN.com | date = Jul 17, 2007| url = http://filmforce.ign.com/articles/036/036443p1.html/| accessdate = July 30, 2007 }}</ref> In talks with investors, they presented an eight-minute documentary along with newspapers and news footage.<ref name="stone">{{cite web | last = Conroy | first =Tom| title =The Do-It-Yourself Witch Hunt | work = Rolling Stone| date =July 14, 1999| url = http://www.rollingstone.com/news/story/5924486/the_doityourself_witch_hunt| accessdate = August 2, 2006 | archiveurl = https://web.archive.org/web/20071001001407/http://www.rollingstone.com/news/story/5924486/the_doityourself_witch_hunt | archivedate = October 1, 2007 }}</ref> This documentary, originally called ''The Blair Witch Project: The Story of Black Hills Disappearances'' was produced by Haxan Films.<br />
[[File:Burkitcem.jpg|thumb|The cemetery as part of the Blair Witch story]]<br />
Filming began in October 1997 and lasted eight days.<ref name = "real"/><ref>{{cite news | last =Corliss | first = Richard | title = Blair Witch Craft | work = Time Magazine | date = August 16, 1999| url = http://www.time.com/time/archive/preview/0,10987,991741,00.html| accessdate = 2006-07-30 }}</ref> Most of the movie was filmed in [[Seneca Creek State Park]] in [[Montgomery County, Maryland]], although a few scenes were filmed in the real town of [[Burkittsville]].<ref name="blairwitch">{{cite web|last=Kaufman |first=Anthony |title=Season of the Witch |work=Village Voice |date=July 14, 1999 |url=http://www.villagevoice.com/news/9928,kaufman,7024,1.html |accessdate=September 26, 2006 |deadurl=yes |archiveurl=https://web.archive.org/web/20070303170002/http://www.villagevoice.com/news/9928,kaufman,7024,1.html |archivedate=March 3, 2007 }}</ref> Some of the townspeople interviewed in the film were not actors, and some were planted actors, unknown to the main cast. The final scenes were filmed at the historic [[Griggs House]] in [[Granite, Maryland]]. Donahue had never operated a camera before and spent two days in a "crash course." Donahue said she modeled her character after a director she once worked with, citing the character's self assuredness when everything went as planned, and confusion during crisis.<ref>{{cite web|last=Lim |first=Dennis |title=Heather Donahue Casts A Spell |work=The Village Voice |date=July 14, 1999 |url=http://www.villagevoice.com/news/9928,lim,7025,1.html |accessdate=September 26, 2007 |deadurl=yes |archiveurl=https://web.archive.org/web/20071204214220/http://www.villagevoice.com/news/9928,lim,7025,1.html |archivedate=December 4, 2007 }}</ref><br />
<br />
===Casting===<br />
According to Heather Donahue, auditions for the film were held at Musical Theater Works in [[New York City]], and ads were placed in the weekly ''Backstage'' for an open audition.<ref name="craig">Donahue, Heater. Interview with Craig Kilborn. CBS Networks. August 1999.</ref> The advertisement noted an "entirely improvised feature film" shot in a "wooded location."<ref name="craig"/> Donahue described the audition as Myrick and Sanchez posing her the question: "You've served seven years of a nine year sentence. Why should we let you out on parole?" to which Donahue was required to [[improvise]] a response.<ref name="craig"/><br />
<br />
Joshua Leonard, also in response to audition calls through ''Back Stage'', claimed he was cast in the film due to his knowledge of how to run a camera, as there was not an omniscient camera filming the scenes.<ref>{{cite web|url=http://www.backstage.com/news/spotlight/how-joshua-leonard-fell-love-moviemaking/|work=Backstage|title=How Joshua Leonard Fell In Love With Moviemaking|author=Loewenstein, Melinda|date=March 16, 2013|accessdate=October 31, 2015}}</ref><br />
<br />
===Filming===<br />
During filming, the actors were given clues as to their next location through messages given in milk crates found with [[Global Positioning Satellite]] systems. They were given individual instructions that they would use to help improvise the action of the day.<ref name="real">{{cite web| author=Staff| title = Heather Donohue &ndash; Blair Witch Project| work = KAOS 2000 Magazine|date = January 1, 1999| url = http://www.kaos2000.net/interviews/heatherdonohue/heatherdonohue.html| accessdate = July 30, 2006 }}</ref> Teeth were obtained from a Maryland dentist for use as human remains in the movie.<ref name = "real"/> Influenced by producer Gregg Hale's memories of his military training, in which "enemy soldiers" would hunt a trainee through wild terrain for three days, the directors moved the characters a long way during the day, harassing them by night and depriving them of food.<ref name = "stone"/><br />
<br />
Almost 19 hours of usable footage was recorded which had to be edited down to 90 minutes.<ref name="salon">{{cite web | last =Mannes | first = Brett | title = Something wicked | work = Salon.com | date = July 13, 1999| url = http://www.salon.com/ent/movies/int/1999/07/13/witch_actor/| accessdate = July 29, 2006 }}</ref> The editing in post production took more than eight months. Originally it was hoped that the movie would make it on to cable television, and the filmmakers did not anticipate wide release.<ref name = "onion"/> The initial investment by the three filmmakers was about US$35,000. Artisan acquired the film for US$1.1 million but spent US$25 million to market it.{{citation needed|date=March 2016}} The actors signed a "small" agreement to receive some of the profits from the film's release.<ref name="real"/><br />
<br />
A list of production budget figures have circulated over the years, appearing as low as $20,000. In an interview with ''[[Entertainment Weekly]]'', Sánchez revealed that when principal photography first wrapped, approximately $20,000 to $25,000 had been spent.<ref>{{cite web|url=http://popwatch.ew.com/2009/07/09/blair-witch|title='The Blair Witch Project' 10 years later: Catching up with the directors of the horror sensation|author=John Young|publisher=Entertainment Weekly}}</ref> Other figures list a final budget ranging between $500,000 and $750,000.<ref name="Q&A">{{cite web|author=John Young|url=http://popwatch.ew.com/2009/07/09/blair-witch/|title='The Blair Witch Project' 10 years later: Catching up with the directors of the horror sensation|work=Entertainment Weekly|date=July 9, 2009|accessdate=July 10, 2009}}</ref><br />
<br />
==Promotion==<br />
<br />
''The Blair Witch Project'' is thought to be the first widely released movie marketed primarily by internet. The movie's official website featured fake police reports and "newsreel-style" interviews. These augmented the movie's found footage device to spark debates across the internet over whether the movie was a real-life documentary or a work of fiction.<ref>{{cite web | last = Weinraub | first = Bernard| title = Blair Witch Proclaimed First Internet Movie | work = Chicago Tribune| date = August 17, 1999| url = http://articles.chicagotribune.com/1999-08-17/features/9908170065_1_mark-curcio-amir-malin-artisan-entertainment| accessdate =January 27, 2012 }}</ref><ref>{{cite web | last = Weinraub | first = Bernard| title = Was The Blair Witch Project The Last Great Horror Film? | work = BBC News| date = October 30, 2015| url = http://www.bbc.com/culture/story/20151030-was-the-blair-witch-project-the-last-great-horror-film| accessdate =October 31, 2015 }}</ref> During screenings of the movie, the filmmakers made advertising efforts to promulgate the events in the film as factual, including the distribution of flyers at festivals such as the [[Sundance Film Festival]], asking viewers to come forward with any information about the "missing" students.<ref>{{cite web|url=http://www.imdb.com/title/tt0185937/trivia|title=IMDb: The Blair Witch Project}}</ref><ref>{{cite web|url=http://www.nextmovie.com/blog/best-movie-publicity-stunts/|title=Editorial: The 12 Ballsiest Movie Publicity Stunts}}</ref><ref name="mwpdigitalmedia.com">{{cite web|url=http://mwpdigitalmedia.com/blog/the-blair-witch-project-the-best-viral-marketing-campaign-of-all-time/|title=The Blair Witch Project: The best viral marketing campaign of all time}}</ref> The campaign tactic was that viewers were being told, through missing persons posters, that the filmmakers were missing while researching in the woods for the mythical Blair Witch.<ref>{{Cite news|url=http://filmforecaster.com/greatest-movie-viral-campaigns/ |title=The Greatest Movie Viral Campaigns|author=Amelia River|date=July 11, 2014 |access-date=7 July 2016}}</ref> The [[IMDb]] page also listed the actors as "missing, presumed dead" in the first year of the film's availability.<ref name="mwpdigitalmedia.com"/><ref>{{cite web|url=http://www.thefleshfarm.com/blairwitch/blairwitchmain.htm|title=The Blair Witch Project}}</ref> The film's website contained materials of actors posing as police and investigators giving testimony about their casework, and shared childhood photos of the actors to add a sense of realism.<ref>{{cite web|url=http://blairwitch.com/filmmakers.html|title=The Blair Witch Project Official Website: The Filmmakers}}</ref><br />
<br />
''[[USA Today]]'' has opined that the movie was the first movie to go "[[Viral video|viral]]" despite having been produced before many of the technologies that facilitate such phenomena existed.<ref>{{cite web|last1=Bowies|first1=Scott|title='Blair Witch Project': Still a legend 15 years later|url=http://www.usatoday.com/story/life/movies/2014/07/13/blair-witch-project-15th-anniversary-classic-legend/10707409/|website=USA Today|accessdate=24 February 2016}}</ref><br />
<br />
==Reception==<br />
<br />
===Box office===<br />
''The Blair Witch Project'' was shown at the 1999 [[Sundance Film Festival]] and had a limited release on July 14, before going wide on July 30, 1999 after months of publicity, including a campaign by the studio to use the Internet and suggest that the movie was a record of real events. The distribution strategy for ''The Blair Witch Project'' was created and implemented by Artisan studio executive [[Steven Rothenberg]].<ref name=thr>{{cite news|first=Carl |last=DiOrio |title=Steve Rothenberg dies at age 50 |url=http://www.hollywoodreporter.com/hr/content_display/film/news/e3i7c23ccda60974aa20677ac607d102241 |work=[[The Hollywood Reporter]] |publisher= |date=July 19, 2009 |accessdate=August 2, 2009 |deadurl=yes |archiveurl=https://web.archive.org/web/20100201002701/http://www.hollywoodreporter.com/hr/content_display/film/news/e3i7c23ccda60974aa20677ac607d102241 |archivedate=February 1, 2010 }}</ref><ref name=variety>{{cite news |first=Dave|last=McNary|title=Lionsgate's Steven Rothenberg dies|url=http://www.variety.com/article/VR1118006188.html?categoryId=25&cs=1 |work=[[Variety Magazine]]|publisher=|date=July 20, 2009 |accessdate=August 2, 2009}}</ref><br />
<br />
''The Blair Witch Project'' grossed $248.6 million worldwide.<ref name="mojo">{{cite web | title = The Blair Witch Project | work = Box Office Mojo.com|date = January 1, 2006| url = http://boxofficemojo.com/movies/?id=blairwitchproject.htm| accessdate = July 28, 2006 }}</ref> After reshoots, a new sound mix, experiments with different endings and other changes made by the studio, the film's final budget ended up between $500,000 and $750,000.<ref name="Q&A" /><br />
<br />
===Critical response===<br />
The film received wide acclaim from critics, although audience reception was polarized and divided.<ref name="Reception"/> [[Rotten Tomatoes]] gives the film an approval rating of 86%, based on 155 reviews, with an average rating of 7.7/10. The site's critical consensus reads, "Full of creepy campfire scares, mock-doc ''The Blair Witch Project'' keeps audiences in the dark about its titular villain -- thus proving that imagination can be as scary as anything onscreen."<ref>{{cite web | last = | first = | title = The Blair Witch Project | work = Rotten Tomatoes.com | date = | url = http://www.rottentomatoes.com/m/blair_witch_project/|accessdate =February 10, 2011 }}</ref> On [[Metacritic]] the film has a score of 81 out of 100, based on 33 critics, indicating "universal acclaim".<ref>[http://www.metacritic.com/movie/the-blair-witch-project The Blair Witch Project Reviews - Metacritic<!-- Bot generated title -->]</ref><br />
<br />
The film's "[[Found footage (pseudo-documentary)|found footage]]" format received near-universal praise by critics and, though not the first in the found footage device, the film has been declared a milestone in film history due to its critical and box office success. [[Roger Ebert]] of the ''[[Chicago Sun Times]]'' gave the film a total of 4 stars, calling it "an extraordinarily effective horror film".<ref name="Ebert">{{cite news | last =Ebert | first = Roger| title = The Blair Witch Project | work = Roger Ebert.com | date = July 16, 1999| url = http://rogerebert.suntimes.com/apps/pbcs.dll/article?AID=/19990716/REVIEWS/907160301/1023| accessdate = July 28, 2006 }}</ref> It was listed on Filmcritic.com as the 50th best movie ending of all time.<ref>{{cite web | last =Null | first = Christopher | title = The Top 50 Movie Endings of All Time | work = filmcritic.com|date = January 1, 2006| url = http://filmcritic.com/misc/emporium.nsf/0/394a496e465c4f38882571b900114dc5?OpenDocument| accessdate =July 30, 2006|archiveurl = http://web.archive.org/web/20060820031838/http://filmcritic.com/misc/emporium.nsf/0/394a496e465c4f38882571b900114dc5?OpenDocument <!-- Bot retrieved archive --> |archivedate = August 20, 2006}}</ref><br />
<br />
Film critic Michael Dodd has argued that the film is an embodiment of horror "modernizing its ability to be all-encompassing in expressing the fears of American society", acknowledging its status as the archetypal modern found footage feature, he noted that "In an age where anyone can film whatever they like, horror needn’t be a cinematic expression of what terrifies the cinema-goer, it can simply be the medium through which terrors captured by the average American can be showcased".<ref>[http://themissingslate.com/2014/08/31/safe-scares-how-911-caused-the-american-horror-remake-trend-part-one/#.VARTBvldUgs Safe Scares: How 9/11 caused the American Horror Remake Trend (Part One) – The Missing Slate<!-- Bot generated title -->]</ref> During 2008, ''[[Entertainment Weekly]]'' named ''The Blair Witch Project'' one of "the 100 best films from 1983 to 2008", ranking it at #99.<ref>{{cite news|url=http://www.ew.com/ew/article/0,,20207076_20207387_20207063,00.html |work=Entertainment Weekly |title=The New Classics: Movies – EW 1000: Movies – Movies – The EW 1000 – Entertainment Weekly |deadurl=yes |archiveurl=https://web.archive.org/web/20090807093230/http://www.ew.com/ew/article/0,,20207076_20207387_20207063,00.html |archivedate=August 7, 2009 }}</ref> In 2006, [[Chicago Film Critics Association]] listed it as one of the "Top 100 Scariest Movies", ranking it #12.<ref>[http://www.altfg.com/blog/hollywood/chicago-critics-scariest-films/ Filmspotting, Scariest Movies, Film, Podcast, Reviews, DVDs, Adam Kempenaar]</ref><br />
<br />
Because the filming was done by the actors using hand-held cameras, much of the footage is [[Shaky camera|shaky]], especially the final sequence in which a character is running down a set of stairs with the camera. Some audience members experienced [[motion sickness]] and even vomited as a result.<ref>{{cite news| url=http://www.washingtonpost.com/wp-srv/style/movies/features/witchdizzy.htm | work=The Washington Post | title=The Dizzy Spell of 'Blair Witch Project' | date=July 30, 1999 | accessdate=March 1, 2012 | first=Emily | last=Wax}}</ref><br />
<br />
===Awards and honors===<br />
''The Blair Witch Project'' was nominated for, and won, the following awards.<br />
<br />
{| class="wikitable"<br />
|-<br />
! Award<br />
! Category<br />
! Subject<br />
! Result<br />
|-<br />
|rowspan=2|Global Film Critics Award<ref>{{cite web|url=http://www.globalfilmcritics.com/index.php?option=com_content&task=view&id=78&Itemid=35 |title=www.globalfilmcritics.com |publisher=www.globalfilmcritics.com |date= |accessdate=May 29, 2012 |deadurl=yes |archiveurl=https://web.archive.org/web/20120220134033/http://www.globalfilmcritics.com/index.php?option=com_content&task=view&id=78&Itemid=35 |archivedate=February 20, 2012 }}</ref><br />
|rowspan=2|Best Screenplay<br />
|Daniel Myrick<br />
|{{nom}}<br />
|-<br />
|Eduardo Sánchez<br />
|{{nom}}<br />
|-<br />
|[[Independent Spirit John Cassavetes Award]]<br />
|colspan=2|Best Film<br />
|{{won}}<br />
|-<br />
|rowspan=3|[[Golden Raspberry Award]]<br />
|rowspan=2|[[Golden Raspberry Award for Worst Picture|Worst Picture]]<br />
|Robin Cowie<br />
|{{nom}}<br />
|-<br />
|[[Gregg Hale (producer)|Gregg Hale]]<br />
|{{nom}}<br />
|-<br />
|[[Golden Raspberry Award for Worst Actress|Worst Actress]]<br />
|[[Heather Donahue]]<br />
|{{won}}<br />
|-<br />
|rowspan=5|[[Stinkers Bad Movie Awards]]<ref>{{cite web|url=http://theenvelope.latimes.com/extras/lostmind/year/1999/1999st.htm |title=1999 22nd Hastings Bad Cinema Society Stinkers Awards |date= |accessdate=July 8, 2013 |work=[[Stinkers Bad Movie Awards]] |publisher=[[Los Angeles Times]] |deadurl=yes |archiveurl=https://web.archive.org/web/20070103155722/http://theenvelope.latimes.com/extras/lostmind/year/1999/1999st.htm |archivedate=January 3, 2007 }}</ref><br />
|rowspan=2|Worst Picture<br />
|Robin Cowie<br />
|{{nom}}<br />
|-<br />
|Gregg Hale<br />
|{{nom}}<br />
|-<br />
|Worst Actress<br />
|Heather Donahue<br />
|{{nom}}<br />
|-<br />
|Biggest Disappointment<br />
|<br />
|{{won}}<br />
|-<br />
|Worst Screen Debut<br />
|Heather, Michael, Josh, the Stick People and the world's longest running batteries<br />
|{{nom}}<br />
|}<br />
<br />
The film is recognized by [[American Film Institute]] in these lists:<br />
* 2001: [[AFI's 100 Years...100 Thrills]] – Nominated<ref>{{cite web|url=http://www.afi.com/Docs/100Years/thrills400.pdf |title=AFI's 100 Years...100 Thrills Nominees |format=PDF |date= |accessdate=August 20, 2016}}</ref><br />
* 2003: [[AFI's 100 Years...100 Heroes & Villains]]:<br />
** The Blair Witch – Nominated Villain<ref>{{cite web|url=http://www.afi.com/Docs/100Years/handv400.pdf |title=AFI's 100 Years...100 Heroes & Villains Nominees |format=PDF |date= |accessdate=August 20, 2016}}</ref><br />
<br />
==Cinematic and literary allusions==<br />
In the movie, the Blair Witch is, according to legend, the ghost of Elly Kedward, a woman banished from the Blair Township (latter-day Burkittsville) for [[witchcraft]] in 1785. The directors incorporated that part of the legend, along with allusions to the [[Salem Witch Trials]] and ''[[The Crucible]]'', to play on the themes of injustice done on those who were called witches.<ref name="witch">{{cite web | last =Aloi| first = Peg | title = Blair Witch Project &ndash; an Interview with the Directors | work = Witchvox.com | date = July 11, 1999| url = http://www.witchvox.com/va/dt_va.html?a=usma&c=media&id=2416| accessdate = July 29, 2006}}</ref> They were influenced by ''[[The Shining (film)|The Shining]]'', ''[[Alien (film)|Alien]]'', ''[[The Omen]]'' and [[Benjamin Christensen]]'s 1922 silent documentary ''[[Häxan]]'', after which the producers named their production company, Haxan Films. ''[[Jaws (film)|Jaws]]'' was an influence as well, presumably because the witch was hidden from the viewer for the entirety of the film, forcing suspense from the unknown.<ref name="onion">{{cite web | last = Klein | first =Joshua| title = Interview - The Blair Witch Project | work = avclub.com | date = July 22, 1999| url = http://www.avclub.com/article/the-blair-witch-project-13607| accessdate = January 26, 2015 }}</ref><br />
<br />
==Soundtrack==<br />
None of the songs featured on ''Josh's Blair Witch Mix'' actually appear in the movie. However, "The Cellar" is played during the credits and the DVD menu. This collection of mostly [[goth rock]] and [[industrial music|industrial]] tracks is supposedly from a mix tape made by ill-fated film student Joshua Leonard. In the story, the tape was found in his car after his disappearance. Some of the songs featured on the soundtrack were released after 1994, after the events of the movie supposedly have taken place. Several of them feature dialogue from the movie as well.<br />
# "[[Gloomy Sunday]]"&nbsp;– [[Lydia Lunch]]<br />
# "The Order of Death"&nbsp;– [[Public Image Ltd.]]<br />
# "[[Cleanse Fold and Manipulate|Draining Faces]]"&nbsp;– [[Skinny Puppy]]<br />
# "Kingdom's Coming"&nbsp;– [[Bauhaus (band)|Bauhaus]]<br />
# "Don't Go to Sleep Without Me"&nbsp;– [[The Creatures]]<br />
# "God Is God"&nbsp;– [[Laibach (band)|Laibach]]<br />
# "Beware"&nbsp;– [[The Afghan Whigs]]<br />
# "Laughing Pain"&nbsp;– [[Front Line Assembly]]<br />
# "Haunted"&nbsp;– [[Type O Negative]]<br />
# "She's Unreal"&nbsp;– [[Meat Beat Manifesto]]<br />
# "Movement of Fear"&nbsp;– [[Tones on Tail]]<br />
# "The Cellar"&nbsp;– Antonio Cora<br />
<br />
==Media tie-ins==<br />
{{main article|Blair Witch}}<br />
<br />
===Books===<br />
In September 1999, D.A. Stern compiled ''The Blair Witch Project: A Dossier''. Perpetuating the film's "true story" angle, the dossier consisted of fabricated police reports, pictures, interviews, and newspaper articles presenting the movie's premise as fact, as well as further elaboration on the Elly Kedward and Rustin Parr legends (an additional "dossier" was created for ''Blair Witch 2''). Stern wrote the 2000 novel ''Blair Witch: The Secret Confessions of Rustin Parr'' and in 2004, revisited the franchise with the novel ''Blair Witch: Graveyard Shift'', featuring all original characters and plot.<br />
<br />
In May 1999, a [[Photonovel]] adaptation of ''The Blair Witch Project'' was written by Claire Forbes and was released by Fotonovel Publications.<br />
<br />
====''The Blair Witch Files''====<br />
A series of eight young adult books entitled ''The Blair Witch Files'' were released by [[Random House|Random]] subsidiary [[Bantam Books|Bantam]] from 2000 to 2001. The books center on Cade Merill, a fictional cousin of Heather Donahue, who investigates phenomena related to the Blair Witch in attempt to discover what really happened to Heather, Mike, and Josh.<ref name="Files">{{cite web|last=Merill |first=Cade |title=Cade Merill's The Blair Witch Files |work=Random House |year=2000 |url=http://www.randomhouse.com/features/blairwitch/home.html |accessdate=September 8, 2009 |deadurl=yes |archiveurl=https://web.archive.org/web/20081207020654/http://www.randomhouse.com/features/blairwitch/home.html |archivedate=December 7, 2008 }}</ref><br />
<br />
# ''The Blair Witch Files 1&nbsp;– The Witch's Daughter''<br />
# ''The Blair Witch Files 2&nbsp;– The Dark Room''<br />
# ''The Blair Witch Files 3&nbsp;– The Drowning Ghost''<br />
# ''The Blair Witch Files 4&nbsp;– Blood Nightmare''<br />
# ''The Blair Witch Files 5&nbsp;– The Death Card''<br />
# ''The Blair Witch Files 6&nbsp;– The Prisoner''<br />
# ''The Blair Witch Files 7&nbsp;– The Night Shifters''<br />
# ''The Blair Witch Files 8&nbsp;– The Obsession''<br />
<br />
===Comic books===<br />
In August 1999, [[Oni Press]] released a [[One-shot (comics)|one-shot]] comic promoting the film, simply titled ''The Blair Witch Project''. Written by Jen Van Meter and drawn by [[Bernie Mireault]], [[Guy Davis (comics)|Guy Davis]], and [[Tommy Lee Edwards]], the comic featured three short stories elaborating on the mythology of the Blair Witch. In mid-2000, the same group worked on a four-issue series called ''The Blair Witch Chronicles''.<br />
<br />
In October 2000, coinciding with the release of ''Book of Shadows: Blair Witch 2'', [[Image Comics]] released a one-shot called ''Blair Witch: Dark Testaments'', drawn by [[Charlie Adlard]] and written by [[Ian Edginton]].<br />
<br />
===Video games===<br />
In 2000, [[Gathering of Developers]] released a [[Blair Witch (video games)|trilogy of computer games]] based on the film, which greatly expanded on the myths first suggested in the film. The graphics engine and characters were all derived from the producer's earlier game ''[[Nocturne (Game)|Nocturne]]''.<ref>Smith, Jeff. [http://pc.ign.com/articles/078/078038p1.html 'Blair Witch Project Interview'] [[IGN]].com. April 14, 2000.</ref> Each game, developed by a different team, focused on different aspects of the Blair Witch mythology: Rustin Parr, Coffin Rock, and Elly Kedward, respectively.<br />
<br />
The trilogy received mixed reviews from critics, with most criticism being directed towards the very linear gameplay, clumsy controls and camera angles, and short length. The first volume, ''Rustin Parr'', received the most praise, ranging from moderate to positive, with critics commending its storyline, graphics and atmosphere; some reviewers even claimed that the game was scarier than the movie.<ref>[http://www.metacritic.com/games/platforms/pc/blairwitch1rustinparr?q=Blair%20Witch 'Metacritic: Blair Witch Volume 1: Rustin Parr']. Metacritic.</ref> The following volumes were less well-received, with ''[[PC Gamer]]'' saying that Volume 2's only saving grace was its cheap price<ref>[http://www.metacritic.com/games/platforms/pc/blairwitch2coffinrock?q=Blair%20Witch 'Metacritic &ndash; Blair Witch Volume 2'] Metacritic.</ref> and calling Volume 3 "amazingly mediocre".<ref>[http://www.metacritic.com/games/platforms/pc/blairwitch3ellykedward?q=Blair%20Witch 'Metacritic &ndash; Blair Witch Volume 3'] Metacritic.</ref><br />
<br />
===Documentary===<br />
''The Woods Movie'' (2015) is a feature-length documentary exploring the production of ''The Blair Witch Project''.<ref>{{cite web | last = | first = | title = Blair Witch Documentary Goes into The Woods Movie | work = DC| date = January 1, 2006| url = http://www.dreadcentral.com/news/89704/blair-witch-documentary-goes-woods-movie/| accessdate = July 28, 2006 |archivedate = May 9, 2006}}</ref> For this documentary, director Russ Gomm interviewed the original film's producer, [[Gregg Hale (producer)|Gregg Hale]], and directors, [[Eduardo Sánchez (director)|Eduardo Sánchez]] and [[Daniel Myrick]].<ref>{{cite web | last = | first = | title = Finally a Doc On ‘The Blair Witch Project’ – Trailer For "The Woods Movie" | work = DC| date = January 1, 2006| url = http://bloody-disgusting.com/videos/3332333/finally-doc-blair-witch-project-trailer-woods-movie/| accessdate = July 28, 2006 |archivedate = May 9, 2006}}</ref><br />
<br />
==Home media==<br />
''The Blair Witch Project'' was released on [[DVD]] on October 26, 1999, with VHS and laserdisc versions released around the same time. The DVD included a number of special features, including "''The Curse of the Blair Witch''" and "''The Blair Witch Legacy''" featurettes, newly discovered footage, [[Audio commentary|director and producer commentary]], production notes, cast & crew bios, and trailers.<br />
<br />
A [[Blu-ray Disc|Blu-ray]] release from [[Lionsgate]] was released on October 5, 2010.<ref>{{cite web|url=http://www.blu-ray.com/movies/The-Blair-Witch-Project-Blu-ray/13876 |title=The Blair Witch Project Blu-ray |publisher=Blu-ray.com |date= |accessdate=2012-05-29}}</ref> [[Best Buy]] and Lionsgate had an exclusive release of the Blu-ray available on August 29, 2010.<ref name="test">{{cite web|title=The Blair Witch Project|publisher =High Def Digest|url=http://bluray.highdefdigest.com/3704/blairwitchproject.html |accessdate=March 18, 2016}}</ref><br />
<br />
==Sequels==<br />
A [[sequel]], ''[[Book of Shadows: Blair Witch 2]]'', was released in the autumn of 2000. The film was poorly received by most critics.<ref>{{cite web | last =B. | first =Scott | title = Blair Witch Project 3 to Happen? | work = IGN.com | date = August 21, 2001| url = http://filmforce.ign.com/articles/304/304427p1.html| accessdate = July 30, 2006 }}</ref> A third installment announced that same year did not materialize.<ref>{{cite web | last = | first = | title = Blair Witch 3 | work = Yahoo Movies | date = 2006-01-01| url = http://movies.yahoo.com/shop?d=hp&cf=prev&id=1808403198| accessdate = 2006-07-28 |archiveurl = https://web.archive.org/web/20060509080506/http://movies.yahoo.com/shop?d=hp&cf=prev&id=1808403198 |archivedate = 2006-05-09}}</ref><br />
<br />
In January 2015, Eduardo Sanchez revealed that he was still planning ''Blair Witch 3'' and that he considered the film "inevitable", but added that there was nothing to officially announce at that time.<ref>{{cite web | last =Barton | first =Steve | title = Eduardo Sanchez Talks Blair Witch 3 | work = dreadcentral.com | date = January 14, 2015| url = http://www.dreadcentral.com/news/85523/exclusive-eduardo-sanchez-talks-blair-witch-3-coming-sooner-rather-later/| accessdate = March 16, 2015 }}</ref><br />
<br />
On July 22, 2016, a surprise trailer of '''''"[[Blair Witch (film)|Blair Witch]]"''''', directed by [[Adam Wingard]], a sequel to the first film, was released at [[San Diego Comic-Con International|San Diego Comic-Con]].<ref>https://www.youtube.com/watch?v=girSv9UH_V8 ''Blair Witch'' trailer</ref> The film was originally marketed as ''The Woods'' so as to be an exclusive surprise announcement for those in attendance at the convention. The film, produced by [[Lionsgate Films|Lionsgate]], is slated for a September 16, 2016 release<ref name="latimes.com"/> and stars [[James Allen McCune]] as the brother of the original film's Heather Donahue.<ref>{{cite web|last1=Collis|first1=Clark|title=Secret Blair Witch sequel gets new trailer, September release date|url=http://www.ew.com/article/2016/07/22/blair-witch-project-sequel-secret-comic-con|website=Entertainment Weekly|accessdate=23 July 2016}}</ref> In September 2016, screenwriter [[Simon Barrett]] explained that in writing the new film he only considered material that was produced with the involvement of the original film's creative team (directors Daniel Myrick and Eduardo Sanchez, producer Greg Hale, and production designer Ben Rock) to be used in the making of the film, and that he did not take any material produced without their involvement—such as the first sequel ''Book of Shadows'' or ''[[Blair Witch#The Blair Witch Files|The Blair Witch Files]]'', a series of [[young adult fiction|young adult]] novels—into consideration when writing the new sequel.<ref name="cinemablend.com"/><br />
<br />
An unofficial spin-off was released in 2011 titled ''Doc. 33''', an Italian [[Found footage (pseudo-documentary)|found footage]] [[horror film]]. The film starts by describing the events that occur in ''The Blair Witch Project''; it then follows by describing a similar incident that occurred in Wirgen, [[Austria]]. The film revolves around a group of filmmakers in 1998 who investigate an orphanage in the woods where dozens of children were murdered by nuns. The nuns took part in occult practices which dubbed the [[wikt:mother superior|Mother Superior]] of the orphanage "The Witch of Wirgen Woods."<br />
<br />
==See also==<br />
* [[List of ghost films]]<br />
* [[Found footage (pseudo-documentary)]]<br />
* ''[[The Bogus Witch Project]]'', a direct-to-video parody.<br />
<br />
== Literature ==<br />
* Schreier, Margrit (2004): ''Please Help Me; All I Want to Know Is: Is It Real or Not? How Recipients View the Reality Status of The Blair Witch Project.'' In: Poetics Today, Vol. 25, Nr. 2, pp.&nbsp;305–334 ([http://dx.doi.org/10.1215/03335372-25-2-305 full text]{{dead link|date=September 2016|bot=medic}}{{cbignore|bot=medic}}, qualitative content analysis on the movie´s reception)<br />
<br />
==References==<br />
{{Reflist|30em}}<br />
<br />
==External links==<br />
{{wikiquote}}<br />
{{Commons category}}<br />
* {{official website|http://www.blairwitch.com/}}<br />
* {{IMDb title|0185937|The Blair Witch Project}}<br />
* {{allmovie|176036|The Blair Witch Project}}<br />
* {{mojo title|blairwitchproject|The Blair Witch Project}}<br />
* {{rotten-tomatoes|blair_witch_project|The Blair Witch Project}}<br />
<br />
{{The Blair Witch Project}}<br />
{{Eduardo Sánchez}}<br />
<br />
{{DEFAULTSORT:Blair Witch Project, The}}<br />
[[Category:1999 films]]<br />
[[Category:1999 horror films]]<br />
[[Category:American films]]<br />
[[Category:American horror films]]<br />
[[Category:English-language films]]<br />
[[Category:Camcorder films]]<br />
[[Category:Cultural depictions of people]]<br />
[[Category:Films set in 1994]]<br />
[[Category:Films set in Maryland]]<br />
[[Category:Films shot in Maryland]]<br />
[[Category:Films shot from the first-person perspective]]<br />
[[Category:Found footage films]]<br />
[[Category:American independent films]]<br />
[[Category:Mockumentary films]]<br />
[[Category:Psychological horror films]]<br />
[[Category:Supernatural horror films]]<br />
[[Category:Witchcraft in film]]<br />
[[Category:Artisan Entertainment films]]<br />
[[Category:Blair Witch (franchise)]]<br />
[[Category:1999 hoaxes]]<br />
[[Category:Paranormal hoaxes]]<br />
[[Category:Films set in forests]]<br />
[[Category:Films about film directors and producers]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=AWK&diff=732913836AWK2016-08-04T02:50:24Z<p>PuercoPop: Remove the misnomer 'interpreted language' from the article</p>
<hr />
<div>{{About|the programming language}}<br />
{{Infobox programming language<br />
| logo =<br />
| name = AWK<br />
| paradigm = [[scripting language|Scripting]], [[procedural programming|procedural]], [[data-driven programming|data-driven]]<ref name=developerworks>{{cite web|url=https://www6.software.ibm.com/developerworks/education/au-gawk/au-gawk-a4.pdf|title=Get started with GAWK: AWK language fundamentals|last=Stutz|first=Michael|date=September 19, 2006|work=developerWorks|publisher=[[IBM]]|accessdate=2015-01-29|quote=[AWK is] often called a data-driven language -- the program statements describe the input data to match and process rather than a sequence of program steps}}</ref><br />
| year = {{start date and age|1977}}<br />
| latest_release_version = [http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html IEEE Std 1003.1-2008] (POSIX) / 1985<br />
| designer = [[Alfred Aho]], [[Peter J. Weinberger|Peter Weinberger]], and [[Brian Kernighan]]<br />
| typing = none; can handle strings, integers and floating-point numbers; regular expressions<br />
| implementations = awk, GNU Awk, mawk, nawk, MKS AWK, Thompson AWK (compiler), Awka (compiler)<br />
| dialects = ''old awk'' oawk 1977, ''new awk'' nawk 1985, ''GNU Awk'' gawk<br />
| influenced_by = [[C (programming language)|C]], [[SNOBOL]]4, [[Bourne shell]]<br />
| influenced = [[Tcl]], [[AMPL]], [[Perl]]<!--1987-->, [[Korn Shell]] (''ksh93''<!--1993-->, ''dtksh'', ''tksh''), [[Lua (programming language)|Lua]]<!--1993--><br />
| operating_system = [[Cross-platform]]<br />
| website = {{URL|www.cs.princeton.edu/~bwk/btl.mirror/}}<br />
}}<br />
<br />
'''AWK''' is an [[programming language]] designed for text processing and typically used as a [[data extraction]] and reporting tool. It is a standard feature of most [[Unix-like]] [[operating system]]s.<br />
<br />
The AWK language is a [[data-driven programming|data-driven]] [[scripting language]] consisting of a set of actions to be taken against [[Stream (computing)|streams]] of textual data – either run directly on files or used as part of a [[pipeline (Unix)|pipeline]] – for purposes of extracting or transforming text, such as producing formatted reports. The language extensively uses the [[string (computer science)|string]] [[datatype]], [[associative array]]s (that is, arrays indexed by key strings), and [[regular expression]]s. While AWK has a limited intended [[application domain]] and was especially designed to support [[one-liner program]]s, the language is [[Turing-complete]], and even the early Bell Labs users of AWK often wrote well-structured large AWK programs.<ref>{{cite web<br />
| url = http://www.faqs.org/docs/artu/ch08s02.html#awk<br />
| title = Applying Minilanguages<br />
| first = Eric S.<br />
| last = Raymond<br />
| authorlink = Eric S. Raymond<br />
| work = The Art of Unix Programming<br />
| at = Case Study: awk<br />
| archiveurl = https://web.archive.org/web/20080730063308/http://www.faqs.org/docs/artu/ch08s02.html#awk<br />
| archivedate = July 30, 2008<br />
| accessdate = May 11, 2010<br />
| quote = The awk action language is Turing-complete, and can read and write files.<br />
}}</ref><br />
<br />
AWK was created at [[Bell Labs]] in the 1970s,<ref>[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.31.1299 Awk -- A Pattern Scanning and Processing Language (Second Edition) (1978)]</ref> and its name is derived from the [[surname]]s of its authors – [[Alfred Aho]], [[Peter J. Weinberger|Peter Weinberger]], and [[Brian Kernighan]]. The acronym is pronounced the same as the name of the bird [[auk]] (which acts as an emblem of the language such as on ''The AWK Programming Language'' book cover{{r|AWK1}} – the book is often referred to by the abbreviation ''TAPL''). When written in all lowercase letters, as <code>awk</code>, it refers to the [[Unix]] or [[Plan 9 from Bell Labs|Plan 9]] program that runs scripts written in the AWK programming language.<br />
<br />
==History==<br />
AWK was initially developed in 1977 by [[Alfred Aho]], [[Peter Weinberger]], and [[Brian Kernighan]], from whose initials the language takes its name. As one of the early tools to appear in [[Version 7 Unix]], AWK added computational features to a Unix [[pipeline (Unix)|pipeline]] besides the [[Bourne shell]], the only scripting language available in a standard Unix environment. It is one of the mandatory utilities of the [[Single UNIX Specification]],<ref>[http://www.unix.org/version3/apis/cu.html The Single UNIX Specification, Version 3, Utilities Interface Table]</ref> and is required by the [[Linux Standard Base]] specification.<ref>[http://refspecs.freestandards.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-generic/command.html#AEN32008 Linux Standard Base Core Specification 4.0, Chapter 15. Commands and Utilities]</ref><br />
<br />
AWK was significantly revised and expanded in 1985–88, resulting in the [[Gawk (GNU package)|GNU AWK]] implementation written by [[Paul Rubin]], [[Jay Fenlason]], and [[Richard Stallman]], released in 1988.<ref name=robbins/> GNU AWK is the most widely deployed version{{Citation needed|date=March 2015}} because it is included with GNU-based Linux packages. GNU AWK has been maintained solely by [[Arnold Robbins]] since 1994.<ref name=robbins>{{cite web |url=http://www.skeeve.com/gnu-awk-and-me-2014.pdf |title=The GNU Project and Me: 27 Years with GNU AWK |website=skeeve.com |author=Arnold Robbins |date=March 2014 |accessdate=October 4, 2014}}</ref> [[Brian Kernighan]]'s [[nawk]] (New AWK) source was first released in 1993 unpublicized, and publicly since the late 1990s; many BSD systems use it to avoid GPL license.<ref name=robbins/><br />
<br />
AWK was preceded by [[sed]] (1974). Both were designed for text processing. They share the line-oriented, data-driven paradigm, and are particularly suited to writing [[one-liner program]]s, due to the implicit [[main loop]] and current line variables. The power and terseness of early AWK programs – notably the powerful regular expression handling and conciseness due to implicit variables, which facilitate one-liners – together with the limitations of AWK at the time, were important inspirations for the [[Perl]] language (1987). In the 1990s, Perl became very popular, competing with AWK in the niche of Unix text-processing languages.<br />
<br />
== Structure of AWK programs ==<br />
<br />
<blockquote><br />
"'''AWK''' is a language for processing text files. A file is treated as a sequence of records, and by default each line is a record. Each line is broken up into a sequence of fields, so we can think of the first word in a line as the first field, the second word as the second field, and so on. An AWK program is a sequence of pattern-action statements. AWK reads the input a line at a time. A line is scanned for each pattern in the program, and for each pattern that matches, the associated action is executed." - Alfred V. Aho<ref>http://www.computerworld.com.au/index.php/id;1726534212;pp;2 The A-Z of Programming Languages: AWK</ref><br />
</blockquote><br />
<br />
An AWK program is a series of pattern action pairs, written as:<br />
<br />
<source lang="awk"><br />
condition { action }<br />
</source><br />
<br />
where ''condition'' is typically an expression and ''action'' is a series of commands. The input is split into records, where by default records are separated by newline characters so that the input is split into lines. The program tests each record against each of the conditions in turn, and executes the ''action'' for each expression that is true. Either the ''condition'' or the ''action'' may be omitted. The ''condition'' defaults to matching every record. The default ''action'' is to print the record. This is the same pattern-action structure as sed.<br />
<br />
In addition to a simple AWK expression, such as <code>foo == 1</code> or <code>/^foo/</code>, the ''condition'' can be ''BEGIN'' or ''END'' causing the ''action'' to be executed before or after all records have been read, or ''pattern1, pattern2'' which matches the range of records starting with a record that matches ''pattern1'' up to and including the record that matches ''pattern2'' before again trying to match against ''pattern1'' on future lines.<br />
<br />
In addition to normal arithmetic and logical operators, AWK expressions include the tilde operator, ''~'', which matches a [[regular expression]] against a string. As handy [[syntactic sugar]], ''/regexp/'' without using the tilde operator matches against the current record; this syntax derives from sed, which in turn inherited it from the [[Ed (text editor)|ed]] editor, where <code>/</code> is used for searching. This syntax of using slashes as [[delimiter]]s for regular expressions was subsequently adopted by Perl and ECMAScript, and is now quite common. The tilde operator was also adopted by Perl, but has not seen as wide use.<br />
<br />
== AWK commands ==<br />
<br />
AWK commands are the statements that are substituted for ''action'' in the examples above. AWK commands can include function calls, variable assignments, calculations, or any combination thereof. AWK contains built-in support for many functions; many more are provided by the various flavors of AWK. Also, some flavors support the inclusion of [[dynamically linked library|dynamically linked libraries]], which can also provide more functions.<br />
<br />
For brevity, the enclosing curly braces ( ''{ }'' ) will be omitted from these examples.<br />
<br />
=== The ''print'' command ===<br />
<br />
The ''print'' command is used to output text. The output text is always terminated with a predefined string called the output record separator (ORS) whose default value is a newline. The simplest form of this command is:<br />
<br />
; <code>print</code><br />
:This displays the contents of the current record. In AWK, records are broken down into ''fields'', and these can be displayed separately:<br />
; <code>print $1</code><br />
: Displays the first field of the current record<br />
; <code>print $1, $3</code><br />
: Displays the first and third fields of the current record, separated by a predefined string called the output field separator (OFS) whose default value is a single space character<br />
<br />
Although these fields (''$X'') may bear resemblance to variables (the $ symbol indicates variables in [[Perl]]), they actually refer to the fields of the current record. A special case, ''$0'', refers to the entire record. In fact, the commands "<code>print</code>" and "<code>print $0</code>" are identical in functionality.<br />
<br />
The ''print'' command can also display the results of calculations and/or function calls:<br />
<source lang="awk"><br />
print 3+2<br />
print foobar(3)<br />
print foobar(variable)<br />
print sin(3-2)<br />
</source><br />
<br />
Output may be sent to a file:<br />
<source lang="awk"><br />
print "expression" > "file name"<br />
</source><br />
<br />
or through a [[pipe (Unix)|pipe]]:<br />
<source lang="awk"><br />
print "expression" | "command"<br />
</source><br />
<br />
=== Built-in variables ===<br />
<br />
Awk's built-in variables include the field variables: $1, $2, $3, and so on ($0 represents the entire record). They hold the text or values in the individual text-fields in a record.<br />
<br />
Other variables include:<br />
* NR: Keeps a current count of the number of input records.<br />
* NF: Keeps a count of the number of fields in an input record. The last field in the input record can be designated by $NF.<br />
* FILENAME: Contains the name of the current input-file.<br />
* FS: Contains the "field separator" character used to divide fields on the input record. The default, "white space", includes any space and tab characters. FS can be reassigned to another character to change the field separator.<br />
* RS: Stores the current "record separator" character. Since, by default, an input line is the input record, the default record separator character is a "newline".<br />
* OFS: Stores the "output field separator", which separates the fields when Awk prints them. The default is a "space" character.<br />
* ORS: Stores the "output record separator", which separates the output records when Awk prints them. The default is a "newline" character.<br />
* OFMT: Stores the format for numeric output. The default format is "%.6g".<br />
<br />
=== Variables and syntax ===<br />
<br />
Variable names can use any of the characters [A-Za-z0-9_], with the exception of language keywords. The operators ''+ - * /'' represent addition, subtraction, multiplication, and division, respectively. For string [[concatenation]], simply place two variables (or string constants) next to each other. It is optional to use a space in between if string constants are involved, but two variable names placed adjacent to each other require a space in between. Double quotes [[delimit]] string constants. Statements need not end with semicolons. Finally, comments can be added to programs by using ''#'' as the first character on a line.<br />
<br />
=== User-defined functions ===<br />
<br />
In a format similar to [[C (programming language)|C]], function definitions consist of the keyword <code>function</code>, the function name, argument names and the function body. Here is an example of a function.<br />
<source lang="awk"><br />
function add_three (number) {<br />
return number + 3<br />
}<br />
</source><br />
<br />
This statement can be invoked as follows:<br />
<source lang="awk"><br />
print add_three(36) # Outputs '''39'''<br />
</source><br />
<br />
Functions can have variables that are in the local scope. The names of these are added to the end of the argument list, though values for these should be omitted when calling the function. It is convention to add some [[whitespace character|whitespace]] in the argument list before the local variables, to indicate where the parameters end and the local variables begin.<br />
<br />
== Sample applications ==<br />
<br />
=== Hello World ===<br />
<br />
Here is the customary "[["Hello, World!" program|Hello, world]]" program written in AWK:<br />
<source lang="awk"><br />
BEGIN { print "Hello, world!" }<br />
</source><br />
<br />
Note that an explicit <code>exit</code> statement is not needed here; since the only pattern is <code>BEGIN</code>, no command-line arguments are processed.<br />
<br />
=== Print lines longer than 80 characters ===<br />
<br />
Print all lines longer than 80 characters. Note that the default action is to print the current line.<br />
<source lang="awk"><br />
length($0) > 80<br />
</source><br />
<br />
=== Print a count of words ===<br />
<br />
Count words in the input and print the number of lines, words, and characters (like [[wc (Unix)|wc]]):<br />
<source lang="awk"><br />
{<br />
w += NF<br />
c += length + 1<br />
}<br />
END { print NR, w, c }<br />
</source><br />
<br />
As there is no pattern for the first line of the program, every line of input matches by default, so the increment actions are executed for every line. Note that <code>w += NF</code> is shorthand for <code>w = w + NF</code>.<br />
<br />
=== Sum last word ===<br />
<br />
<source lang="awk"><br />
{ s += $NF }<br />
END { print s + 0 }<br />
</source><br />
<br />
''s'' is incremented by the numeric value of ''$NF'', which is the last word on the line as defined by AWK's field separator (by default, white-space). ''NF'' is the number of fields in the current line, e.g. 4. Since ''$4'' is the value of the fourth field, ''$NF'' is the value of the last field in the line regardless of how many fields this line has, or whether it has more or fewer fields than surrounding lines. $ is actually a unary operator with the highest [[operator precedence]]. (If the line has no fields, then ''NF'' is 0, ''$0'' is the whole line, which in this case is empty apart from possible white-space, and so has the numeric value 0.)<br />
<br />
At the end of the input the ''END'' pattern matches, so ''s'' is printed. However, since there may have been no lines of input at all, in which case no value has ever been assigned to ''s'', it will by default be an empty string. Adding zero to a variable is an AWK idiom for coercing it from a string to a numeric value. (Concatenating an empty string is to coerce from a number to a string, e.g. ''s ""''. Note, there's no operator to concatenate strings, they're just placed adjacently.) With the coercion the program prints "0" on an empty input, without it an empty line is printed.<br />
<br />
=== Match a range of input lines ===<br />
<source lang="awk"><br />
NR % 4 == 1, NR % 4 == 3 { printf "%6d %s\n", NR, $0 }<br />
</source><br />
The action statement prints each line numbered. The printf function emulates the standard C [[printf]] and works similarly to the print command described above. The pattern to match, however, works as follows: ''NR'' is the number of records, typically lines of input, AWK has so far read, i.e. the current line number, starting at 1 for the first line of input. ''%'' is the [[modulo operation|modulo]] operator. ''NR % 4 == 1'' is true for the 1st, 5th, 9th, etc., lines of input. Likewise, ''NR % 4 == 3'' is true for the 3rd, 7th, 11th, etc., lines of input. The range pattern is false until the first part matches, on line 1, and then remains true up to and including when the second part matches, on line 3. It then stays false until the first part matches again on line 5.<br />
<br />
The first part of a range pattern being constantly true, e.g. ''1'', can be used to start the range at the beginning of input. Similarly, if the second part is constantly false, e.g. ''0'', the range continues until the end of input. For example,<br />
<source lang="awk"><br />
/^--cut here--$/, 0<br />
</source><br />
prints lines of input from the first line matching the regular expression ''^--cut here--$'', that is, a line containing only the phrase "--cut here--", to the end.<br />
<br />
=== Calculate word frequencies ===<br />
<br />
[[Word frequency]] using [[associative array]]s:<br />
<source lang="awk"><br />
BEGIN {<br />
FS="[^a-zA-Z]+"<br />
}<br />
{<br />
for (i=1; i<=NF; i++)<br />
words[tolower($i)]++<br />
}<br />
END {<br />
for (i in words)<br />
print i, words[i]<br />
}<br />
</source><br />
<br />
The BEGIN block sets the field separator to any sequence of non-alphabetic characters. Note that separators can be regular expressions. After that, we get to a bare action, which performs the action on every input line. In this case, for every field on the line, we add one to the number of times that word, first converted to lowercase, appears. Finally, in the END block, we print the words with their frequencies. The line<br />
for (i in words)<br />
creates a loop that goes through the array ''words'', setting ''i'' to each ''subscript'' of the array. This is different from most languages, where such a loop goes through each ''value'' in the array. The loop thus prints out each word followed by its frequency count. <code>tolower</code> was an addition to the One True awk (see below) made after the book was published.<br />
<br />
=== Match pattern from command line ===<br />
<br />
This program can be represented in several ways. The first one uses the [[Bourne shell]] to make a shell script that does everything. It is the shortest of these methods:<br />
<source lang="bash"><br />
pattern="$1"<br />
shift<br />
awk '/'"$pattern"'/ { print FILENAME ":" $0 }' "$@"<br />
</source><br />
<br />
The <code>$pattern</code> in the awk command is not protected by single quotes so that the shell does expand the variable but it needs to be put in double quotes to properly handle patterns containing spaces. A pattern by itself in the usual way checks to see if the whole line (<code>$0</code>) matches. <code>FILENAME</code> contains the current filename. awk has no explicit concatenation operator; two adjacent strings concatenate them. <code>$0</code> expands to the original unchanged input line.<br />
<br />
There are alternate ways of writing this. This shell script accesses the environment directly from within awk:<br />
<source lang="bash"><br />
export pattern="$1"<br />
shift<br />
awk '$0 ~ ENVIRON["pattern"] { print FILENAME ":" $0 }' "$@"<br />
</source><br />
<br />
This is a shell script that uses <code>ENVIRON</code>, an array introduced in a newer version of the One True awk after the book was published. The subscript of <code>ENVIRON</code> is the name of an environment variable; its result is the variable's value. This is like the [[getenv]] function in various standard libraries and [[POSIX]]. The shell script makes an environment variable <code>pattern</code> containing the first argument, then drops that argument and has awk look for the pattern in each file.<br />
<br />
<code>~</code> checks to see if its left operand matches its right operand; <code>!~</code> is its inverse. Note that a regular expression is just a string and can be stored in variables.<br />
<br />
The next way uses command-line variable assignment, in which an argument to awk can be seen as an assignment to a variable:<br />
<source lang="bash"><br />
pattern="$1"<br />
shift<br />
awk '$0 ~ pattern { print FILENAME ":" $0 }' "pattern=$pattern" "$@"<br />
</source><br />
<br />
Or You can use the ''-v var=value'' command line option (e.g. ''awk -v pattern="$pattern" ...'').<br />
<br />
Finally, this is written in pure awk, without help from a shell or without the need to know too much about the implementation of the awk script (as the variable assignment on command line one does), but is a bit lengthy:<br />
<source lang="awk"><br />
BEGIN {<br />
pattern = ARGV[1]<br />
for (i = 1; i < ARGC; i++) # remove first argument<br />
ARGV[i] = ARGV[i + 1]<br />
ARGC--<br />
if (ARGC == 1) { # the pattern was the only thing, so force read from standard input (used by book)<br />
ARGC = 2<br />
ARGV[1] = "-"<br />
}<br />
}<br />
$0 ~ pattern { print FILENAME ":" $0 }<br />
</source><br />
<br />
The <code>BEGIN</code> is necessary not only to extract the first argument, but also to prevent it from being interpreted as a filename after the <code>BEGIN</code> block ends. <code>ARGC</code>, the number of arguments, is always guaranteed to be ≥1, as <code>ARGV[0]</code> is the name of the command that executed the script, most often the string <code>"awk"</code>. Also note that <code>ARGV[ARGC]</code> is the empty string, <code>""</code>. <code>#</code> initiates a comment that expands to the end of the line.<br />
<br />
Note the <code>if</code> block. awk only checks to see if it should read from standard input before it runs the command. This means that<br />
awk 'prog'<br />
only works because the fact that there are no filenames is only checked before <code>prog</code> is run! If you explicitly set <code>ARGC</code> to 1 so that there are no arguments, awk will simply quit because it feels there are no more input files. Therefore, you need to explicitly say to read from standard input with the special filename <code>-</code>.<br />
<br />
== Self-contained AWK scripts ==<br />
<br />
On Unix-like operating systems self-contained AWK scripts can be constructed using the "[[shebang (Unix)|shebang]]" syntax.<br />
<br />
For example, a script called <code>hello.awk</code> that prints the string ''Hello, world!'' may be built by creating a file named <code>hello.awk</code> containing the following lines:<br />
<source lang="awk"><br />
#!/usr/bin/awk -f<br />
BEGIN { print "Hello, world!" }<br />
</source><br />
<br />
The <code>-f</code> tells ''awk'' that the argument that follows is the file to read the AWK program from, which is the same flag that is used in sed. Both these programs default to executing a program given as a command-line argument, rather than a separate file – since they are often used for one-liners.<br />
<br />
== Versions and implementations ==<br />
<br />
AWK was originally written in 1977 and distributed with [[Version 7 Unix]].<br />
<br />
In 1985 its authors started expanding the language, most significantly by adding user-defined functions. The language is described in the book ''The AWK Programming Language'', published 1988, and its implementation was made available in releases of [[UNIX System V]]. To avoid confusion with the incompatible older version, this version was sometimes called "new awk" or ''nawk''. This implementation was released under a [[free software license]] in 1996 and is still maintained by Brian Kernighan (see external links below).<br />
<br />
Old versions of Unix, such as [[UNIX/32V]], included <code>awkcc</code>, which converted AWK to C. Kernighan wrote a program to turn awk into C++; its state is not known.<ref>[http://cm.bell-labs.com/cm/cs/who/bwk/awkc++.ps An AWK to C++ Translator]</ref><br />
<br />
* '''BWK awk''', also known as '''nawk''', refers to the version by [[Brian Kernighan]]. It has been dubbed the "One True AWK" because of the use of the term in association with the book that originally described the language and the fact that Kernighan was one of the original authors of AWK.<ref name = "AWK1">{{cite book | title= The AWK Programming Language |author1=Alfred V. Aho |author2=Brian W. Kernighan |author3=Peter J. Weinberger | year= 1988 | publisher= Addison-Wesley Publishing Company | location= | isbn= 9780201079814 | page= |url = https://books.google.com/books?id=53ueQgAACAAJ&dq=The+AWK+Programming+Language&hl=en&sa=X&ei=LXxXVfq0GMOSsAWrpoC4Bg&ved=0CCYQ6AEwAA | accessdate = 16 May 2015 }}</ref> FreeBSD refers to this version as ''one-true-awk''.<ref>[http://www.freebsd.org/cgi/cvsweb.cgi/src/contrib/one-true-awk/FREEBSD-upgrade?rev=1.9&content-type=text/x-cvsweb-markup FreeBSD's work log for importing BWK awk into FreeBSD's core], dated 2005-05-16, downloaded 2006-09-20</ref> This version also has features not in the book, such as <code>tolower</code> and <code>ENVIRON</code> that are explained above; see the FIXES file in the source archive for details. This version is used by e.g. [[FreeBSD]], [[NetBSD]], [[OpenBSD]] and [[OS X]].<br />
* '''gawk''' ([[GNU]] awk) is another free-software implementation and the only implementation that makes serious progress implementing [[internationalization and localization]] and TCP/IP networking. It was written before the original implementation became freely available. It includes its own debugger, and its [[profiling (computer programming)|profiler]] enables the user to make measured performance enhancements to a script. It also enables the user to extend functionality with shared libraries. [[Linux distribution]]s are mostly GNU software, and so they include ''gawk''. [[FreeBSD]] before version 5.0 also included ''gawk'' version 3.0, but subsequent versions of FreeBSD use ''BWK awk'' to avoid the [[BSD and GPL licensing|more restrictive]] [[GNU General Public License]] (GPL), as well as for its technical characteristics.<ref>[http://www.freebsd.org/doc/en_US.ISO8859-1/articles/bsdl-gpl/ FreeBSD's view of ''GPL Advantages and Disadvantages'']</ref><ref>[http://www.freebsd.org/releases/5.0R/relnotes-i386.html#USERLAND FreeBSD 5.0 release notes] with notice of ''BWK awk'' in the base distribution</ref><br />
* '''mawk''' is a very fast AWK implementation by Mike Brennan based on a [[bytecode]] interpreter.<br />
* '''libmawk''' is a fork of mawk, allowing applications to embed multiple parallel instances of awk interpreters.<br />
* '''awka''' (whose front end is written atop the ''mawk'' program) is another translator of AWK scripts into C code. When compiled, statically including the author's libawka.a, the resulting executables are considerably sped up and, according to the author's tests, compare very well with other versions of AWK, [[Perl]], or [[Tcl]]. Small scripts will turn into programs of 160–170 kB.<br />
* '''tawk''' (Thompson AWK) is an AWK [[compiler]] for [[Solaris (operating system)|Solaris]], [[DOS]], [[OS/2]], and [[Microsoft Windows|Windows]], previously sold by Thompson Automation Software (which has ceased its activities).<br />
* '''Jawk''' is a project to implement AWK in [[Java (programming language)|Java]], hosted on SourceForge.<ref>[http://sourceforge.net/projects/jawk/ ''Jawk'' at SourceForge]</ref> Extensions to the language are added to provide access to Java features within AWK scripts (i.e., Java threads, sockets, collections, etc.).<br />
* '''xgawk''' is a fork of ''gawk''<ref>[http://gawkextlib.sourceforge.net/ ''xgawk'' Home Page]</ref> that extends ''gawk'' with dynamically loadable libraries. The XMLgawk extension was integrated into the official GNU Awk release 4.1.0.<br />
* '''QSEAWK''' is an embedded AWK interpreter implementation included in the QSE library that provides embedding [[application programming interface]] (API) for [[C (programming language)|C]] and [[C++]].<ref>[http://qse.googlecode.com/ QSEAWK at Google Code]</ref><br />
* '''[[BusyBox]]''' includes an AWK implementation written by Dmitry Zakharov. This is a very small implementation suitable for embedded systems.<br />
<br />
== Books ==<br />
<br />
* {{cite book<br />
| last1 = Aho<br />
| first1 = Alfred V.<br />
| authorlink1 = Alfred Aho<br />
| last2 = Kernighan<br />
| first2 = Brian W.<br />
| authorlink2 = Brian Kernighan<br />
| last3 = Weinberger<br />
| first3 = Peter J.<br />
| authorlink3 = Peter J. Weinberger<br />
| title = The AWK Programming Language<br />
| url = http://cm.bell-labs.com/cm/cs/awkbook/<br />
| accessdate = 2009-04-16<br />
| date = 1988-01-01<br />
| publisher = [[Addison-Wesley]]<br />
| location = New York, NY<br />
| isbn = 0-201-07981-X<br />
}} ''The book's webpage includes downloads of the current implementation of Awk and links to others.''<br />
* {{cite book<br />
| last1 = Robbins<br />
| first1 = Arnold<br />
| authorlink1 =<br />
| title = Effective awk Programming<br />
| url = http://www.oreilly.com/catalog/awkprog3/<br />
| accessdate = 2009-04-16<br />
| edition = 3rd<br />
| date = 2001-05-15<br />
| publisher = [[O'Reilly Media]]<br />
| location = Sebastopol, CA<br />
| isbn = 0-596-00070-7<br />
}}<br />
* {{cite book<br />
| last1 = Dougherty<br />
| first1 = Dale<br />
| authorlink1 = Dale Dougherty<br />
| last2 = Robbins<br />
| first2 = Arnold<br />
| authorlink2 =<br />
| title = sed & awk<br />
| url = http://www.oreilly.com/catalog/sed2/<br />
| accessdate = 2009-04-16<br />
| edition = 2nd<br />
| date = 1997-03-01<br />
| publisher = O'Reilly Media<br />
| location = Sebastopol, CA<br />
| isbn = 1-56592-225-5<br />
}}<br />
* {{cite book<br />
| last1 = Robbins<br />
| first1 = Arnold<br />
| authorlink1 =<br />
| title = Effective Awk Programming: A User's Guide for Gnu Awk<br />
| url = https://www.gnu.org/software/gawk/manual/<br />
| accessdate = 2009-04-16<br />
| edition = 1.0.3<br />
| year = 2000<br />
| publisher = [[iUniverse]]<br />
| location = Bloomington, IN<br />
| isbn = 0-595-10034-1<br />
| archiveurl= https://web.archive.org/web/20090412190359/https://www.gnu.org/software/gawk/manual/| archivedate= 12 April 2009 <!--DASHBot-->| deadurl= no}} ''Arnold Robbins maintained the GNU Awk implementation of AWK for more than 10 years. The free GNU Awk manual was also published by O'Reilly in May 2001. Free download of this manual is possible through the following book references.''<br />
<br />
== See also ==<br />
<br />
* [[Data transformation]]<br />
* [[Event-driven programming]]<br />
* [[List of Unix commands]]<br />
* [[Procedural programming]]<br />
* [[sed]]<br />
<br />
== References ==<br />
<br />
{{reflist|30em}}<br />
<br />
== Further reading ==<br />
<br />
* {{cite web<br />
| url = http://www.computerworld.com.au/article/216844<br />
| title = The A-Z of Programming Languages: AWK<br />
| accessdate = 2009-04-16<br />
| last = Hamilton<br />
| first = Naomi<br />
| date = 2008-05-27<br />
| publisher = [[Computerworld]]<br />
}}&nbsp;– Interview with Alfred V. Aho on AWK<br />
* {{cite web<br />
| url = http://www.ibm.com/developerworks/library/l-awk1/<br />
| title = Awk by example, Part 1: An intro to the great language with the strange name<br />
| accessdate = 2009-04-16<br />
| last = Robbins<br />
| first = Daniel<br />
| authorlink = Daniel Robbins (computer programmer)<br />
| date = 2000-12-01<br />
| work = Common threads<br />
| publisher = [[IBM DeveloperWorks]]<br />
}}<br />
* {{cite web<br />
| url = http://www.ibm.com/developerworks/library/l-awk2/<br />
| title = Awk by example, Part 2: Records, loops, and arrays<br />
| accessdate = 2009-04-16<br />
| last = Robbins<br />
| first = Daniel<br />
| date = 2001-01-01<br />
| work = Common threads<br />
| publisher = IBM DeveloperWorks<br />
}}<br />
* {{cite web<br />
| url = http://www.ibm.com/developerworks/library/l-awk3/<br />
| title = Awk by example, Part 3: String functions and ... checkbooks?<br />
| accessdate = 2009-04-16<br />
| last = Robbins<br />
| first = Daniel<br />
| date = 2001-04-01<br />
| work = Common threads<br />
| publisher = IBM DeveloperWorks<br />
| archiveurl= https://web.archive.org/web/20090519074032/http://www.ibm.com/developerworks/linux/library/l-awk3.html| archivedate= 19 May 2009 <!--DASHBot-->| deadurl= no}}<br />
* [http://www.think-lamp.com/2008/10/awk-a-boon-for-cli-enthusiasts/ AWK &nbsp;– Become an expert in 60 minutes]<br />
* {{man|cu|awk|SUS|pattern scanning and processing language}}<br />
* {{man|1|gawk|Linux}}<br />
* [https://www.gnu.org/software/gawk/manual/gawkinet/ Gawkinet]: TCP/IP Internetworking with Gawk<br />
<br />
== External links ==<br />
<br />
{{Wikibooks|An Awk Primer}}<br />
* [http://doc.cat-v.org/henry_spencer/amazing_awk_assembler/ The Amazing Awk Assembler] by [[Henry Spencer]].<br />
* [http://awk.info/ Awk Community Portal]<br />
* [http://en.flossmanuals.net/command-line/ch044_awk Awk on flossmanuals.net]<br />
* {{Dmoz|Computers/Programming/Languages/Awk}}<br />
* [https://github.com/danfuzz/one-true-awk Git repository of the direct lineage of the original AWK source code]<br />
<br />
{{unix commands}}<br />
<br />
{{DEFAULTSORT:Awk}}<br />
[[Category:Pattern matching programming languages]]<br />
[[Category:Scripting languages]]<br />
[[Category:Text-oriented programming languages]]<br />
[[Category:Free compilers and interpreters]]<br />
[[Category:Unix text processing utilities]]<br />
[[Category:Standard Unix programs]]<br />
[[Category:Unix SUS2008 utilities]]<br />
[[Category:Cross-platform software]]<br />
[[Category:1977 software]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Metaobject&diff=718945631Metaobject2016-05-06T16:26:02Z<p>PuercoPop: /* Runtime and compile time */ Change wording to remove false claim that initial implementations of MOP where on interpreted implementations</p>
<hr />
<div>In [[computer science]], a '''metaobject''' is an [[Object (computer science)|object]] that manipulates, creates, describes, or implements other objects (including itself). The object that the metaobject is about is called the base object. Some information that a metaobject might store is the base object's [[Type system|type]], [[Interface (computer science)|interface]], [[class (computer science)|class]], [[method (computer science)|method]]s, [[Attribute (computing)|attributes]], [[parse tree]], etc. Metaobjects are examples of the computer science concept of [[Reflection (computer programming)|reflection]], where a system has access (usually at run time) to its internal structure. Reflection enables a system to essentially rewrite itself on the fly, to change the actual structure of the system as it executes.<ref>{{cite journal|last=Smith|first=Brian C|title=PROCEDURAL REFLECTION IN PROGRAMMING LANGUAGES|journal=MIT Technical Report|date=1982-01-01|issue=MIT-LCS-TR-272|url=http://publications.csail.mit.edu/lcs/specpub.php?id=840|accessdate=16 December 2013}}</ref><br />
<br />
== Metaobject protocol ==<br />
A '''metaobject protocol''' (MOP) provides the vocabulary to access and manipulate the structure and behavior of objects. Typical functions of a metaobject protocol include:<ref>{{cite journal|last=Foote|first=Brian|author2=Ralph Johnson|title=Reflective Facilities in Smalltalk-80|journal=OOPSLA '89|date=1–6 October 1989|url=http://www.laputan.org/ref89/ref89.html|accessdate=16 December 2013}}</ref><br />
*Creating and deleting new classes<br />
*Creating new methods and properties<br />
*Changing the class structure so that classes inherit from different classes<br />
*Generating or modifying the code that defines the methods for the class<br />
<br />
The metaobject protocol is contrary to the "closed" aspect of Bertrand Meyer's [[open/closed principle]]. It reveals and allows a system to modify the internal structure of the objects. For this reason it is usually used sparingly and for special circumstances such as software that transforms other software, for example for reverse engineering.<ref>{{cite book|last=Favre|first=Lilliana|title=MDA-Based Reverse Engineering of Object Oriented Code|year=2009|publisher=Springer|isbn=978-3-642-01861-9|url=http://link.springer.com/chapter/10.1007%2F978-3-642-01862-6_21|author2=Liliana Martinez |author3=Claudia Pereira }}</ref><br />
<br />
=== Runtime and compile time ===<br />
When compilation is not available at run-time there are additional complications for the implementation of metaobject protocol. For example, it is possible to change the type hierarchy with such a protocol but doing so may cause problems for code compiled with an alternative class model definition. Some environments have found innovative solutions for this, e.g., by handling metaobject issues at compile time. A good example is the product [[OpenC++ (software tool)|OpenC++]].<ref>{{cite journal|last=Chiba|first=Shigeru|title=A Metaobject Protocol for C++|journal=OOPSLA '95|year=1995|url=http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.15.7049|accessdate=27 December 2013}}</ref><br />
<br />
It is noteworthy that the Semantic web object-oriented model is more dynamic and consistent with run time metaobject protocols. For example, in the Semantic web model classes are expected to change their relations to each other and there is a special [[inference engine]] known as a classifier that can validate and analyze evolving class models.<ref>{{cite web|url=http://www.w3.org/2001/sw/BestPractices/SE/ODSD/|title=A Semantic Web Primer for Object-Oriented Software Developers|last1=Knublauch|first1=Holger|last2=Oberle|first2=Daniel|last3=Tetlow|first3=Phil|last4=Wallace|first4=Evan|publisher=[[W3C]]|date=2006-03-09|accessdate=2008-07-30}}</ref><br />
<br />
=== Usage ===<br />
The first metaobject protocol was in the [[Smalltalk]] object-oriented programming language developed at [[Xerox PARC]]. The [[Common Lisp Object System]] (CLOS) came later and was influenced by the Smalltalk protocol. The CLOS model, unlike the Smalltalk model, allowed a class to have more than one superclass. This provides additional complexity in issues such as resolving which class has responsibility for handling messages defined on two different superclasses. One of the most influential books describing the metaobject protocol in CLOS was ''[[The Art of the Metaobject Protocol]]'' by [[Gregor Kiczales]].<ref>{{cite book|last=Kiczales|first=Gregor|title=The Art of the Metaobject Protocol|publisher=The MIT Press|isbn=978-0262610742|author2=Jim des Rivieres |author3=Daniel G. Bobrow |date=July 30, 1991}}</ref><br />
<br />
Metaobject protocols were also extensively used in software engineering applications. In virtually all commercial CASE, reengineering, and Integrated Development Environments there is some form of metaobject protocol to represent and manipulate the design artifacts.<ref>{{cite journal|last=Johnson|first=Lewis|author2=David R. Harris |author3=Kevin M. Benner |author4=Martin S. Feather |title=Aries: The Requirements/Specification Facet for KBSA|journal=Rome Laboratory Final Technical Report|date=October 1992|volume=RL-TR-92-248}}</ref><ref>{{cite web|title=The Origin of Refine|url=http://www.metaware.fr/images/pdf/1_Metaware_The_Origin%20of_Refine_Whitepaper.pdf|work=www.metaware.fr|publisher=Metaware White Paper|accessdate=6 January 2014}}</ref><ref>{{cite web|title=OMG's MetaObject Facility|url=http://www.omg.org/mof/|work=omg.org|publisher=Object Management Group|accessdate=7 January 2014|archivedate=2013-04-16}}</ref><br />
<br />
A metaobject protocol is one way to implement [[aspect-oriented programming]] languages. Many of the early founders of MOPs, including [[Gregor Kiczales]] have since moved on to be the primary advocates for aspect-oriented programming.<br />
<br />
==See also==<br />
*[[Kind (type theory)]]<br />
*[[Metaclass]]<br />
*[[Javassist]]<br />
*[[Joose (framework)|Joose JavaScript meta object system]]<br />
*[[Moose (Perl)|Moose Perl meta object system]]<br />
*[[OpenC++ (software tool)|OpenC++]]<br />
*[[OpenJava]]<br />
*[[Unified Modeling Language]]: UML<br />
*[[Groovy (programming language)|Groovy]]<br />
<br />
==References==<br />
{{Reflist}}<br />
<br />
==External links==<br />
* [http://www.gnu.org/software/guile/docs/goops/MOP-Specification.html#MOP%20Specification The Guile MOP specification (GOOPS, based on Tiny CLOS)]<br />
* [http://www.gnu.org/software/guile/docs/goops/Metaobjects-and-the-Metaobject-Protocol.html Metaobjects and the Metaobject Protocol]<br />
* [http://www.lisp.org/mop/index.html The Common Lisp Object System MetaObject Protocol] (contains two chapters from ''The Art of the Metaobject Protocol'')<br />
* [http://python-3-patterns-idioms-test.readthedocs.org/en/latest/Metaprogramming.html Python 3 Metaprogramming]<br />
<br />
{{Data types}}<br />
<br />
[[Category:Object (computer science)]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Metaobject&diff=718938019Metaobject2016-05-06T15:24:03Z<p>PuercoPop: /* Runtime and compile time */</p>
<hr />
<div>In [[computer science]], a '''metaobject''' is an [[Object (computer science)|object]] that manipulates, creates, describes, or implements other objects (including itself). The object that the metaobject is about is called the base object. Some information that a metaobject might store is the base object's [[Type system|type]], [[Interface (computer science)|interface]], [[class (computer science)|class]], [[method (computer science)|method]]s, [[Attribute (computing)|attributes]], [[parse tree]], etc. Metaobjects are examples of the computer science concept of [[Reflection (computer programming)|reflection]], where a system has access (usually at run time) to its internal structure. Reflection enables a system to essentially rewrite itself on the fly, to change the actual structure of the system as it executes.<ref>{{cite journal|last=Smith|first=Brian C|title=PROCEDURAL REFLECTION IN PROGRAMMING LANGUAGES|journal=MIT Technical Report|date=1982-01-01|issue=MIT-LCS-TR-272|url=http://publications.csail.mit.edu/lcs/specpub.php?id=840|accessdate=16 December 2013}}</ref><br />
<br />
== Metaobject protocol ==<br />
A '''metaobject protocol''' (MOP) provides the vocabulary to access and manipulate the structure and behavior of objects. Typical functions of a metaobject protocol include:<ref>{{cite journal|last=Foote|first=Brian|author2=Ralph Johnson|title=Reflective Facilities in Smalltalk-80|journal=OOPSLA '89|date=1–6 October 1989|url=http://www.laputan.org/ref89/ref89.html|accessdate=16 December 2013}}</ref><br />
*Creating and deleting new classes<br />
*Creating new methods and properties<br />
*Changing the class structure so that classes inherit from different classes<br />
*Generating or modifying the code that defines the methods for the class<br />
<br />
The metaobject protocol is contrary to the "closed" aspect of Bertrand Meyer's [[open/closed principle]]. It reveals and allows a system to modify the internal structure of the objects. For this reason it is usually used sparingly and for special circumstances such as software that transforms other software, for example for reverse engineering.<ref>{{cite book|last=Favre|first=Lilliana|title=MDA-Based Reverse Engineering of Object Oriented Code|year=2009|publisher=Springer|isbn=978-3-642-01861-9|url=http://link.springer.com/chapter/10.1007%2F978-3-642-01862-6_21|author2=Liliana Martinez |author3=Claudia Pereira }}</ref><br />
<br />
=== Runtime and compile time ===<br />
The original object-oriented languages with metaobject capabilities (e.g., Smalltalk and CLOS) were in interpreted environments so compilation was not an issue{{citation needed}}. Compilation brings additional complications for a metaobject protocol. For example, it is possible to change the type hierarchy with such a protocol but doing so may cause problems for code compiled with an alternative class model definition. Some environments have found innovative solutions for this, e.g., by handling metaobject issues at compile time. A good example is the product [[OpenC++ (software tool)|OpenC++]].<ref>{{cite journal|last=Chiba|first=Shigeru|title=A Metaobject Protocol for C++|journal=OOPSLA '95|year=1995|url=http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.15.7049|accessdate=27 December 2013}}</ref><br />
<br />
It is noteworthy that the Semantic web object-oriented model is more dynamic and consistent with run time metaobject protocols. For example, in the Semantic web model classes are expected to change their relations to each other and there is a special [[inference engine]] known as a classifier that can validate and analyze evolving class models.<ref>{{cite web|url=http://www.w3.org/2001/sw/BestPractices/SE/ODSD/|title=A Semantic Web Primer for Object-Oriented Software Developers|last1=Knublauch|first1=Holger|last2=Oberle|first2=Daniel|last3=Tetlow|first3=Phil|last4=Wallace|first4=Evan|publisher=[[W3C]]|date=2006-03-09|accessdate=2008-07-30}}</ref><br />
<br />
=== Usage ===<br />
The first metaobject protocol was in the [[Smalltalk]] object-oriented programming language developed at [[Xerox PARC]]. The [[Common Lisp Object System]] (CLOS) came later and was influenced by the Smalltalk protocol. The CLOS model, unlike the Smalltalk model, allowed a class to have more than one superclass. This provides additional complexity in issues such as resolving which class has responsibility for handling messages defined on two different superclasses. One of the most influential books describing the metaobject protocol in CLOS was ''[[The Art of the Metaobject Protocol]]'' by [[Gregor Kiczales]].<ref>{{cite book|last=Kiczales|first=Gregor|title=The Art of the Metaobject Protocol|publisher=The MIT Press|isbn=978-0262610742|author2=Jim des Rivieres |author3=Daniel G. Bobrow |date=July 30, 1991}}</ref><br />
<br />
Metaobject protocols were also extensively used in software engineering applications. In virtually all commercial CASE, reengineering, and Integrated Development Environments there is some form of metaobject protocol to represent and manipulate the design artifacts.<ref>{{cite journal|last=Johnson|first=Lewis|author2=David R. Harris |author3=Kevin M. Benner |author4=Martin S. Feather |title=Aries: The Requirements/Specification Facet for KBSA|journal=Rome Laboratory Final Technical Report|date=October 1992|volume=RL-TR-92-248}}</ref><ref>{{cite web|title=The Origin of Refine|url=http://www.metaware.fr/images/pdf/1_Metaware_The_Origin%20of_Refine_Whitepaper.pdf|work=www.metaware.fr|publisher=Metaware White Paper|accessdate=6 January 2014}}</ref><ref>{{cite web|title=OMG's MetaObject Facility|url=http://www.omg.org/mof/|work=omg.org|publisher=Object Management Group|accessdate=7 January 2014|archivedate=2013-04-16}}</ref><br />
<br />
A metaobject protocol is one way to implement [[aspect-oriented programming]] languages. Many of the early founders of MOPs, including [[Gregor Kiczales]] have since moved on to be the primary advocates for aspect-oriented programming.<br />
<br />
==See also==<br />
*[[Kind (type theory)]]<br />
*[[Metaclass]]<br />
*[[Javassist]]<br />
*[[Joose (framework)|Joose JavaScript meta object system]]<br />
*[[Moose (Perl)|Moose Perl meta object system]]<br />
*[[OpenC++ (software tool)|OpenC++]]<br />
*[[OpenJava]]<br />
*[[Unified Modeling Language]]: UML<br />
*[[Groovy (programming language)|Groovy]]<br />
<br />
==References==<br />
{{Reflist}}<br />
<br />
==External links==<br />
* [http://www.gnu.org/software/guile/docs/goops/MOP-Specification.html#MOP%20Specification The Guile MOP specification (GOOPS, based on Tiny CLOS)]<br />
* [http://www.gnu.org/software/guile/docs/goops/Metaobjects-and-the-Metaobject-Protocol.html Metaobjects and the Metaobject Protocol]<br />
* [http://www.lisp.org/mop/index.html The Common Lisp Object System MetaObject Protocol] (contains two chapters from ''The Art of the Metaobject Protocol'')<br />
* [http://python-3-patterns-idioms-test.readthedocs.org/en/latest/Metaprogramming.html Python 3 Metaprogramming]<br />
<br />
{{Data types}}<br />
<br />
[[Category:Object (computer science)]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Reflective_programming&diff=714459336Reflective programming2016-04-09T21:56:13Z<p>PuercoPop: Remove left over closing parenthesis</p>
<hr />
<div>In [[computer science]], '''reflection''' is the ability of a [[computer program]] to examine, [[ Introspection_(computer_science) |Introspection]], and modify its own structure and behavior, intercession.<ref>[http://www2.parc.com/csl/groups/sda/projects/reflection96/docs/malenfant/malenfant.pdf A Tutorial on Behavioral Reflection and its Implementation by Jacques Malenfant et al.]</ref><br />
<br />
==Historical background==<br />
<br />
The earliest computers were programmed in their native [[assembly language]], which were inherently reflective as these original architectures could be programmed by defining instructions as data and using [[self-modifying code]]. As programming moved to higher-level languages such as C, this reflective ability disappeared (outside of [[malware]]) until programming languages with reflection built into their type systems appeared.{{Citation needed|date=July 2015}} <br />
<br />
[[Brian Cantwell Smith]]'s 1982 doctoral dissertation<ref>[http://hdl.handle.net/1721.1/15961 Brian Cantwell Smith, Procedural Reflection in Programming Languages, Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, PhD Thesis, 1982.]</ref><ref>[http://publications.csail.mit.edu/lcs/specpub.php?id=840 Brian C. Smith. Reflection and semantics in a procedural language. Technical Report MIT-LCS-TR-272, Massachusetts Institute of Technology, Cambridge, Mass., January 1982.]</ref> introduced the notion of computational reflection in [[programming languages]], and the notion of the [[meta-circular interpreter]] as a component of [[3-Lisp]].<br />
<br />
==Uses==<br />
<br />
Reflection can be used for observing and modifying program execution at runtime. A reflection-oriented program component can monitor the execution of an enclosure of code and can modify itself according to a desired goal related to that enclosure. This is typically accomplished by dynamically assigning program code at runtime.<br />
<br />
In object oriented programming languages such as [[Java (programming language)|Java]], reflection allows ''inspection'' of classes, interfaces, fields and methods at runtime without knowing the names of the interfaces, fields, methods at compile time. It also allows ''instantiation'' of new objects and ''invocation'' of methods.<br />
<br />
Reflection can be used to adapt a given program to different situations dynamically. Reflection-oriented programming almost always requires additional knowledge, framework, relational mapping, and object relevance in order to take advantage of more generic code execution.<br />
<br />
Reflection is often used as part of [[software testing]], such as for the runtime creation/instantiation of [[mock object]]s.<br />
<br />
Reflection is also a key strategy for [[metaprogramming]].<br />
<br />
In some object-oriented programming languages, such as [[C Sharp (programming language)|C#]] and [[Java (programming language)|Java]], reflection can be used to override [[member accessibility]] rules. For example, reflection makes it possible to change the value of a field marked "private" in a third-party library's class.<br />
<br />
==Implementation==<br />
{{Unreferenced section|date=January 2008}}<br />
A language supporting reflection provides a number of features available at runtime that would otherwise be difficult to accomplish in a lower-level language. Some of these features are the abilities to:<br />
<br />
*Discover and modify source code constructions (such as code blocks, [[Class (computer science)|classes]], methods, protocols, etc.) as a [[first-class object]] at runtime.<br />
*Convert a [[string (computer science)|string]] matching the symbolic name of a class or function into a reference to or invocation of that class or function.<br />
*Evaluate a string as if it were a source code statement at runtime.<br />
*Create a new interpreter for the language's bytecode to give a new meaning or purpose for a programming construct.<br />
<br />
These features can be implemented in different ways. In [[MOO (programming language)|MOO]], reflection forms a natural part of everyday programming idiom. When verbs (methods) are called, various variables such as ''verb'' (the name of the verb being called) and ''this'' (the object on which the verb is called) are populated to give the context of the call. Security is typically managed by accessing the caller stack programmatically: Since ''callers()'' is a list of the methods by which the current verb was eventually called, performing tests on callers()[1] (the command invoked by the original user) allows the verb to protect itself against unauthorised use.<br />
<br />
Compiled languages rely on their runtime system to provide information about the source code. A compiled [[Objective-C]] executable, for example, records the names of all methods in a block of the executable, providing a table to correspond these with the underlying methods (or [[selector]]s for these methods) compiled into the program. In a compiled language that supports runtime creation of functions, such as [[Common Lisp]], the runtime environment must include a compiler or an interpreter.<br />
<br />
Reflection can be implemented for languages not having built-in reflection facilities by using a [[program transformation]] system to define automated source code changes.<br />
<br />
==Examples==<br />
The following code snippets create an [[instance (computer science)|instance]] <code>foo</code> of [[class (computer science)|class]] <code>Foo</code>, and invoke its [[method (computer science)|method]] <code>hello</code>. For each [[programming language]], normal and reflection-based call sequences are shown.<br />
<br />
===eC===<br />
The following is an example in [[eC (programming language)|eC]]:<br />
<source lang="ec">// without reflection<br />
Foo foo { };<br />
foo.hello();<br />
<br />
// with reflection<br />
Class fooClass = eSystem_FindClass(__thisModule, "Foo");<br />
Instance foo = eInstance_New(fooClass);<br />
Method m = eClass_FindMethod(fooClass, "hello", fooClass.module);<br />
((void (*)())(void *)m.function)(foo);</source><br />
<br />
===ECMAScript===<br />
The following is an example in [[ECMAScript]], and therefore also applies to [[JavaScript]] and [[ActionScript]]:<br />
<source lang="ecmascript"><br />
// Without reflection<br />
new Foo().hello()<br />
<br />
// With reflection<br />
<br />
// assuming that Foo resides in this<br />
new this['Foo']()['hello']()<br />
<br />
// or without assumption<br />
new (eval('Foo'))()['hello']()<br />
<br />
// or simply<br />
eval('new Foo().hello()')<br />
<br />
// Using ECMAScript 2015's new Reflect class:<br />
Reflect.construct(Foo, [])['hello']()<br />
</source><br />
<br />
===Go===<br />
<br />
The following is an example in [[Go (programming language)|Go]]:<br />
<br />
<source lang="go"><br />
import "reflect"<br />
<br />
// without reflection<br />
f := Foo{}<br />
f.Hello()<br />
<br />
// with reflection<br />
fT := reflect.TypeOf(Foo{})<br />
fV := reflect.New(fT)<br />
<br />
m := fV.MethodByName("Hello")<br />
if m.IsValid() {<br />
m.Call(nil)<br />
}<br />
</source><br />
<br />
===Java===<br />
The following is an example in [[Java (programming language)|Java]]:<br />
<source lang="java"><br />
<br />
// without reflection<br />
Foo foo = new Foo();<br />
foo.hello();<br />
<br />
// with reflection<br />
Object foo = Class.forName("complete.classpath.and.Foo").newInstance();<br />
// Alternatively: Object foo = Foo.class.newInstance();<br />
Method m = foo.getClass().getDeclaredMethod("hello", new Class<?>[0]);<br />
m.invoke(foo);<br />
<br />
</source><br />
<br />
===Objective-C===<br />
The following is an example in [[Objective-C]]—implying either the [[OpenStep]] or [[Foundation Kit]] framework is used:<br />
<source lang="objc"><br />
// Foo class.<br />
@interface Foo : NSObject<br />
- (void)hello;<br />
@end<br />
<br />
// Sending "hello" to a Foo instance without reflection.<br />
Foo *obj = [[Foo alloc] init];<br />
[obj hello];<br />
<br />
// Sending "hello" to a Foo instance with reflection.<br />
id obj = [[NSClassFromString(@"Foo") alloc] init];<br />
[obj performSelector: @selector(hello)];<br />
<br />
</source><br />
<br />
===Delphi===<br />
<br />
This [[Embarcadero Delphi|Delphi]] example assumes a TFoo class has been declared in a unit called Unit1:<br />
<source lang="Delphi"><br />
uses RTTI, Unit1;<br />
<br />
procedure WithoutReflection;<br />
var<br />
Foo: TFoo;<br />
begin<br />
Foo := TFoo.Create;<br />
try<br />
Foo.Hello;<br />
finally<br />
Foo.Free;<br />
end;<br />
end;<br />
<br />
procedure WithReflection;<br />
var<br />
RttiContext: TRttiContext;<br />
RttiType: TRttiInstanceType;<br />
Foo: TObject;<br />
begin<br />
RttiType := RttiContext.FindType('Unit1.TFoo') as TRttiInstanceType;<br />
Foo := RttiType.GetMethod('Create').Invoke(RttiType.MetaclassType, []).AsObject;<br />
try<br />
RttiType.GetMethod('Hello').Invoke(Foo, []);<br />
finally<br />
Foo.Free;<br />
end;<br />
end;<br />
</source><br />
<br />
This is a notable example since Delphi is an unmanaged, fully natively compiled language, unlike most other languages that support reflection. Its language architecture inherits from strongly-typed Pascal, but with significant influence from SmallTalk. Compare with the other examples here, many of which are dynamic or script languages like Perl, Python or PHP, or languages with a runtime like Java or C#.<br />
<br />
===Perl===<br />
The following is an example in [[Perl (programming language)|Perl]]:<br />
<br />
<syntaxhighlight lang=perl><br />
<br />
# without reflection<br />
my $foo = Foo->new;<br />
$foo->hello;<br />
<br />
# or<br />
Foo->new->hello;<br />
<br />
# with reflection<br />
my $class = "Foo"<br />
my $constructor = "new";<br />
my $method = "hello";<br />
<br />
my $f = $class->$constructor;<br />
$f->$method;<br />
<br />
# or<br />
$class->$constructor->$method;<br />
<br />
# with eval<br />
eval "new Foo->hello;";<br />
<br />
</syntaxhighlight><br />
<br />
===PHP===<br />
The following is an example in [[PHP]]:<br />
<syntaxhighlight lang=php><br />
// without reflection<br />
$foo = new Foo();<br />
$foo->hello();<br />
<br />
// with reflection<br />
$reflector = new ReflectionClass('Foo');<br />
$foo = $reflector->newInstance();<br />
$hello = $reflector->getMethod('hello');<br />
$hello->invoke($foo);<br />
<br />
// using callback<br />
$foo = new Foo();<br />
call_user_func(array($foo, 'hello'));<br />
<br />
// using variable variables syntax<br />
$className = 'Foo';<br />
$foo = new $className();<br />
$method = 'hello';<br />
$foo->$method();<br />
</syntaxhighlight><br />
<br />
===Python===<br />
The following is an example in [[Python (programming language)|Python]]:<br />
<syntaxhighlight lang=python><br />
<br />
# without reflection<br />
obj = Foo()<br />
obj.hello()<br />
<br />
# with reflection<br />
class_name = "Foo"<br />
method = "hello"<br />
obj = globals()[class_name]()<br />
getattr(obj, method)()<br />
<br />
# with eval<br />
eval("Foo().hello()")<br />
<br />
</syntaxhighlight><br />
<br />
===R===<br />
The following is an example in [[R (programming language)|R]]:<br />
<source lang="rsplus"><br />
# Without reflection, assuming foo() returns an S3-type object that has method "hello"<br />
obj <- foo()<br />
hello(obj)<br />
<br />
# With reflection<br />
the.class <- "foo"<br />
the.method <- "hello"<br />
obj <- do.call(the.class, list())<br />
do.call(the.method, alist(obj))<br />
<br />
</source><br />
<br />
===Ruby===<br />
The following is an example in [[Ruby (Programming Language)|Ruby]]:<br />
<syntaxhighlight lang=ruby><br />
<br />
# without reflection<br />
obj = Foo.new<br />
obj.hello<br />
<br />
# with reflection<br />
class_name = "Foo"<br />
method_name = :hello<br />
obj = Object.const_get(class_name).new<br />
obj.send method_name<br />
<br />
# with eval<br />
eval "Foo.new.hello"<br />
<br />
</syntaxhighlight><br />
<br />
==See also==<br />
*[[Type introspection]]<br />
*[[Self-modifying code]]<br />
*[[Self-hosting]]<br />
*[[Programming paradigm]]s<br />
*[[List of reflective programming languages and platforms]]<br />
*[[Mirror (programming)]]<br />
<br />
==References==<br />
'''Notes'''<br />
{{reflist}}<br />
'''Documents'''<br />
* Jonathan M. Sobel and Daniel P. Friedman. [http://web.archive.org/web/20100204091328/http://www.cs.indiana.edu/~jsobel/rop.html ''An Introduction to Reflection-Oriented Programming''] (1996), Indiana University.<br />
<br />
==Further reading==<br />
* Ira R. Forman and Nate Forman, ''Java Reflection in Action'' (2005), ISBN 1-932394-18-4<br />
* Ira R. Forman and Scott Danforth, ''Putting Metaclasses to Work'' (1999), ISBN 0-201-43305-2<br />
<br />
==External links==<br />
*[https://www-master.ufr-info-p6.jussieu.fr/2007/Ajouts/Master_esj20_2007_2008/IMG/pdf/malenfant-ijcai95.pdf Reflection in logic, functional and object-oriented programming: a short comparative study]<br />
*[http://web.archive.org/web/20100204091328/http://www.cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]<br />
*[http://www.laputan.org/#Reflection Brian Foote's pages on Reflection in Smalltalk]<br />
*[http://docs.oracle.com/javase/tutorial/reflect/index.html Java Reflection API Tutorial] from Oracle<br />
{{Programming language}}<br />
<br />
{{DEFAULTSORT:Reflection (Computer Programming)}}<br />
[[ Category:Programming constructs]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Reflective_programming&diff=714457093Reflective programming2016-04-09T21:38:39Z<p>PuercoPop: Better sumarize the two properties of reflection, introspection and intercession.</p>
<hr />
<div>In [[computer science]], '''reflection''' is the ability of a [[computer program]] to examine, [[ Introspection_(computer_science) |Introspection]]), and modify its own structure and behavior, intercession.<ref>[http://www2.parc.com/csl/groups/sda/projects/reflection96/docs/malenfant/malenfant.pdf A Tutorial on Behavioral Reflection and its Implementation by Jacques Malenfant et al.]</ref><br />
<br />
==Historical background==<br />
<br />
The earliest computers were programmed in their native [[assembly language]], which were inherently reflective as these original architectures could be programmed by defining instructions as data and using [[self-modifying code]]. As programming moved to higher-level languages such as C, this reflective ability disappeared (outside of [[malware]]) until programming languages with reflection built into their type systems appeared.{{Citation needed|date=July 2015}} <br />
<br />
[[Brian Cantwell Smith]]'s 1982 doctoral dissertation<ref>[http://hdl.handle.net/1721.1/15961 Brian Cantwell Smith, Procedural Reflection in Programming Languages, Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, PhD Thesis, 1982.]</ref><ref>[http://publications.csail.mit.edu/lcs/specpub.php?id=840 Brian C. Smith. Reflection and semantics in a procedural language. Technical Report MIT-LCS-TR-272, Massachusetts Institute of Technology, Cambridge, Mass., January 1982.]</ref> introduced the notion of computational reflection in [[programming languages]], and the notion of the [[meta-circular interpreter]] as a component of [[3-Lisp]].<br />
<br />
==Uses==<br />
<br />
Reflection can be used for observing and modifying program execution at runtime. A reflection-oriented program component can monitor the execution of an enclosure of code and can modify itself according to a desired goal related to that enclosure. This is typically accomplished by dynamically assigning program code at runtime.<br />
<br />
In object oriented programming languages such as [[Java (programming language)|Java]], reflection allows ''inspection'' of classes, interfaces, fields and methods at runtime without knowing the names of the interfaces, fields, methods at compile time. It also allows ''instantiation'' of new objects and ''invocation'' of methods.<br />
<br />
Reflection can be used to adapt a given program to different situations dynamically. Reflection-oriented programming almost always requires additional knowledge, framework, relational mapping, and object relevance in order to take advantage of more generic code execution.<br />
<br />
Reflection is often used as part of [[software testing]], such as for the runtime creation/instantiation of [[mock object]]s.<br />
<br />
Reflection is also a key strategy for [[metaprogramming]].<br />
<br />
In some object-oriented programming languages, such as [[C Sharp (programming language)|C#]] and [[Java (programming language)|Java]], reflection can be used to override [[member accessibility]] rules. For example, reflection makes it possible to change the value of a field marked "private" in a third-party library's class.<br />
<br />
==Implementation==<br />
{{Unreferenced section|date=January 2008}}<br />
A language supporting reflection provides a number of features available at runtime that would otherwise be difficult to accomplish in a lower-level language. Some of these features are the abilities to:<br />
<br />
*Discover and modify source code constructions (such as code blocks, [[Class (computer science)|classes]], methods, protocols, etc.) as a [[first-class object]] at runtime.<br />
*Convert a [[string (computer science)|string]] matching the symbolic name of a class or function into a reference to or invocation of that class or function.<br />
*Evaluate a string as if it were a source code statement at runtime.<br />
*Create a new interpreter for the language's bytecode to give a new meaning or purpose for a programming construct.<br />
<br />
These features can be implemented in different ways. In [[MOO (programming language)|MOO]], reflection forms a natural part of everyday programming idiom. When verbs (methods) are called, various variables such as ''verb'' (the name of the verb being called) and ''this'' (the object on which the verb is called) are populated to give the context of the call. Security is typically managed by accessing the caller stack programmatically: Since ''callers()'' is a list of the methods by which the current verb was eventually called, performing tests on callers()[1] (the command invoked by the original user) allows the verb to protect itself against unauthorised use.<br />
<br />
Compiled languages rely on their runtime system to provide information about the source code. A compiled [[Objective-C]] executable, for example, records the names of all methods in a block of the executable, providing a table to correspond these with the underlying methods (or [[selector]]s for these methods) compiled into the program. In a compiled language that supports runtime creation of functions, such as [[Common Lisp]], the runtime environment must include a compiler or an interpreter.<br />
<br />
Reflection can be implemented for languages not having built-in reflection facilities by using a [[program transformation]] system to define automated source code changes.<br />
<br />
==Examples==<br />
The following code snippets create an [[instance (computer science)|instance]] <code>foo</code> of [[class (computer science)|class]] <code>Foo</code>, and invoke its [[method (computer science)|method]] <code>hello</code>. For each [[programming language]], normal and reflection-based call sequences are shown.<br />
<br />
===eC===<br />
The following is an example in [[eC (programming language)|eC]]:<br />
<source lang="ec">// without reflection<br />
Foo foo { };<br />
foo.hello();<br />
<br />
// with reflection<br />
Class fooClass = eSystem_FindClass(__thisModule, "Foo");<br />
Instance foo = eInstance_New(fooClass);<br />
Method m = eClass_FindMethod(fooClass, "hello", fooClass.module);<br />
((void (*)())(void *)m.function)(foo);</source><br />
<br />
===ECMAScript===<br />
The following is an example in [[ECMAScript]], and therefore also applies to [[JavaScript]] and [[ActionScript]]:<br />
<source lang="ecmascript"><br />
// Without reflection<br />
new Foo().hello()<br />
<br />
// With reflection<br />
<br />
// assuming that Foo resides in this<br />
new this['Foo']()['hello']()<br />
<br />
// or without assumption<br />
new (eval('Foo'))()['hello']()<br />
<br />
// or simply<br />
eval('new Foo().hello()')<br />
<br />
// Using ECMAScript 2015's new Reflect class:<br />
Reflect.construct(Foo, [])['hello']()<br />
</source><br />
<br />
===Go===<br />
<br />
The following is an example in [[Go (programming language)|Go]]:<br />
<br />
<source lang="go"><br />
import "reflect"<br />
<br />
// without reflection<br />
f := Foo{}<br />
f.Hello()<br />
<br />
// with reflection<br />
fT := reflect.TypeOf(Foo{})<br />
fV := reflect.New(fT)<br />
<br />
m := fV.MethodByName("Hello")<br />
if m.IsValid() {<br />
m.Call(nil)<br />
}<br />
</source><br />
<br />
===Java===<br />
The following is an example in [[Java (programming language)|Java]]:<br />
<source lang="java"><br />
<br />
// without reflection<br />
Foo foo = new Foo();<br />
foo.hello();<br />
<br />
// with reflection<br />
Object foo = Class.forName("complete.classpath.and.Foo").newInstance();<br />
// Alternatively: Object foo = Foo.class.newInstance();<br />
Method m = foo.getClass().getDeclaredMethod("hello", new Class<?>[0]);<br />
m.invoke(foo);<br />
<br />
</source><br />
<br />
===Objective-C===<br />
The following is an example in [[Objective-C]]—implying either the [[OpenStep]] or [[Foundation Kit]] framework is used:<br />
<source lang="objc"><br />
// Foo class.<br />
@interface Foo : NSObject<br />
- (void)hello;<br />
@end<br />
<br />
// Sending "hello" to a Foo instance without reflection.<br />
Foo *obj = [[Foo alloc] init];<br />
[obj hello];<br />
<br />
// Sending "hello" to a Foo instance with reflection.<br />
id obj = [[NSClassFromString(@"Foo") alloc] init];<br />
[obj performSelector: @selector(hello)];<br />
<br />
</source><br />
<br />
===Delphi===<br />
<br />
This [[Embarcadero Delphi|Delphi]] example assumes a TFoo class has been declared in a unit called Unit1:<br />
<source lang="Delphi"><br />
uses RTTI, Unit1;<br />
<br />
procedure WithoutReflection;<br />
var<br />
Foo: TFoo;<br />
begin<br />
Foo := TFoo.Create;<br />
try<br />
Foo.Hello;<br />
finally<br />
Foo.Free;<br />
end;<br />
end;<br />
<br />
procedure WithReflection;<br />
var<br />
RttiContext: TRttiContext;<br />
RttiType: TRttiInstanceType;<br />
Foo: TObject;<br />
begin<br />
RttiType := RttiContext.FindType('Unit1.TFoo') as TRttiInstanceType;<br />
Foo := RttiType.GetMethod('Create').Invoke(RttiType.MetaclassType, []).AsObject;<br />
try<br />
RttiType.GetMethod('Hello').Invoke(Foo, []);<br />
finally<br />
Foo.Free;<br />
end;<br />
end;<br />
</source><br />
<br />
This is a notable example since Delphi is an unmanaged, fully natively compiled language, unlike most other languages that support reflection. Its language architecture inherits from strongly-typed Pascal, but with significant influence from SmallTalk. Compare with the other examples here, many of which are dynamic or script languages like Perl, Python or PHP, or languages with a runtime like Java or C#.<br />
<br />
===Perl===<br />
The following is an example in [[Perl (programming language)|Perl]]:<br />
<br />
<syntaxhighlight lang=perl><br />
<br />
# without reflection<br />
my $foo = Foo->new;<br />
$foo->hello;<br />
<br />
# or<br />
Foo->new->hello;<br />
<br />
# with reflection<br />
my $class = "Foo"<br />
my $constructor = "new";<br />
my $method = "hello";<br />
<br />
my $f = $class->$constructor;<br />
$f->$method;<br />
<br />
# or<br />
$class->$constructor->$method;<br />
<br />
# with eval<br />
eval "new Foo->hello;";<br />
<br />
</syntaxhighlight><br />
<br />
===PHP===<br />
The following is an example in [[PHP]]:<br />
<syntaxhighlight lang=php><br />
// without reflection<br />
$foo = new Foo();<br />
$foo->hello();<br />
<br />
// with reflection<br />
$reflector = new ReflectionClass('Foo');<br />
$foo = $reflector->newInstance();<br />
$hello = $reflector->getMethod('hello');<br />
$hello->invoke($foo);<br />
<br />
// using callback<br />
$foo = new Foo();<br />
call_user_func(array($foo, 'hello'));<br />
<br />
// using variable variables syntax<br />
$className = 'Foo';<br />
$foo = new $className();<br />
$method = 'hello';<br />
$foo->$method();<br />
</syntaxhighlight><br />
<br />
===Python===<br />
The following is an example in [[Python (programming language)|Python]]:<br />
<syntaxhighlight lang=python><br />
<br />
# without reflection<br />
obj = Foo()<br />
obj.hello()<br />
<br />
# with reflection<br />
class_name = "Foo"<br />
method = "hello"<br />
obj = globals()[class_name]()<br />
getattr(obj, method)()<br />
<br />
# with eval<br />
eval("Foo().hello()")<br />
<br />
</syntaxhighlight><br />
<br />
===R===<br />
The following is an example in [[R (programming language)|R]]:<br />
<source lang="rsplus"><br />
# Without reflection, assuming foo() returns an S3-type object that has method "hello"<br />
obj <- foo()<br />
hello(obj)<br />
<br />
# With reflection<br />
the.class <- "foo"<br />
the.method <- "hello"<br />
obj <- do.call(the.class, list())<br />
do.call(the.method, alist(obj))<br />
<br />
</source><br />
<br />
===Ruby===<br />
The following is an example in [[Ruby (Programming Language)|Ruby]]:<br />
<syntaxhighlight lang=ruby><br />
<br />
# without reflection<br />
obj = Foo.new<br />
obj.hello<br />
<br />
# with reflection<br />
class_name = "Foo"<br />
method_name = :hello<br />
obj = Object.const_get(class_name).new<br />
obj.send method_name<br />
<br />
# with eval<br />
eval "Foo.new.hello"<br />
<br />
</syntaxhighlight><br />
<br />
==See also==<br />
*[[Type introspection]]<br />
*[[Self-modifying code]]<br />
*[[Self-hosting]]<br />
*[[Programming paradigm]]s<br />
*[[List of reflective programming languages and platforms]]<br />
*[[Mirror (programming)]]<br />
<br />
==References==<br />
'''Notes'''<br />
{{reflist}}<br />
'''Documents'''<br />
* Jonathan M. Sobel and Daniel P. Friedman. [http://web.archive.org/web/20100204091328/http://www.cs.indiana.edu/~jsobel/rop.html ''An Introduction to Reflection-Oriented Programming''] (1996), Indiana University.<br />
<br />
==Further reading==<br />
* Ira R. Forman and Nate Forman, ''Java Reflection in Action'' (2005), ISBN 1-932394-18-4<br />
* Ira R. Forman and Scott Danforth, ''Putting Metaclasses to Work'' (1999), ISBN 0-201-43305-2<br />
<br />
==External links==<br />
*[https://www-master.ufr-info-p6.jussieu.fr/2007/Ajouts/Master_esj20_2007_2008/IMG/pdf/malenfant-ijcai95.pdf Reflection in logic, functional and object-oriented programming: a short comparative study]<br />
*[http://web.archive.org/web/20100204091328/http://www.cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]<br />
*[http://www.laputan.org/#Reflection Brian Foote's pages on Reflection in Smalltalk]<br />
*[http://docs.oracle.com/javase/tutorial/reflect/index.html Java Reflection API Tutorial] from Oracle<br />
{{Programming language}}<br />
<br />
{{DEFAULTSORT:Reflection (Computer Programming)}}<br />
[[ Category:Programming constructs]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Reflective_programming&diff=714455880Reflective programming2016-04-09T21:29:20Z<p>PuercoPop: Reflection is not limited to run-time.</p>
<hr />
<div>In [[computer science]], '''reflection''' is the ability of a [[computer program]] to examine (see [[type introspection]]) and modify its own structure and behavior (specifically the values, meta-data, properties and functions).<ref>[http://www2.parc.com/csl/groups/sda/projects/reflection96/docs/malenfant/malenfant.pdf A Tutorial on Behavioral Reflection and its Implementation by Jacques Malenfant et al.]</ref><br />
<br />
==Historical background==<br />
<br />
The earliest computers were programmed in their native [[assembly language]], which were inherently reflective as these original architectures could be programmed by defining instructions as data and using [[self-modifying code]]. As programming moved to higher-level languages such as C, this reflective ability disappeared (outside of [[malware]]) until programming languages with reflection built into their type systems appeared.{{Citation needed|date=July 2015}} <br />
<br />
[[Brian Cantwell Smith]]'s 1982 doctoral dissertation<ref>[http://hdl.handle.net/1721.1/15961 Brian Cantwell Smith, Procedural Reflection in Programming Languages, Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, PhD Thesis, 1982.]</ref><ref>[http://publications.csail.mit.edu/lcs/specpub.php?id=840 Brian C. Smith. Reflection and semantics in a procedural language. Technical Report MIT-LCS-TR-272, Massachusetts Institute of Technology, Cambridge, Mass., January 1982.]</ref> introduced the notion of computational reflection in [[programming languages]], and the notion of the [[meta-circular interpreter]] as a component of [[3-Lisp]].<br />
<br />
==Uses==<br />
<br />
Reflection can be used for observing and modifying program execution at runtime. A reflection-oriented program component can monitor the execution of an enclosure of code and can modify itself according to a desired goal related to that enclosure. This is typically accomplished by dynamically assigning program code at runtime.<br />
<br />
In object oriented programming languages such as [[Java (programming language)|Java]], reflection allows ''inspection'' of classes, interfaces, fields and methods at runtime without knowing the names of the interfaces, fields, methods at compile time. It also allows ''instantiation'' of new objects and ''invocation'' of methods.<br />
<br />
Reflection can be used to adapt a given program to different situations dynamically. Reflection-oriented programming almost always requires additional knowledge, framework, relational mapping, and object relevance in order to take advantage of more generic code execution.<br />
<br />
Reflection is often used as part of [[software testing]], such as for the runtime creation/instantiation of [[mock object]]s.<br />
<br />
Reflection is also a key strategy for [[metaprogramming]].<br />
<br />
In some object-oriented programming languages, such as [[C Sharp (programming language)|C#]] and [[Java (programming language)|Java]], reflection can be used to override [[member accessibility]] rules. For example, reflection makes it possible to change the value of a field marked "private" in a third-party library's class.<br />
<br />
==Implementation==<br />
{{Unreferenced section|date=January 2008}}<br />
A language supporting reflection provides a number of features available at runtime that would otherwise be difficult to accomplish in a lower-level language. Some of these features are the abilities to:<br />
<br />
*Discover and modify source code constructions (such as code blocks, [[Class (computer science)|classes]], methods, protocols, etc.) as a [[first-class object]] at runtime.<br />
*Convert a [[string (computer science)|string]] matching the symbolic name of a class or function into a reference to or invocation of that class or function.<br />
*Evaluate a string as if it were a source code statement at runtime.<br />
*Create a new interpreter for the language's bytecode to give a new meaning or purpose for a programming construct.<br />
<br />
These features can be implemented in different ways. In [[MOO (programming language)|MOO]], reflection forms a natural part of everyday programming idiom. When verbs (methods) are called, various variables such as ''verb'' (the name of the verb being called) and ''this'' (the object on which the verb is called) are populated to give the context of the call. Security is typically managed by accessing the caller stack programmatically: Since ''callers()'' is a list of the methods by which the current verb was eventually called, performing tests on callers()[1] (the command invoked by the original user) allows the verb to protect itself against unauthorised use.<br />
<br />
Compiled languages rely on their runtime system to provide information about the source code. A compiled [[Objective-C]] executable, for example, records the names of all methods in a block of the executable, providing a table to correspond these with the underlying methods (or [[selector]]s for these methods) compiled into the program. In a compiled language that supports runtime creation of functions, such as [[Common Lisp]], the runtime environment must include a compiler or an interpreter.<br />
<br />
Reflection can be implemented for languages not having built-in reflection facilities by using a [[program transformation]] system to define automated source code changes.<br />
<br />
==Examples==<br />
The following code snippets create an [[instance (computer science)|instance]] <code>foo</code> of [[class (computer science)|class]] <code>Foo</code>, and invoke its [[method (computer science)|method]] <code>hello</code>. For each [[programming language]], normal and reflection-based call sequences are shown.<br />
<br />
===eC===<br />
The following is an example in [[eC (programming language)|eC]]:<br />
<source lang="ec">// without reflection<br />
Foo foo { };<br />
foo.hello();<br />
<br />
// with reflection<br />
Class fooClass = eSystem_FindClass(__thisModule, "Foo");<br />
Instance foo = eInstance_New(fooClass);<br />
Method m = eClass_FindMethod(fooClass, "hello", fooClass.module);<br />
((void (*)())(void *)m.function)(foo);</source><br />
<br />
===ECMAScript===<br />
The following is an example in [[ECMAScript]], and therefore also applies to [[JavaScript]] and [[ActionScript]]:<br />
<source lang="ecmascript"><br />
// Without reflection<br />
new Foo().hello()<br />
<br />
// With reflection<br />
<br />
// assuming that Foo resides in this<br />
new this['Foo']()['hello']()<br />
<br />
// or without assumption<br />
new (eval('Foo'))()['hello']()<br />
<br />
// or simply<br />
eval('new Foo().hello()')<br />
<br />
// Using ECMAScript 2015's new Reflect class:<br />
Reflect.construct(Foo, [])['hello']()<br />
</source><br />
<br />
===Go===<br />
<br />
The following is an example in [[Go (programming language)|Go]]:<br />
<br />
<source lang="go"><br />
import "reflect"<br />
<br />
// without reflection<br />
f := Foo{}<br />
f.Hello()<br />
<br />
// with reflection<br />
fT := reflect.TypeOf(Foo{})<br />
fV := reflect.New(fT)<br />
<br />
m := fV.MethodByName("Hello")<br />
if m.IsValid() {<br />
m.Call(nil)<br />
}<br />
</source><br />
<br />
===Java===<br />
The following is an example in [[Java (programming language)|Java]]:<br />
<source lang="java"><br />
<br />
// without reflection<br />
Foo foo = new Foo();<br />
foo.hello();<br />
<br />
// with reflection<br />
Object foo = Class.forName("complete.classpath.and.Foo").newInstance();<br />
// Alternatively: Object foo = Foo.class.newInstance();<br />
Method m = foo.getClass().getDeclaredMethod("hello", new Class<?>[0]);<br />
m.invoke(foo);<br />
<br />
</source><br />
<br />
===Objective-C===<br />
The following is an example in [[Objective-C]]—implying either the [[OpenStep]] or [[Foundation Kit]] framework is used:<br />
<source lang="objc"><br />
// Foo class.<br />
@interface Foo : NSObject<br />
- (void)hello;<br />
@end<br />
<br />
// Sending "hello" to a Foo instance without reflection.<br />
Foo *obj = [[Foo alloc] init];<br />
[obj hello];<br />
<br />
// Sending "hello" to a Foo instance with reflection.<br />
id obj = [[NSClassFromString(@"Foo") alloc] init];<br />
[obj performSelector: @selector(hello)];<br />
<br />
</source><br />
<br />
===Delphi===<br />
<br />
This [[Embarcadero Delphi|Delphi]] example assumes a TFoo class has been declared in a unit called Unit1:<br />
<source lang="Delphi"><br />
uses RTTI, Unit1;<br />
<br />
procedure WithoutReflection;<br />
var<br />
Foo: TFoo;<br />
begin<br />
Foo := TFoo.Create;<br />
try<br />
Foo.Hello;<br />
finally<br />
Foo.Free;<br />
end;<br />
end;<br />
<br />
procedure WithReflection;<br />
var<br />
RttiContext: TRttiContext;<br />
RttiType: TRttiInstanceType;<br />
Foo: TObject;<br />
begin<br />
RttiType := RttiContext.FindType('Unit1.TFoo') as TRttiInstanceType;<br />
Foo := RttiType.GetMethod('Create').Invoke(RttiType.MetaclassType, []).AsObject;<br />
try<br />
RttiType.GetMethod('Hello').Invoke(Foo, []);<br />
finally<br />
Foo.Free;<br />
end;<br />
end;<br />
</source><br />
<br />
This is a notable example since Delphi is an unmanaged, fully natively compiled language, unlike most other languages that support reflection. Its language architecture inherits from strongly-typed Pascal, but with significant influence from SmallTalk. Compare with the other examples here, many of which are dynamic or script languages like Perl, Python or PHP, or languages with a runtime like Java or C#.<br />
<br />
===Perl===<br />
The following is an example in [[Perl (programming language)|Perl]]:<br />
<br />
<syntaxhighlight lang=perl><br />
<br />
# without reflection<br />
my $foo = Foo->new;<br />
$foo->hello;<br />
<br />
# or<br />
Foo->new->hello;<br />
<br />
# with reflection<br />
my $class = "Foo"<br />
my $constructor = "new";<br />
my $method = "hello";<br />
<br />
my $f = $class->$constructor;<br />
$f->$method;<br />
<br />
# or<br />
$class->$constructor->$method;<br />
<br />
# with eval<br />
eval "new Foo->hello;";<br />
<br />
</syntaxhighlight><br />
<br />
===PHP===<br />
The following is an example in [[PHP]]:<br />
<syntaxhighlight lang=php><br />
// without reflection<br />
$foo = new Foo();<br />
$foo->hello();<br />
<br />
// with reflection<br />
$reflector = new ReflectionClass('Foo');<br />
$foo = $reflector->newInstance();<br />
$hello = $reflector->getMethod('hello');<br />
$hello->invoke($foo);<br />
<br />
// using callback<br />
$foo = new Foo();<br />
call_user_func(array($foo, 'hello'));<br />
<br />
// using variable variables syntax<br />
$className = 'Foo';<br />
$foo = new $className();<br />
$method = 'hello';<br />
$foo->$method();<br />
</syntaxhighlight><br />
<br />
===Python===<br />
The following is an example in [[Python (programming language)|Python]]:<br />
<syntaxhighlight lang=python><br />
<br />
# without reflection<br />
obj = Foo()<br />
obj.hello()<br />
<br />
# with reflection<br />
class_name = "Foo"<br />
method = "hello"<br />
obj = globals()[class_name]()<br />
getattr(obj, method)()<br />
<br />
# with eval<br />
eval("Foo().hello()")<br />
<br />
</syntaxhighlight><br />
<br />
===R===<br />
The following is an example in [[R (programming language)|R]]:<br />
<source lang="rsplus"><br />
# Without reflection, assuming foo() returns an S3-type object that has method "hello"<br />
obj <- foo()<br />
hello(obj)<br />
<br />
# With reflection<br />
the.class <- "foo"<br />
the.method <- "hello"<br />
obj <- do.call(the.class, list())<br />
do.call(the.method, alist(obj))<br />
<br />
</source><br />
<br />
===Ruby===<br />
The following is an example in [[Ruby (Programming Language)|Ruby]]:<br />
<syntaxhighlight lang=ruby><br />
<br />
# without reflection<br />
obj = Foo.new<br />
obj.hello<br />
<br />
# with reflection<br />
class_name = "Foo"<br />
method_name = :hello<br />
obj = Object.const_get(class_name).new<br />
obj.send method_name<br />
<br />
# with eval<br />
eval "Foo.new.hello"<br />
<br />
</syntaxhighlight><br />
<br />
==See also==<br />
*[[Type introspection]]<br />
*[[Self-modifying code]]<br />
*[[Self-hosting]]<br />
*[[Programming paradigm]]s<br />
*[[List of reflective programming languages and platforms]]<br />
*[[Mirror (programming)]]<br />
<br />
==References==<br />
'''Notes'''<br />
{{reflist}}<br />
'''Documents'''<br />
* Jonathan M. Sobel and Daniel P. Friedman. [http://web.archive.org/web/20100204091328/http://www.cs.indiana.edu/~jsobel/rop.html ''An Introduction to Reflection-Oriented Programming''] (1996), Indiana University.<br />
<br />
==Further reading==<br />
* Ira R. Forman and Nate Forman, ''Java Reflection in Action'' (2005), ISBN 1-932394-18-4<br />
* Ira R. Forman and Scott Danforth, ''Putting Metaclasses to Work'' (1999), ISBN 0-201-43305-2<br />
<br />
==External links==<br />
*[https://www-master.ufr-info-p6.jussieu.fr/2007/Ajouts/Master_esj20_2007_2008/IMG/pdf/malenfant-ijcai95.pdf Reflection in logic, functional and object-oriented programming: a short comparative study]<br />
*[http://web.archive.org/web/20100204091328/http://www.cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]<br />
*[http://www.laputan.org/#Reflection Brian Foote's pages on Reflection in Smalltalk]<br />
*[http://docs.oracle.com/javase/tutorial/reflect/index.html Java Reflection API Tutorial] from Oracle<br />
{{Programming language}}<br />
<br />
{{DEFAULTSORT:Reflection (Computer Programming)}}<br />
[[ Category:Programming constructs]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=List_of_presidents_of_the_American_Psychiatric_Association&diff=710830296List of presidents of the American Psychiatric Association2016-03-19T08:13:29Z<p>PuercoPop: Wikilink to the correct page for Alfred Freedman</p>
<hr />
<div>Presidents of the [[American Psychiatric Association]] <br />
<br />
{| class="sortable wikitable" style="text-align: left"<br />
|-<br />
! style="width:150px;"|'''Name'''<br />
! style="width:280px;"|'''Year'''<br />
!'''Notes'''<br />
|-<br />
|| [[Renée Binder]] || style="text-align:center;"|2015–2016 || Associate Dean of Academic Affairs, School of Medicine, [[University of California, San Francisco]] (UCSF) and Forensic Psychiatry Fellowship Director, UCSF Department of Psychiatry <ref name=president>{{cite web|title=Renée Binder, M.D., Takes Office as APA President|url=http://psychiatry.org/advocacy--newsroom/newsroom/ren%C3%A9e-binder-m-d-takes-office-as-apa-president|accessdate=22 May 2015 |year=2015}}</ref><br />
|-<br />
|| [[Paul Summergrad]] || style="text-align:center;"|2014–2015 || Dr. Frances S. Arkin Professor and Chairman of the Department of Psychiatry at the [[Tufts University]] School of Medicine, Psychiatrist-in-Chief of the [[Tufts Medical Center]]<ref>{{cite web|title=Faculty Bio - Paul Summergrad, MD|url=http://neurosciencecme.com/cmea_popup_faculty.asp?ID=406accessdate=May 22, 2015}}</ref><br />
|-<br />
|| [[Jeffrey Lieberman]] || style="text-align:center;"|2013–2014 || Chair of [[Columbia University]] Department of Psychiatry, principal investigator for the NIMH CATIE study <ref>{{cite web|title=Jeffrey Lieberman, M.D.|url=http://asp.cumc.columbia.edu/facdb/profile_list.asp?uni=jl2616&DepAffil=Psychiatry|date=2005 to 2008|publisher=Columbia University Department of Psychiatry|accessdate=May 26, 2013}}</ref><br />
|-<br />
||[[Carolyn Robinowitz]] || style="text-align:center;"|2009-2010||<br />
|-<br />
||[[Pedro Ruiz (psychiatrist)|Pedro Ruiz]] || style="text-align:center;"|2006-2007||<br />
|-<br />
||[[Mary Jane England]] || style="text-align:center;"|2005-2006||<br />
|-<br />
||[[Marcia Kraft Goin]] || style="text-align:center;"|2003-2004||<br />
|- <br />
||[[Paul S. Appelbaum]] || style="text-align:center;"|2002-2003||<br />
|-<br />
||[[Allan Tasman]] || style="text-align:center;"|1999-2000||<br />
|-<br />
||[[Rodrigo A. Munoz]] || style="text-align:center;"|1998-1999||<br />
|- <br />
||[[Harold Eist]] || style="text-align:center;"|1996–1997||<br />
|-<br />
||[[Steven Sharfstein]] || style="text-align:center;"|1995-1996||<br />
|-<br />
||[[Jerry M. Wiener]] || style="text-align:center;"|1994-1995||<br />
|-<br />
||John McIntyre || style="text-align:center;"|1993–1994||<br />
|-<br />
||[[Joseph T. English]] || style="text-align:center;"|1992-1993||<br />
|-<br />
||[[Lawrence Hartmann]] || style="text-align:center;"|1991-1992||<br />
|-<br />
||[[Elissa P. Benedek]] || style="text-align:center;"|1990-1991||<br />
|-<br />
||[[Herbert Pardes]] || style="text-align:center;"|1989-1990||<br />
|-<br />
||[[Paul Fink]] || style="text-align:center;"|1988-1989||<br />
|-<br />
||[[George H. Pollock]] || style="text-align:center;"|1987-1988||<br />
|-<br />
||[[Robert O. Pasnau]] || style="text-align:center;"|1986–1987||<br />
|-<br />
|| [[Carol Nadelson]] || style="text-align:center;"|1985-1986|| First female president of the [[American Psychiatric Association]].<ref>{{cite journal |pmid=3524277 |year=1986 |last1=Nadelson |first1=T |title=Carol C. Nadelson, M.D., one hundred fourteenth president, 1985- 1986, American Psychiatric Association |volume=143 |issue=8 |pages=959–61 |journal=The American Journal of Psychiatry}}</ref><br><br />
First female editor-in-chief of the [[American Psychiatric Association Press]] (1986).<ref name="nlm">http://www.nlm.nih.gov/changingthefaceofmedicine/physicians/biography_233.html{{full|date=November 2012}}</ref><br><br />
First director of Partners Office for Women's Careers at [[Brigham and Women’s Hospital]] (1998).<ref name="nlm" /> <br />
|-<br />
||[[John A. Talbott]] || style="text-align:center;"| 1984-1985 ||113th president<ref>{{cite journal |pmid=3895986 |year=1985 |last1=Sabshin |first1=M |title=John A. Talbott, M.D. One hundred thirteenth President, 1984-1985 |volume=142 |issue=9 |pages=1014–6 |journal=The American Journal of Psychiatry}}</ref><br />
|-<br />
||[[George Tarjan]] || style="text-align:center;"|1983-1984||<br />
|-<br />
||[[H. Kieth H. Brodie]] || style="text-align:center;"|1982-1983||<br />
|-<br />
||[[Daniel X. Freedman]] || style="text-align:center;"|1981-1982||<br />
|-<br />
||[[Donald G. Langsley]] || style="text-align:center;"|1980-1981||<br />
|-<br />
||[[Alan A. Stone]] || style="text-align:center;"|1979-1980||<br />
|-<br />
||[[Jules H. Masserman]] || style="text-align:center;"|1978-1979||<br />
|-<br />
||[[Jack Weinberg (psychiatrist)|Jack Weinberg]] || style="text-align:center;"|1977-1978||<br />
|-<br />
||[[Robert W. Gibson (psychiatrist)]] || style="text-align:center;"|1976-1977||<br />
|-<br />
||[[Judd Marmor]] || style="text-align:center;"|1975-1976||<br />
|-<br />
||[[John Patrick Spiegel]] || style="text-align:center;"| 1974-1975 ||103rd president<ref>{{cite journal |pmid=1094840 |year=1975 |last1=Weinberg |first1=J |title=John P. Spiegel, M.D. One hundred and third president, 1974-1975 |volume=132 |issue=7 |pages=700–2 |journal=The American Journal of Psychiatry}}</ref><br />
|-<br />
|| [[ Alfred Freedman | Alfred M. Freedman]] || style="text-align:center;"| 1973-1974 || Led the effort to de-classify homosexuality as a mental illness.<ref>{{cite news |url=http://www.nytimes.com/2011/04/21/health/21freedman.html |title=Alfred Freedman, a Leader in Psychiatry, Dies at 94 |first=William |last=Grims |date=April 20, 2011 |work=The New York Times}}</ref><br />
|-<br />
||[[Perry Clement Talkingten]] || style="text-align:center;"|1972–1973||<br />
|-<br />
||[[Ewald W. Busse]] || style="text-align:center;"|1971–1972||<br />
|-<br />
||[[Robert S. Garber]] || style="text-align:center;"|1970–1971||<br />
|-<br />
||[[Robert Waggoner]] || style="text-align:center;"|1969–1970||<br />
|-<br />
||[[Lawrence C. Kolb]] || style="text-align:center;"|1968-1969||<br />
|-<br />
||[[Henry W. Brosin]] || style="text-align:center;"|1967–1968||<br />
|-<br />
||[[Harvey J. Tompkins]] || style="text-align:center;"|1966–1967||<br />
|-<br />
||[[Howard P. Rome]] || style="text-align:center;"|1965–1966||<br />
|-<br />
|-||[[Daniel Blain]] || style="text-align:center;"|1964–1965||<br />
|-<br />
||[[Jack R. Ewalt]] || style="text-align:center;"|1963–1964||<br />
|-<br />
||[[C. H. Hardin Branch]] || style="text-align:center;"|1962–1963||<br />
|-<br />
||[[Walter E. Barton]] || style="text-align:center;"|1961–1962||<br />
|-<br />
||[[Robert H. Felix]] || style="text-align:center;"|1960-1961||<br />
|-<br />
||[[William Malamud]] || style="text-align:center;"| 1959–1960 ||<br />
|-<br />
||[[Francis J. Gerty]] || style="text-align:center;"|1958–1959||<br />
|-<br />
||[[Harry C. Solomon]] || style="text-align:center;"|1957–1958||<br />
|-<br />
||[[ Francis J. Braceland]] || style="text-align:center;"|1956–1957||<br />
|-<br />
||[[R. Finley Gayle Jr.]] || style="text-align:center;"|1955–1956||<br />
|-<br />
||[[Aurther P. Noyes]] || style="text-align:center;"|1954–1955||<br />
|-<br />
||[[Kenneth E. Appel]] || style="text-align:center;"|1953–1954||<br />
|-<br />
||[[Donald Ewen Cameron]] || style="text-align:center;"|1952–1953||<br />
|-<br />
||[[Leo H. Bartemeier]] || style="text-align:center;"|1951–1952||<br />
|- <br />
||[[John C. Whitehorn]] || style="text-align:center;"|1950–1951|| Psychiatrist in Chief from 1941-1960 at Johns Hopkins University and the Chairman of the Department of Psychiatry. <br />
|-<br />
||[[George S. Stevenson]] || style="text-align:center;"|1949-1950||<br />
|-<br />
||[[William Claire Menninger]] || style="text-align:center;"|1948-1949|| <ref>A Historical Dictionary of Psychiatry<br />
By Edward Shorter A Historical Dictionary of Psychiatry page 176</ref><br />
|-<br />
||[[Winfred Overholser Sr.]] || style="text-align:center;"|1947-1948||<br />
|-<br />
||[[Samuel W. Hamilton]] || style="text-align:center;"|1946–1947||<br />
|-<br />
||[[Karl M. Bowman]] || style="text-align:center;"|1944–1946||<br />
|- <br />
||[[Dr. Edward Strecker]] || style="text-align:center;"|1943–1944||Graduated from Jefferson University in 1911 Professor of Mental and Nervous Diseases (1925-1931) <ref> Thomas Jefferson University tradition and heritage,edited by Frederick B. Wagner, Jr., MD, 1989 Jefferson History January 1989 Part III: Clinical Departments and Divisions ---<br />
Chapter 29: Department of Psychiatry (pages 477-496) jdc.jefferson.edu/cgi/viewcontent.cgi?article=1029&context=wagner2</ref><br />
|-<br />
||[[Aurther H. Ruggles]] || style="text-align:center;"|1942-1943||<br />
|-<br />
||[[James King Hall]] || style="text-align:center;"|1941-1942||<br />
|-<br />
||[[H. Douglas Singer]] || style="text-align:center;"|1941-1942|| Died before taking office,<br />
|-<br />
||[[George H. Stevenson]] || style="text-align:center;"|1940-1941||<br />
|-<br />
||[[William C. Sandy]] || style="text-align:center;"|1939-1940||<br />
|-<br />
||[[Richard H. Hutchings]] || style="text-align:center;"|1938-1939||<br />
|-<br />
||[[Ross McC. Chapman]] || style="text-align:center;"|1937-1938||<br />
|-<br />
||[[C. Macfie Campbell]] || style="text-align:center;"|1936-1937||<br />
|-<br />
||[[Clarence O. Cheney]] || style="text-align:center;"|1935-1936||<br />
|-<br />
||[[C. Fred Williams]] || style="text-align:center;"|1934-1935||<br />
|-<br />
||[[George H. Kirby]] || style="text-align:center;"|1933-1934||<br />
|-<br />
||[[James V. May]] || style="text-align:center;"|1932-1933|<br />
|-<br />
||[[William L. Russell]] || style="text-align:center;"|1931-1932||<br />
|-<br />
||[[Walter M English]] || style="text-align:center;"|1930-1931||<br />
|-<br />
||[[Earl D. Bond]] || style="text-align:center;"|1929-1930||<br />
|-<br />
||[[Samuel T. Orton]] || style="text-align:center;"|1928-1929||<br />
|-<br />
||[[Adolf Meyer (psychiatrist)|Adolf Meyer]] || style="text-align:center;"|1927-1928 ||<br />
|-<br />
||[[George M Kline]] || style="text-align:center;"|1926-1927||<br />
|-<br />
||[[C. Floyd Haviland]] || style="text-align:center;"|1925-1926||<br />
|-<br />
||[[William A White]] || style="text-align:center;"|1924-1925||<br />
|-<br />
||[[Thomas W. Salman]] || style="text-align:center;"|1923-1924||<br />
|-<br />
||[[Henry W. Mitchell]] || style="text-align:center;"|1922-1923||<br />
|-<br />
||[[Albert M. Barett]] || style="text-align:center;"|1921-1922||<br />
|-<br />
||[[Owen Copp]] || style="text-align:center;"|1920-1921||<br />
|-<br />
||[[Henry C Eman]] || style="text-align:center;"|1919-1920||<br />
|-<br />
||[[Elmer E Southard]] || style="text-align:center;"|1918-1919 ||<br />
|-<br />
||[[James V. Anglin]] || style="text-align:center;"|1917-1918 ||<br />
|-<br />
||[[Charles G. Wagner]] || style="text-align:center;"|1916-1917 ||<br />
|-<br />
||[[Edward N. Brush]] || style="text-align:center;"|1915-1916 ||<br />
|-<br />
||[[Samuel E. Smith (psychiatrist)]] || style="text-align:center;"|1914-1915 ||<br />
|-<br />
||[[Carlos Frederick MacDonald]] || style="text-align:center;"|1913-1914 ||<ref>{{cite news |author= |agency= |title=Dr. Carlos F. MacDonald, Alienist, is Dead. Appeared as an Expert in the Thaw, Czolgosz and Noel Homicide Cases. Was Active at Age of 80. Death Comes at His Central Valley Home. Formerly Had a Sanitarium |url=http://query.nytimes.com/gst/abstract.html?res=9D0CE0DF1E3AEE3ABC4A53DFB066838D639EDE |quote= |newspaper=[[New York Times]] |date= June 2, 1926 |accessdate=2015-04-22 }}</ref><br />
|-<br />
||[[James C. Searcy]] || style="text-align:center;"|1912-1913 ||<br />
|-<br />
||[[Hubert Work]] || style="text-align:center;"|1911-1912 ||<br />
|-<br />
||[[Charles W. Pilgrim]] || style="text-align:center;"|1910-1911 ||<br />
|-<br />
||[[William F. Drewry]] || style="text-align:center;"|1909-1910 ||<br />
|-<br />
|-||[[Arthur F. Kilbourne]] || style="text-align:center;"|1908-1909 ||<br />
|-<br />
|-||[[Charles P. Bancroft]] || style="text-align:center;"|1907-1908 ||<br />
|-<br />
|-||[[Charles G. Hill]] || style="text-align:center;"|1906-1907 ||<br />
|-<br />
|-||[[C. B. Burr]] || style="text-align:center;"|1905-1906 ||<br />
|-<br />
|-||[[T.J. W. Burgess]] || style="text-align:center;"|1904-1905 ||<br />
|-<br />
|-||[[A. E. Macdonald]] || style="text-align:center;"|1903-1904 ||<br />
|-<br />
|-||[[G. Adler Bloomer]] || style="text-align:center;"|1902-1903 ||<br />
|-<br />
|-||[[A. B. Richardson ]] || style="text-align:center;"|1902-1903 ||Died before taking office,<br />
|-<br />
|-||[[Robert J. Preston]] || style="text-align:center;"|1901-1902||<br />
|-<br />
|-||[[Peter M. Wise]] || style="text-align:center;"|1900-1901||<br />
|-<br />
|-||[[Joseph G. Rogers]] || style="text-align:center;"|1899-1900 ||<br />
|-<br />
|-||[[Henry M. Hurd]] || style="text-align:center;"|1898-1899 ||<br />
|-<br />
|-||[[Richard M. Bucke]] || style="text-align:center;"|1897-1898 ||<br />
|-<br />
|-||[[Theophilus O. Powell]] || style="text-align:center;"|1896-1997 ||<br />
|-<br />
|-||[[Richard Dewey]] || style="text-align:center;"|1895-1896 ||<br />
|-<br />
|-||[[Edward Cowles]] || style="text-align:center;"|1894-1895 ||<br />
|-<br />
|-|John Curwen] || style="text-align:center;"|1893-1894 ||<br />
|-<br />
||J.B. Andrews || style="text-align:center;"|1892-1893|| <br />
|-<br />
||Daniel Clark || style="text-align:center;"|1891-1892|| <br />
|-<br />
|H.P. Stearns || style="text-align:center;"|1890-1891|| Organization name changed to American Medico-Psychological Association<br />
|-<br />
|W.W. Godding || style="text-align:center;"|1889-1890|| <br />
|-<br />
|John Chapin || style="text-align:center;"|1888-1889|| <br />
|-<br />
|Eugene Grissom || style="text-align:center;"|1887-1888|| <br />
|-<br />
|H.A. Buttolph || style="text-align:center;"|1886-1887|| <br />
|-<br />
|Orpheus Everts || style="text-align:center;"|1885-1886||<br />
|-<br />
|[[Pliny Earle (physician)|Pliny Earle]] || style="text-align:center;"|1884-1885|| <br />
|-<br />
|John P. Gray || style="text-align:center;"|1883-1884|| <br />
|-<br />
|J.H. Callender || style="text-align:center;"|1882-1883|| <br />
|-<br />
|Clement Walker || style="text-align:center;"|1879-1882|| <br />
|-<br />
|Charles Nichols || style="text-align:center;"|1873-1879|| <br />
|-<br />
|John Butler || style="text-align:center;"|1870-1873|| <br />
|-<br />
|[[Thomas Story Kirkbride]] || style="text-align:center;"|1862-1870|| <br />
|-<br />
|[[Andrew McFarland (physician)|Andrew McFarland]] || style="text-align:center;"|1859-1862|| <br />
|-<br />
|[[Isaac Ray]] || style="text-align:center;"|1855-1859||<br />
|-<br />
|Luther Bell || style="text-align:center;"|1851-1855|| <br />
|-<br />
|[[William Awl]] || style="text-align:center;"|1848-1851|| <br />
|-<br />
|Samuel B. Woodward || style="text-align:center;"|1844-1848|| First president, founded as the [[Association of Medical Superintendents of American Institutions for the Insane]]<br />
|-<br />
|}<br />
<br />
== References ==<br />
{{Reflist}}<br />
<br />
[[Category:American Psychiatric Association]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Free_Software_Directory&diff=706687479Free Software Directory2016-02-24T18:55:12Z<p>PuercoPop: contribution->title in some citations</p>
<hr />
<div>{{multiple issues|<br />
{{notability|date=August 2011}}<br />
{{primary sources|date=August 2011}}<br />
}}<br />
<br />
The '''Free Software Directory''' (FSD) is a project of the [[Free Software Foundation]] (FSF). It catalogs [[free software]] that runs under free [[operating system]]s - particularly [[GNU operating system|GNU]] and [[Linux]]. The cataloged projects are often able to run in several other operating systems. The project was formerly co-run by [[UNESCO]].<br />
<br />
Unlike some other directories that focus on free software,<ref>Among public directories that focus on free software, for example, Kim, E. E. (2003). [http://www.blueoxen.org/research/00007/ An Introduction to Open Source Communities] mentions [[SourceForge]] and [[Freshmeat]]:<br />
{{quote|There are three major databases of open source software available on the Internet today: the GNU Free Software Directory (https://www.gnu.org/directory/), [[SourceForge]] (http://sourceforge.net/), and [[Freshmeat]] (http://freshmeat.net/).}}<br />
</ref> Free Software Directory staff verify the licenses of software listed in the directory.<br />
<br />
==Coverage growth and usages==<br />
FSD has been used as a source for assessing the share of free software, for example finding in September 2002 an amount of "1550 entries, of which 1363 (87.9%) used the GPL license, 103 (6.6%) used the LGPL license, 32 (2.0%) used a BSD or BSD-like license, 29 (1.9%) used the Artistic license, 5 (0.3%) used the MIT license".<ref>Wheeler D. A. (2011). [http://www.dwheeler.com/essays/gpl-compatible.html Make Your Open Source Software GPL-Compatible. Or Else.]. Released 2002-05-06, revised 2011-04-26. The article remarked that: {{quote|The FSF prefers the GPL license, so the FSF directory statistic may be biased in the percentage of GPLed software it registers, but the directory still provides strong additional evidence that the GPL is a widely used license for [[FLOSS]].}}</ref> By September 2009, the Directory listed 6,000 packages whose number grew up to 6,500 in October 2011, when the newly updated directory was launched. All listed packages are "free for any computer user to download, run and share. Each entry is individually checked and tested [...] so users know that any program they come across in the directory will be truly free software [...] with free documentation and without proprietary software requirements".<ref>{{Citation | last1 = Noyes | first1 = K. | title = Looking for Free Software? A New Directory Can Help | series = PCWorld | year = 2011 | url= http://www.pcworld.com/businesscenter/article/240859/looking_for_free_software_a_new_directory_can_help.html }}</ref><br />
<br />
Several scientific publications review or refer to the directory.<ref>{{cite journal |last1=Reichle |first1=M. |last2=Hanft | first2=A. |year=2006 |title=Strategies and Technologies of Sharing in Contributor-Run Archives |journal=Library Trends |volume=53 |issue=4 |pages=651–662 |arxiv= | url=http://hdl.handle.net/2142/1750 | agency=handle.net}}</ref><ref>{{Citation | last1 = Dorn | first1 = J. | last2 = Hochmeister | first2 = M. | title = TechScreen: Mining Competencies in Social Software | series = The 13th World Multi-Conference on Systemics, Cybernetics and Informatics | place = Orlando | pages = 115–126 | year = 2009 | url= http://www.ifs.tuwien.ac.at/node/13747 }}</ref><ref>{{Citation | last1 = Amatriain | first1 = X. | last2 = Griffiths | first2 = D. | title = Free Software in Education: Is it a Viable Alternative? | series = Proceedings of the 7th IMAC Conference on Localization and Globalization in Technology | place = Duisburg, Germany | year = 2004 | url= http://mtg.upf.edu/node/369 }}</ref> It has been remarked that the Directory "only includes software that runs on free operating systems. The FSF/UNESCO Free Software Directory is also a collaborative project, offering a web interface for users to enter and update entries".<ref>{{cite journal |last1=Jones |first1=P. |year=2005 |title=The FLOSSWALD Information System on Free and Open Source Software |journal=Proceedings of the 9th International Workshop on Learning Software Organizations }}</ref><br />
Among the critical issues of the previous version, it has been pointed out that while "available software is described using a variety of textual metadata, including the components upon which a particular piece of software depends", "unfortunately, those dependencies are only listed by name, and locating and retrieving them is left to the user".<ref>{{cite journal |last1=van der Hoek |first1=A. |last2=Wolf |first2=A. L. |year=2002 |title=Software release management for component-based software |journal=Software — Practice and Experience |volume=33 |issue=1 |pages=77–98 |arxiv= |doi=10.1002/spe.496 | id = {{citeseerx|10.1.1.13.3314}} }}</ref><br />
On the other hand, the accuracy of the directory review on licenses is acknowledged.<ref>{{cite paper | quote=The Free Software Foundation's "Free Software Directory" is somewhat smaller, but they work hard to make sure their information is accurate (in particular, they check licenses carefully).|last=<br />
Wheeler|first=D. A. |date=2011|url=http://www.dwheeler.com/oss_fs_eval.html |title=How to Evaluate Open Source Software / Free Software (OSS/FS) Programs }}</ref><br />
The code review from the directory's editorial board is suitable for obtaining statistics on subsets of free software packages reliably clustered by license.<ref>See the query interface on license-type: http://directory.fsf.org/wiki/Special:RunQuery/Query_license .</ref><ref>{{cite journal |last1= Monden |first1= A. |last2= Okahara |first2= S. |last3= Manabe |first3= Y. |last4=Matsumoto |first4= K. |year= 2011 |title=Guilty or Not Guilty: Using Clone Metrics to Determine Open Source Licensing Violations|journal= IEEE Software |volume=28 |issue=2 |pages=42–47 |doi=10.1109/MS.2010.159 |issn= 0740-7459}}. Free access version: http://se.aist-nara.ac.jp/achieve/pdf/476.pdf</ref><br />
<br />
In September 2011, the Free Software Directory was re-implemented as a [[wiki]], using [[MediaWiki]] and the [[Semantic MediaWiki]] extension, to allow users to directly add to and modify its contents.<ref>[http://www.fsf.org/news/directory-relaunch Free Software Foundation re-launches its Free Software Directory, with over 6500 programs listed] (press release), Josh Gay, September 29, 2011</ref><br />
Semantic MediaWiki provides the directory with [[semantic web]] technologies by adding "advanced search and presentation capabilities, structured to be useful for reading by both humans and data-mining programs".<ref name="teck_in">[http://teck.in/the-free-software-foundation-fsf-re-launches-free-software-directory.html The Free Software Foundation (FSF) Re-launches Free Software Directory], TECK.IN, October 3rd, 2011.</ref><br />
<br />
The new edition of the directory has been described as designed to ease and support with [[semantics]] the discovery and harvesting of information on free software programs. "An extensive and flexible category system, plus over 40,000 keywords and more than 40 different fields of information, enhance both simple and advanced searching".<ref name="teck_in" /><br />
<br />
A recent snapshot of the [[Taxonomy (general)|taxonomy]] of the projects reviewed and accepted in the directory is the following:<ref>http://directory.fsf.org/wiki/Main_Page Last visited: 2011 October 27.</ref> <br />
{{div col|3}}<br />
* Audio <br />
* Biology <br />
* Business <br />
* Chat <br />
* Database <br />
* Documentation tool <br />
* Editor <br />
* Education <br />
* Email software <br />
* Game <br />
* Geography <br />
* Graphics <br />
* Hobbies <br />
* HTML Editor <br />
* Interface <br />
* Internet application <br />
* Live communications <br />
* Localization <br />
* Library <br />
* Mathematics <br />
* Network hookup <br />
* Printing <br />
* Program build automation <br />
* Programming language <br />
* Protocol <br />
* Science <br />
* Security <br />
* Software development <br />
* System administration <br />
* Text creation <br />
* Use <br />
* Version control <br />
* Video <br />
* Web authoring <br />
* Works with <br />
* Works with format <br />
{{div col end}}<br />
<br />
==See also==<br />
{{portal|left=yes|Free software}}{{-}}<br />
<br />
==References==<br />
{{Reflist}}<br />
<br />
==External links==<br />
* [http://directory.fsf.org/ The Free Software Directory]<br />
<br />
{{Free Software Foundation}}<br />
<br />
[[Category:Free Software Foundation]]<br />
[[Category:UNESCO]]<br />
[[Category:MediaWiki websites]]<br />
[[Category:Semantic wikis]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=User_talk:PuercoPop&diff=698551006User talk:PuercoPop2016-01-06T20:50:48Z<p>PuercoPop: /* Lisp (programming language) */</p>
<hr />
<div><br />
<br />
<br />
== Welcome ==<br />
'''Welcome!'''<br />
<br />
Hello, {{BASEPAGENAME}}, and [[Wikipedia:Introduction|welcome]] to Wikipedia! Thank you for [[Special:Contributions/{{BASEPAGENAME}}|your contributions]]{{#if:|, especially what you did for [[:{{{art}}}]]}}. I hope you like the place and decide to stay. Here are some pages that you might find helpful:<br />
*[[Wikipedia:Five pillars|The five pillars of Wikipedia]]<br />
*[[Wikipedia:Tutorial|Tutorial]]<br />
*[[Wikipedia:How to edit a page|How to edit a page]]<br />
*[[Wikipedia:Article development|How to write a great article]]<br />
*[[Wikipedia:Manual of Style|Manual of Style]]<br />
I hope you enjoy editing here and being a [[Wikipedia:Wikipedians|Wikipedian]]! Please [[Wikipedia:Signatures|sign]] your messages on [[Wikipedia:talk page|discussion page]]s using four [[tilde]]s (<nowiki>~~~~</nowiki>); this will automatically insert your username and the date. If you need help, check out [[Wikipedia:Questions]], ask me on {{#if:Longhair|[[user talk:Longhair|my talk page]]|my talk page}}, or ask your question on this page and then place <code><nowiki>{{helpme}}</nowiki></code> before the question. Again, welcome! <!-- Template:Welcome --> <br />
[[User:Longhair|Longhair]]\<sup>[[User_talk:Longhair|talk]]</sup> 22:05, 4 September 2008 (UTC)<br />
<br />
== Your Arbitration Committee Election Vote ==<br />
<br />
<br />
Hi PuercoPop,<br />
You recently voted in the Arbitration Committee Elections. In accordance to the [[Wikipedia:Requests for comment/Arbitration Committee Elections December 2012|Request for comment on the election process]], you must have made 150 edits in the main article space of Wikipedia before November 1st in order to be eligible to vote. According to a [https://en.wikipedia.org/w/index.php?title=Special%3AContributions&contribs=user&target=PuercoPop&namespace=0&limit=149 recent count], you only have 139 active and 3 deleted edits.<br />
<br />
If you believe we are in error, or there are other circumstances, such as a number of edits across multiple accounts, please let [[Wikipedia:Arbitration Committee Elections December 2012/Coordination|us]] know. [[User:Sailsbystars|Sailsbystars]] ([[User talk:Sailsbystars|talk]]) 18:53, 11 December 2012 (UTC)<br />
: I honestly have no idea. I just saw a link and assumed I was able to vote and started reading the Candidates proposals and Q&As. It was not my intention to cast a vote if ineligible for doing so. This is my only Account. [[User:PuercoPop|PuercoPop]] ([[User talk:PuercoPop#top|talk]]) 22:23, 11 December 2012 (UTC)<br />
::No worries! The rules weren't posted very prominently and the poll doesn't check to see if you're eligible. Please come by and vote next year, you were very very close to being eligible to vote this year... [[User:Sailsbystars|Sailsbystars]] ([[User talk:Sailsbystars|talk]]) 22:53, 11 December 2012 (UTC)<br />
== Nomination of [[:Roy (programming language)]] for deletion ==<br />
<div class="floatleft" style="margin-bottom:0">[[File:Ambox warning orange.svg|48px|alt=|link=]]</div>A discussion is taking place as to whether the article '''[[:Roy (programming language)]]''' is suitable for inclusion in Wikipedia according to [[Wikipedia:List of policies and guidelines|Wikipedia's policies and guidelines]] or whether it should be [[Wikipedia:Deletion policy|deleted]].<br />
<br />
The article will be discussed at [[Wikipedia:Articles for deletion/Roy (programming language) ]] until a consensus is reached, and anyone is welcome to contribute to the discussion. The nomination will explain the policies and guidelines which are of concern. The discussion focuses on high-quality evidence and our policies and guidelines.<br />
<br />
Users may edit the article during the discussion, including to improve the article to address concerns raised in the discussion. However, do not remove the article-for-deletion notice from the top of the article.<!-- Template:afd-notice --> &#8213;<span style="background:#8FF;border:solid 1px;border-radius:8px;box-shadow:darkgray 2px 2px 2px">&nbsp;[[User:Padenton|<span style="font-family:Old English Text MT;color:#C00">Padenton</span>]]&#124;[[User talk:Padenton|&#9993;]]&nbsp;</span>&nbsp; 15:12, 31 March 2015 (UTC)<br />
<br />
== [[WP:ACE2015|ArbCom elections are now open!]] ==<br />
<br />
{{Wikipedia:Arbitration Committee Elections December 2015/MassMessage}} [[User:MediaWiki message delivery|MediaWiki message delivery]] ([[User talk:MediaWiki message delivery|talk]]) 17:35, 23 November 2015 (UTC)<br />
<!-- Message sent by User:Mdann52@enwiki using the list at https://en.wikipedia.org/w/index.php?title=User:Mdann52/list&oldid=692057745 --><br />
<br />
== [[Lisp (programming language)]] ==<br />
Done. The name ''LISP'' derives from "LISt Processor".<nowiki><ref name=ArtOfLisp>{{cite book|last1=Jones|first1=Robin|last2=Maynard|first2=Clive|last3=Stewart|first3=Ian|title=The Art of Lisp Programming|date=December 6, 2012|publisher=Springer Science & Business Media|isbn=9781447117193|page=2}}</ref></nowiki><br><br />
It wasn't that hard to find. I just Googled "lisp list processor" and found it. Try it sometime, it can be rewarding. Cheers [[User:Jim1138|Jim1138]] ([[User talk:Jim1138|talk]]) 20:40, 6 January 2016 (UTC)<br />
: Do you really think leaving passive aggressive messages encourages contributions to Wikipedia? [[User:PuercoPop|PuercoPop]] ([[User talk:PuercoPop#top|talk]]) 20:49, 6 January 2016 (UTC)</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Lisp_(programming_language)&diff=698537767Lisp (programming language)2016-01-06T19:14:48Z<p>PuercoPop: request citation</p>
<hr />
<div>{{redirect|LISP|the Internet protocol|Locator/Identifier Separation Protocol}}<br />
{{Infobox programming language<br />
| name = Lisp<br />
| paradigm = [[multi-paradigm programming language|Multi-paradigm]]: [[functional programming|functional]], [[procedural programming|procedural]], [[Reflection (computer science)|reflective]], [[metaprogramming|meta]]<br />
| year = 1958<br />
| designer = [[John McCarthy (computer scientist)|John McCarthy]]<br />
| developer = [[Steve Russell]], Timothy P. Hart, and Mike Levin| latest release version =<br />
| latest release date =<br />
| turing-complete = Yes<br />
| typing = [[Dynamic typing|dynamic]], [[Strongly typed programming language|strong]]<br />
| implementations =<br />
| dialects = [[Arc (programming language)|Arc]], [[AutoLISP]], [[Clojure]], [[Common Lisp]], [[Emacs Lisp]], [[EuLisp]], [[Franz Lisp]], [[Hy]], [[Interlisp]], [[ISLISP]], [[LeLisp]], [[LFE (programming language)|LFE]], [[Maclisp]], [[MDL (programming language)|MDL]], [[Newlisp]], [[NIL (programming language)|NIL]], [[Picolisp]], [[Portable Standard Lisp]], [[Racket (programming language)|Racket]], [[RPL (programming language)|RPL]], [[Scheme (programming language)|Scheme]], [[Cadence SKILL|SKILL]], [[Spice Lisp]], [[T (programming language)|T]], [[XLISP]], [[Zetalisp]]<br />
| influenced by = [[Information Processing Language|IPL]]<br />
| influenced = [[CLIPS]], [[CLU (programming language)|CLU]], [[COWSEL]], [[Dylan (programming language)|Dylan]], [[Elixir_(programming_language)|Elixir]], [[Falcon (programming language)|Falcon]], [[Forth (programming language)|Forth]], [[Haskell (programming language)|Haskell]], [[Io (programming language)|Io]], [[Ioke (programming language)|Ioke]], [[JavaScript]], [[Julia (programming language)|Julia]], [[Logo (programming language)|Logo]], [[Lua (programming language)|Lua]], [[Mathematica]], [[MDL (programming language)|MDL]], [[ML (programming language)|ML]], [[Nim (programming language)|Nim]], [[Nu (programming language)|Nu]], [[OPS5]], [[Perl]], [[POP-2]]/[[POP-11|11]], [[Python (programming language)|Python]], [[R (programming language)|R]], [[Rebol]], [[Ruby (programming language)|Ruby]], [[Smalltalk]], [[Tcl]]<br />
}}<br />
<br />
'''Lisp''' (historically, '''LISP''') is a family of [[computer]] [[programming language]]s with a long history and a distinctive, fully parenthesized [[Polish notation|Polish prefix]] notation.<ref><br />
{{cite book<br />
| title = Milestones in computer science and information technology<br />
| author = Edwin D. Reilly<br />
| publisher = Greenwood Publishing Group<br />
| year = 2003<br />
| isbn = 978-1-57356-521-9<br />
| pages = 156–157<br />
| url = http://books.google.com/books?id=JTYPKxug49IC&pg=PA157<br />
}}</ref><br />
Originally specified in 1958, Lisp is the second-oldest [[high-level programming language]] in widespread use today; only [[Fortran]] is older (by one year).<ref>{{cite web|url=http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-5.html|quote=Lisp is a survivor, having been in use for about a quarter of a century. Among the active programming languages only Fortran has had a longer life.|title=SICP: Foreword}}</ref><ref>{{cite web|url=http://www-formal.stanford.edu/jmc/history/lisp/node6.html#SECTION00060000000000000000|title=Conclusions}}</ref> Like Fortran, Lisp has changed a great deal since its early days, and a number of [[Programming language dialect|dialects]] have existed over its history. Today, the most widely known general-purpose Lisp dialects are [[Common Lisp]] and [[Scheme (programming language)|Scheme]].<br />
<br />
Lisp was originally created as a practical mathematical notation for computer programs, influenced by the notation of [[Alonzo Church]]'s [[lambda calculus]]. It quickly became the favored programming language for [[artificial intelligence]] (AI) research. As one of the earliest programming languages, Lisp pioneered many ideas in [[computer science]], including [[tree data structure]]s, [[Garbage collection (computer science)|automatic storage management]], [[dynamic typing]], [[Conditional (computer programming)|conditionals]], [[higher-order function]]s, [[Recursion (computer science)|recursion]], and the [[self-hosting]] [[compiler]].<ref name="GRAHAM">{{cite web| title=Revenge of the Nerds| author=Paul Graham | url=http://www.paulgraham.com/icad.html | accessdate=2013-03-14}}</ref><br />
<br />
The name ''LISP'' derives from "LISt Processor"{{citation needed|date=Jan 2016}}. [[Linked list]]s are one of Lisp's major [[data structure]]s, and Lisp [[source code]] is itself made up of lists. As a result, Lisp programs can manipulate source code as a data structure, giving rise to the [[Macro (computer science)|macro]] systems that allow programmers to create new syntax or new [[domain-specific language]]s embedded in Lisp.<br />
<br />
The interchangeability of code and data gives Lisp its instantly recognizable syntax. All program code is written as ''[[s-expression]]s'', or parenthesized lists. A function call or syntactic form is written as a list with the function or operator's name first, and the arguments following; for instance, a function {{Lisp2|f}} that takes three arguments would be called as {{Lisp2|(f arg1 arg2 arg3)}}.<br />
<br />
==History==<br />
{{Multiple image|image1 = John McCarthy Stanford.jpg|footer = John McCarthy (top) and Steve Russell (bottom)|image2 = Steve Russell.jpg|direction = vertical}}<br />
<br />
Lisp was invented by [[John McCarthy (computer scientist)|John McCarthy]] in 1958 while he was at the [[Massachusetts Institute of Technology]] (MIT). McCarthy published its design in a paper in ''[[Communications of the ACM]]'' in 1960, entitled "Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I"<ref name="MCCARTHY">{{cite web| title=Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I| author=John McCarthy | url=http://www-formal.stanford.edu/jmc/recursive.html | accessdate=2006-10-13}}</ref> ("Part II" was never published). He showed that with a few simple operators and a notation for functions, one can build a [[Turing-complete]] language for algorithms.<br />
<br />
[[Information Processing Language]] was the first AI language, from 1955 or 1956, and already included many of the concepts, such as list-processing and recursion, which came to be used in Lisp.<br />
<br />
McCarthy's original notation used bracketed "[[M-expression]]s" that would be translated into [[S-expression]]s. As an example, the M-expression {{Lisp2|car[cons[A,B]]}} is equivalent to the S-expression {{Lisp2|(car (cons A B))}}. Once Lisp was implemented, programmers rapidly chose to use S-expressions, and M-expressions were abandoned. M-expressions surfaced again with short-lived attempts of [[MLISP]]<ref name="SMITH">{{cite web| title=MLISP Users Manual| author=David Canfield Smith | url=http://www.softwarepreservation.org/projects/LISP/stanford/Smith-MLISP-AIM-84.pdf | accessdate=2006-10-13}}</ref> by [[Horace Enea]] and [[CGOL]] by [[Vaughan Pratt]].<br />
<br />
Lisp was first implemented by [[Steve Russell]] on an [[IBM 704]] computer. Russell had read McCarthy's paper, and realized (to McCarthy's surprise) that the Lisp ''eval'' function could be implemented in [[machine code]].<ref>According to what reported by [[Paul Graham (computer programmer)|Paul Graham]] in ''[[Hackers & Painters]]'', p. 185, McCarthy said: "Steve Russell said, look, why don't I program this ''eval''..., and I said to him, ho, ho, you're confusing theory with practice, this ''eval'' is intended for reading, not for computing. But he went ahead and did it. That is, he compiled the ''eval'' in my paper into [[IBM 704]] machine code, fixing [[Software bug|bug]], and then advertised this as a Lisp interpreter, which it certainly was. So at that point Lisp had essentially the form that it has today..."</ref> The result was a working Lisp interpreter which could be used to run Lisp programs, or more properly, 'evaluate Lisp expressions.'<br />
<br />
Two assembly language macros for the [[IBM 704]] became the primitive operations for decomposing lists: [[Car and cdr|{{Lisp2|car}}]] (Contents of the Address part of Register number) and [[Car and cdr|{{Lisp2|cdr}}]] (Contents of the Decrement part of Register number).<ref name="PREHISTORY">{{cite web| title=LISP prehistory - Summer 1956 through Summer 1958| author=John McCarthy | url=http://www-formal.stanford.edu/jmc/history/lisp/node2.html | accessdate=2010-03-14}}</ref> From the context, it is clear that the term "Register" is used here to mean "Memory Register", nowadays called "Memory Location". Lisp dialects still use {{Lisp2|car}} and {{Lisp2|cdr}} ({{IPAc-en|ˈ|k|ɑr}} and {{IPAc-en|ˈ|k|ʊ|d|ər}}) for the operations that return the first item in a list and the rest of the list respectively.<br />
<br />
The first complete Lisp compiler, written in Lisp, was implemented in 1962 by Tim Hart and Mike Levin at MIT.<ref name="LEVIN">{{cite web| title=AI Memo 39-The new compiler| author=Tim Hart and Mike Levin | url=ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-039.pdf | accessdate=2006-10-13}}</ref> This compiler introduced the Lisp model of incremental compilation, in which compiled and interpreted functions can intermix freely. The language used in Hart and Levin's memo is much closer to modern Lisp style than McCarthy's earlier code.<br />
<br />
Lisp was a difficult system to implement with the compiler techniques and stock hardware of the 1970s. [[Garbage collection (computer science)|Garbage collection]] routines, developed by then-[[MIT]] graduate student [[Daniel Edwards (programmer)|Daniel Edwards]], made it practical to run Lisp on general-purpose computing systems, but efficiency was still a problem.{{citation needed|date=October 2010}} This led to the creation of [[Lisp machine]]s: dedicated hardware for running Lisp environments and programs. Advances in both computer hardware and compiler technology soon made Lisp machines obsolete.{{citation needed|date=May 2011}}<br />
<br />
During the 1980s and 1990s, a great effort was made to unify the work on new Lisp dialects (mostly successors to [[Maclisp]] like [[ZetaLisp]] and NIL (New Implementation of Lisp)) into a single language. The new language, [[Common Lisp]], was somewhat compatible with the dialects it replaced (the book [[Common Lisp the Language]] notes the compatibility of various constructs). In 1994, [[ANSI]] published the Common Lisp standard, "ANSI X3.226-1994 Information Technology Programming Language Common Lisp."<br />
<br />
<timeline><br />
Preset = TimeHorizontal_AutoPlaceBars_UnitYear<br />
ImageSize = width:1024<br />
PlotArea = right:256<br />
<br />
Define $bold = fontsize:L shift:(10,-4)<br />
<br />
Colors =<br />
id:offWhite value:rgb(0.97,0.97,0.97)<br />
id:paleGray value:rgb(0.86,0.86,0.86)<br />
id:darkGray value:gray(0.6)<br />
<br />
BackgroundColors = canvas:offWhite<br />
<br />
Period = from:1958 till:2013<br />
ScaleMajor = unit:year increment:5 start:1958 gridcolor:paleGray<br />
<br />
BarData=<br />
barset:Dialects<br />
<br />
PlotData=<br />
<br />
# set defaults<br />
width:15 fontsize:M textcolor:black align:left anchor:from shift:(0,-2) color:darkGray<br />
barset:Dialects<br />
<br />
from:1958 till:1965 text:"Lisp 1.5"<br />
from:1965 till:1985 text:"[[Maclisp]]"<br />
from:1970 till:1995 text:"[[ZetaLisp]]"<br />
from:1970 till:1980 text:"[[NIL (programming language)|NIL]]"<br />
from:1970 till:1990 text:"[[Interlisp]]"<br />
from:1984 till:2013 text:"[[Common Lisp]]"<br />
from:1975 till:2013 text:"[[Scheme (programming language)|Scheme]]"<br />
from:1986 till:2013 text:"[[ISLISP]]"<br />
from:2007 till:2013 text:"[[Clojure]]"<br />
</timeline><br />
<br />
===Connection to artificial intelligence===<br />
Since its inception, Lisp was closely connected with the [[artificial intelligence]] research community, especially on [[PDP-10]]<ref>The 36-bit word size of the [[PDP-6]]/[[PDP-10]] was influenced by the usefulness of having two Lisp 18-bit pointers in a single word. {{cite newsgroup | quote = The PDP-6 project started in early 1963, as a 24-bit machine. It grew to 36 bits for LISP, a design goal. | url = http://groups.google.com/group/alt.folklore.computers/browse_thread/thread/6e5602ce733d0ec/17597705ae289112 | title = The History of TOPS or Life in the Fast ACs | newsgroup = alt.folklore.computers |message-id= 84950@tut.cis.ohio-state.edu | date = 18 October 1990 | author = Peter J. Hurley}}</ref> systems. Lisp was used as the implementation of the programming language [[Planner programming language|Micro Planner]] which was used in the famous AI system [[SHRDLU]]. In the 1970s, as AI research spawned commercial offshoots, the performance of existing Lisp systems became a growing issue.{{Citation needed|date=March 2010}}<br />
<br />
===Genealogy and variants===<br />
Over its fifty-year history, Lisp has spawned many variations on the core theme of an S-expression language. Moreover, each given dialect may have several implementations—for instance, there are more than a dozen implementations of [[Common Lisp]].<br />
<br />
Differences between dialects may be quite visible—for instance, Common Lisp uses the keyword <code>defun</code> to name a function, but Scheme uses <code>define</code>.<ref>Common Lisp: <code>(defun f (x) x)</code><br/>Scheme: <code>(define f (lambda (x) x))</code> or <code>(define (f x) x)</code></ref> Within a dialect that is standardized, however, conforming implementations support the same core language, but with different extensions and libraries.<br />
<br />
====Historically significant dialects====<br />
[[File:LISP machine.jpg|thumb|right|A Lisp machine in the [[MIT Museum]]]]<br />
[[File:4.3 BSD UWisc VAX Emulation Lisp Manual.png|thumb|[[4.3BSD|4.3 BSD]] from the [[University of Wisconsin]], displaying the [[man page]] for [[Franz Lisp]]]]<br />
<br />
*LISP 1<ref>{{Cite journal<br />
| last = McCarthy | first = J. | author-link = John McCarthy (computer scientist)<br />
| last2 = Brayton | first2 = R. | author2-link = Robert Brayton (computer scientist)<br />
| last3 = Edwards | first3 = D. | author3-link = Daniel Edwards (programmer)<br />
| last4 = Fox | first4 = P. | author4-link = Phyllis Fox<br />
| last5 = Hodes | first5 = L. | author5-link = Louis Hodes<br />
| last6 = Luckham | first6 = D. | author6-link = David Luckham<br />
| last7 = Maling | first7 = K. | author7-link = Klim Maling (programmer)<br />
| last8 = Park | first8 = D. | author8-link = David Park (computer scientist)<br />
| last9 = Russell | first9 = S. | author9-link = Steve Russell <br />
| title = LISP I Programmers Manual<br />
| place = [[Boston]], [[Massachusetts]]<br />
| publisher = Artificial Intelligence Group, [[M.I.T. Computation Center]] and [[Research Laboratory of Electronics at MIT|Research Laboratory]]<br />
| origyear =<br />
|date=March 1960<br />
| volume =<br />
| edition =<br />
| chapter =<br />
| chapterurl =<br />
| page =<br />
| pages =<br />
| url = http://history.siam.org/sup/Fox_1960_LISP.pdf<br />
| archiveurl =<br />
| archivedate =<br />
| doi =<br />
| id =<br />
| isbn =<br />
| postscript = <!--None--> }} Accessed May 11, 2010.</ref> – First implementation.<br />
*LISP 1.5<ref>{{Cite book| url = http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf | title = LISP 1.5 Programmer's Manual | publisher = [[MIT Press]] | first1 = John | last1 = McCarthy | first2 = Paul W. | last2 = Abrahams | first3 = Daniel J. | last3 = Edwards | first4 = Timothy P. | last4 = Hart | first5 = Michael I. | last5 = Levin | isbn = 0-262-13011-4 | origyear = 1962|edition= 2nd|year=1985}}</ref> – First widely distributed version, developed by McCarthy and others at MIT. So named because it contained several improvements on the original "LISP 1" interpreter, but was not a major restructuring as the planned [[LISP 2]] would be.<br />
*[[Stanford LISP]] 1.6<ref>{{Cite book| url = http://www.softwarepreservation.org/projects/LISP/stanford/SAILON-28.6.pdf | format = PDF | title = Stanford LISP 1.6 Manual | first1 = Lynn H. | last1 = Quam | first2 = Whitfield | last2 = Diffle}}</ref> – This was a successor to LISP 1.5 developed at the [[Stanford AI Lab]], and widely distributed to [[PDP-10]] systems running the [[TOPS-10]] operating system. It was rendered obsolete by Maclisp and InterLisp.<br />
*[[Maclisp|MACLISP]]<ref>{{cite web| url = http://zane.brouhaha.com/~healyzh/doc/lisp.doc.txt | title = Maclisp Reference Manual | date = March 3, 1979 | archiveurl = http://web.archive.org/web/20071214064433/http://zane.brouhaha.com/~healyzh/doc/lisp.doc.txt | archivedate = 2007-12-14}}</ref> – developed for MIT's [[Project MAC]] (no relation to Apple's [[Macintosh]], nor to [[John McCarthy (computer scientist)|McCarthy]]), direct descendant of LISP 1.5. It ran on the PDP-10 and [[Multics]] systems. (MACLISP would later come to be called Maclisp, and is often referred to as MacLisp.)<br />
*[[InterLisp]]<ref>{{Cite book| url = http://www.bitsavers.org/pdf/xerox/interlisp/1974_InterlispRefMan.pdf | format = PDF | title = InterLisp Reference Manual | first = Warren | last = Teitelman | year = 1974 }}</ref> – developed at [[BBN Technologies]] for PDP-10 systems running the [[TOPS-20|Tenex]] operating system, later adopted as a "West coast" Lisp for the Xerox Lisp machines as [[InterLisp-D]]. A small version called "InterLISP 65" was published for the [[MOS 6502|6502]]-based [[Atari 8-bit family]] computer line. For quite some time Maclisp and InterLisp were strong competitors.<br />
*[[Franz Lisp]] – originally a [[University of California, Berkeley|Berkeley]] project; later developed by Franz Inc. The name is a humorous deformation of the name "[[Franz Liszt]]", and does not refer to [[Allegro Common Lisp]], the dialect of Common Lisp sold by Franz Inc., in more recent years.<br />
*[[XLISP]], which [[AutoLISP]] was based on.<br />
*[[Standard Lisp]] and [[Portable Standard Lisp]] were widely used and ported, especially with the Computer Algebra System REDUCE.<br />
*[[ZetaLisp]], also known as Lisp Machine Lisp – used on the [[Lisp machine]]s, direct descendant of Maclisp. ZetaLisp had a big influence on Common Lisp.<br />
*[[LeLisp]] is a French Lisp dialect. One of the first [[Interface Builder]]s was written in LeLisp.{{Citation needed|reason=No dispute about Lisp, but LeLisp specifically?|date=November 2014}}<br />
*[[Scheme (programming language)|Scheme]] (1975).<ref>ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-349.pdf</ref><br />
*[[Common Lisp]] (1984), as described by ''[[Common Lisp the Language]]'' – a consolidation of several divergent attempts (ZetaLisp, [[Spice Lisp]], [[NIL (programming language)|NIL]], and [[S-1 Lisp]]) to create successor dialects<ref>{{Cite book| chapterurl = http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node6.html | title = Common Lisp the Language | edition = 2nd | chapter = Purpose | first = Guy L., Jr. | last = Steele| isbn = 0-13-152414-3}}</ref> to Maclisp, with substantive influences from the Scheme dialect as well. This version of Common Lisp was available for wide-ranging platforms and was accepted by many as a [[de facto standard]]<ref>{{cite web| url = http://www.cs.cmu.edu/Groups/AI/html/faqs/lang/lisp/part2/faq-doc-13.html | title = History: Where did Lisp come from? | work = FAQ: Lisp Frequently Asked Questions 2/7 | date = 20 February 1996 | first1 = Mark | last1 = Kantrowitz | first2 = Barry | last2 = Margolin}}</ref> until the publication of ANSI Common Lisp (ANSI X3.226-1994).<br />
*[[Dylan (programming language)|Dylan]] was in its first version a mix of Scheme with the Common Lisp Object System.<br />
*[[EuLisp]] – attempt to develop a new efficient and cleaned-up Lisp.<br />
*[[ISLISP]] – attempt to develop a new efficient and cleaned-up Lisp. Standardized as ISO/IEC 13816:1997<ref>{{cite web|url=http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=22987 |title=ISO/IEC 13816:1997 |publisher=Iso.org |date=2007-10-01 |accessdate=2013-11-15}}</ref> and later revised as ISO/IEC 13816:2007:<ref>{{cite web|url=http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=44338 |title=ISO/IEC 13816:2007 |publisher=Iso.org |date=2013-10-30 |accessdate=2013-11-15}}</ref> ''Information technology – Programming languages, their environments and system software interfaces – Programming language ISLISP''.<br />
*IEEE [[Scheme (programming language)|Scheme]] – IEEE standard, 1178–1990 (R1995)<br />
*ANSI [[Common Lisp]] – an [[American National Standards Institute]] (ANSI) [[Standardization|standard]] for Common Lisp, created by subcommittee [[X3J13]], chartered<ref>{{cite web| url = http://www.nhplace.com/kent/CL/x3j13-86-020.html | title = X3J13 Charter}}</ref> to begin with ''Common Lisp: The Language'' as a base document and to work through a public [[Consensus decision-making|consensus]] process to find solutions to shared issues of [[Portability (software)|portability]] of programs and [[Computer compatibility|compatibility]] of Common Lisp implementations. Although formally an ANSI standard, the implementation, sale, use, and influence of ANSI Common Lisp has been and continues to be seen worldwide.<br />
*[[ACL2]] or "A Computational Logic for Applicative Common Lisp", an applicative (side-effect free) variant of Common LISP. ACL2 is both a programming language in which you can model computer systems and a tool to help proving properties of those models.<br />
*[[Clojure]], a modern dialect of Lisp which compiles to the [[Java virtual machine]] and handles [[Concurrency (computer science)|concurrency]] very well.<br />
<br />
===2000-present===<br />
After having declined somewhat in the 1990s, Lisp has recently experienced a resurgence of interest. Most new activity is focused around implementations of [[Common Lisp]] as well as [[Clojure]], [[Racket (programming language)|Racket]], [[Scheme (programming language)|Scheme]] and [[Emacs Lisp]], and includes the development of new portable libraries and applications.<br />
<br />
Many new Lisp programmers were inspired by writers such as [[Paul Graham (computer programmer)|Paul Graham]] and [[Eric S. Raymond]] to pursue a language others considered antiquated. New Lisp programmers often describe the language as an eye-opening experience and claim to be substantially more productive than in other languages.<ref>{{cite web| title=The Road To Lisp Survey | url=http://wiki.alu.org/The_Road_To_Lisp_Survey | accessdate=2006-10-13}}</ref> This increase in awareness may be contrasted to the "[[AI winter]]" and Lisp's brief gain in the mid-1990s.<ref>{{cite web|url=http://www.faqs.org/docs/artu/ch14s05.html |title=Trends for the Future |publisher=Faqs.org |accessdate=2013-11-15}}</ref><br />
<br />
Dan Weinreb lists in his survey of Common Lisp implementations<ref>{{cite web|last=Weinreb|first=Daniel|title=Common Lisp Implementations: A Survey|url=http://common-lisp.net/~dlw/LispSurvey.html|accessdate=4 April 2012}}</ref> eleven actively maintained Common Lisp implementations. Scieneer Common Lisp is a new commercial implementation forked from CMUCL with a first release in 2002.<br />
<br />
The open source community has created new supporting infrastructure: [[CLiki]] is a wiki that collects Common Lisp related information, the [[Common Lisp directory]] lists resources, #lisp is a popular IRC channel (with support by a Lisp-written Bot), [[lisppaste]] supports the sharing and commenting of code snippets, [[Planet Lisp]] collects the contents of various Lisp-related blogs, on [[LispForum]] users discuss Lisp topics, [[Lispjobs]] is a service for announcing job offers and there is a weekly news service, ''[[Weekly Lisp News]]''. ''Common-lisp.net'' is a hosting site for open source Common Lisp projects. [[Quicklisp]] is a library manager for Common Lisp.<br />
<br />
50 years of Lisp (1958–2008) has been celebrated at LISP50@OOPSLA.<ref>{{cite web|url=http://www.lisp50.org/ |title=LISP50@OOPSLA |publisher=Lisp50.org |accessdate=2013-11-15}}</ref> There are regular local user meetings in Boston, Vancouver, and Hamburg. Other events include the European Common Lisp Meeting, the European Lisp Symposium and an International Lisp Conference.<br />
<br />
The Scheme community actively maintains [[Scheme (programming language)#Implementations|over twenty implementations]]. Several significant new implementations (Chicken, Gambit, Gauche, Ikarus, Larceny, Ypsilon) have been developed in the last few years. The Revised<sup>5</sup> Report on the Algorithmic Language Scheme<ref>[http://www.schemers.org/Documents/Standards/R5RS/ Documents: Standards: R5RS]. schemers.org (2012-01-11). Retrieved on 2013-07-17.</ref> standard of Scheme was widely accepted in the Scheme community. The [[Scheme Requests for Implementation]] process has created a lot of quasi standard libraries and extensions for Scheme. User communities of individual Scheme implementations continue to grow. A new language standardization process was started in 2003 and led to the R<sup>6</sup>RS Scheme standard in 2007. Academic use of Scheme for teaching computer science seems to have declined somewhat. Some universities, such as MIT, are no longer using Scheme in their computer science introductory courses.<ref>{{cite news|url=http://cemerick.com/2009/03/24/why-mit-now-uses-python-instead-of-scheme-for-its-undergraduate-cs-program/|title=Why MIT now uses python instead of scheme for its undergraduate CS program|date=March 24, 2009|work=cemerick.com|accessdate=November 10, 2013}}</ref><ref>{{cite news|url=http://mitadmissions.org/blogs/entry/the_end_of_an_era_1|title=The End of an Era|first=Evan|last=Broder|date=January 8, 2008|work=mitadmissions.org|accessdate=November 10, 2013}}</ref><br />
<br />
There are several new dialects of Lisp: [[Arc (programming language)|Arc]], [[Hy]], [[Nu (programming language)|Nu]], [[Clojure]], [[Liskell]], [[LFE (programming language)|LFE]] (Lisp Flavored Erlang) and [[Racket (programming language)|Racket]].<br />
<br />
==Major dialects==<br />
[[Common Lisp]] and [[Scheme (programming language)|Scheme]] represent two major streams of Lisp development. These languages embody significantly different design choices.<br />
<br />
[[Common Lisp]] is a successor to [[MacLisp]]. The primary influences were [[Lisp Machine Lisp]], [[MacLisp]], [[NIL (programming language)|NIL]], [[S-1 Lisp]], [[Spice Lisp]], and Scheme.<ref>Chapter 1.1.2, History, ANSI CL Standard</ref> It has many of the features of Lisp Machine Lisp (a large Lisp dialect used to program [[Lisp Machine]]s), but was designed to be efficiently implementable on any personal computer or workstation. Common Lisp has a large language standard including many built-in data types, functions, macros and other language elements, as well as an object system ([[Common Lisp Object System]] or shorter CLOS). Common Lisp also borrowed certain features from Scheme such as [[lexical scoping]] and [[lexical closure]]s.<br />
<br />
Scheme (designed earlier) is a more minimalist design, with a much smaller set of standard features but with certain implementation features (such as [[tail-call optimization]] and full [[continuation]]s) not necessarily found in Common Lisp.<br />
<br />
[[Scheme (programming language)|Scheme]] is a statically scoped and properly tail-recursive dialect of the Lisp programming language invented by [[Guy L. Steele, Jr.|Guy Lewis Steele Jr.]] and [[Gerald Jay Sussman]]. It was designed to have exceptionally clear and simple semantics and few different ways to form expressions. A wide variety of programming paradigms, including imperative, functional, and message passing styles, find convenient expression in Scheme. Scheme continues to evolve with a series of standards (Revised<sup>n</sup> Report on the Algorithmic Language Scheme) and a series of [[Scheme Requests for Implementation]].<br />
<br />
[[Clojure]] is a recent dialect of Lisp that principally targets the [[Java Virtual Machine]], as well as the [[Common Language Runtime|CLR]], the [[Python (programming language)|Python VM]], the Ruby VM [[YARV]], and compiling to [[JavaScript]]. It is designed to be a pragmatic general-purpose language. Clojure draws considerable influences from [[Haskell (programming language)|Haskell]] and places a very strong emphasis on immutability.<ref name="clojure-immutability">[http://www.infoq.com/articles/in-depth-look-clojure-collections An In-Depth Look at Clojure Collections], Retrieved 2012-06-24</ref> Every feature supported by Clojure is supported at runtime. Clojure provides access to Java frameworks and libraries, with optional type hints and [[type inference]], so that calls to Java can avoid reflection and enable fast primitive operations.<br />
<br />
In addition, Lisp dialects are used as [[scripting language]]s in a number of applications, with the most well-known being [[Emacs Lisp]] in the [[Emacs]] editor, [[AutoLisp]] and later [[Visual Lisp]] in [[AutoCAD]], Nyquist in [[Audacity (audio editor)|Audacity]], Scheme in [[LilyPond]]. The potential small size of a useful Scheme interpreter makes it particularly popular for embedded scripting. Examples include [[SIOD]] and [[TinyScheme]], both of which have been successfully embedded in the [[GIMP]] image processor under the generic name "Script-fu".<ref name="script-fu">[http://www.gimp.org/docs/script-fu-update.html Script-fu In GIMP 2.4], Retrieved 2009-10-29</ref> LIBREP, a Lisp interpreter by John Harper originally based on the [[Emacs Lisp]] language, has been embedded in the [[Sawfish (window manager)|Sawfish]] [[window manager]].<ref name="librep">[http://sawfish.wikia.com/wiki/Librep librep] at Sawfish Wikia, retrieved 2009-10-29</ref><br />
<br />
==Language innovations==<br />
Lisp was the first language where the structure of program code is represented faithfully and directly in a standard data structure—a quality much later dubbed "[[homoiconicity]]". As a result, Lisp functions can be manipulated, altered or even created within a Lisp program without lower-level manipulations. This is generally considered one of the primary advantages of the language with regard to its expressive power, and makes the language suitable for [[syntactic macros]] and [[metacircular evaluation]].<br />
<br />
A conditional using an ''if-then-else'' syntax was invented by McCarthy in a Fortran context. He proposed its inclusion in [[ALGOL]], but it was not made part of the [[Algol 58]] specification. For Lisp, McCarthy used the more general ''cond''-structure.<ref>{{cite web|url=http://www-formal.stanford.edu/jmc/history/lisp/node2.html|title=LISP prehistory - Summer 1956 through Summer 1958.|quote=I invented conditional expressions in connection with a set of chess legal move routines I wrote in FORTRAN for the IBM 704 at M.I.T. during 1957-58...A paper defining conditional expressions and proposing their use in Algol was sent to the Communications of the ACM but was arbitrarily demoted to a letter to the editor, because it was very short.}}</ref> [[Algol 60]] took up ''if-then-else'' and popularized it.<br />
<br />
Lisp deeply influenced [[Alan Kay]], the leader of the research on [[Smalltalk]], and then in turn Lisp was influenced by Smalltalk, by adopting object-oriented programming features (classes, instances, etc.) in the late 1970s. The Flavours object system (later CLOS) introduced multiple inheritance.<br />
<br />
Lisp introduced the concept of [[Garbage collection (computer science)|automatic garbage collection]], in which the system walks the heap looking for unused memory. Progress in modern sophisticated garbage collection algorithms such as generational garbage collection was stimulated by its use in Lisp.<ref>{{citation |last=Lieberman |first=Henry |last2=Hewitt |first2=Carl |title=A Real-Time Garbage Collector Based on the Lifetimes of Objects |url=http://web.media.mit.edu/~lieber/Lieberary/GC/Realtime/Realtime.html |journal=CACM |volume=26 |issue=6 |date=June 1983 |pages=419–429 |doi=10.1145/358141.358147}}</ref><br />
<br />
[[Edsger W. Dijkstra]] in his 1972 [[Turing Award]] lecture said,<br />
:"With a few very basic principles at its foundation, it [LISP] has shown a remarkable stability. Besides that, LISP has been the carrier for a considerable number of in a sense our most sophisticated computer applications. LISP has jokingly been described as “the most intelligent way to misuse a computer”. I think that description a great compliment because it transmits the full flavour of liberation: it has assisted a number of our most gifted fellow humans in thinking previously impossible thoughts."<ref>{{citation|url=http://www.cs.utexas.edu/~EWD/transcriptions/EWD03xx/EWD340.html|author=Edsger W. Dijkstra|year=1972|title=The Humble Programmer (EWD 340)}} (ACM Turing Award lecture).</ref><br />
<br />
Largely because of its resource requirements with respect to early computing hardware (including early microprocessors), Lisp did not become as popular outside of the [[AI]] community as [[Fortran]] and the [[ALGOL]]-descended [[C (programming language)|C]] language. Because of its suitability to complex and dynamic applications, Lisp is currently{{when|date=January 2016}} enjoying some resurgence of popular interest.{{citation needed|date=January 2016}}<br />
<br />
==Syntax and semantics==<br />
:'''''Note''': This article's examples are written in [[Common Lisp]] (though most are also valid in [[Scheme (programming language)|Scheme]]).''<br />
<br />
===Symbolic expressions (S-expressions)===<br />
Lisp is an [[Expression (computer science)|expression]]-oriented language. Unlike most other languages, no distinction is made between "expressions" and [[Statement (programming)|"statements"]];{{dubious|date=April 2013}}<!-- (progn ...), (setq ...). There is no syntactic distinction, but sequential evaluation is there. --> all code and data are written as expressions. When an expression is ''evaluated'', it produces a value (in Common Lisp, possibly multiple values), which can then be embedded into other expressions. Each value can be any data type.<br />
<br />
McCarthy's 1958 paper introduced two types of syntax: [[S-expression]]s (Symbolic expressions, also called "sexps"), which mirror the internal representation of code and data; and [[M-expression]]s (Meta Expressions), which express functions of S-expressions. M-expressions never found favor, and almost all Lisps today use S-expressions to manipulate both code and data.<br />
<br />
The use of parentheses is Lisp's most immediately obvious difference from other programming language families. As a result, students have long given Lisp nicknames such as ''Lost In Stupid Parentheses'', or ''Lots of Irritating Superfluous Parentheses''.<ref name="LEVIN2">{{cite web| title=The Jargon File - Lisp| url=http://www.catb.org/~esr/jargon/html/L/LISP.html| accessdate=2006-10-13}}</ref><!-- Do not insert more nicknames. People can look in the Jargon File for them. --> However, the S-expression syntax is also responsible for much of Lisp's power: the syntax is extremely regular, which facilitates manipulation by computer. However, the syntax of Lisp is not limited to traditional parentheses notation. It can be extended to include alternative notations. [[XMLisp]], for instance, is a Common Lisp extension that employs the [[Meta-object protocol|metaobject-protocol]] to integrate S-expressions with the [[Xml|Extensible Markup Language (XML)]].<br />
<br />
The reliance on expressions gives the language great flexibility. Because Lisp [[function (programming)|functions]] are themselves written as lists, they can be processed exactly like data. This allows easy writing of programs which manipulate other programs ([[metaprogramming]]). Many Lisp dialects exploit this feature using macro systems, which enables extension of the language almost without limit.<br />
<br />
===Lists===<br />
A Lisp list is written with its elements separated by whitespace, and surrounded by parentheses. For example, {{Lisp2|(1 2 foo)}} is a list whose elements are three ''atoms'' {{Lisp2|1}}, {{Lisp2|2}}, and [[foo|{{Lisp2|foo}}]]. These values are implicitly typed: they are respectively two integers and a Lisp-specific data type called a "symbol", and do not have to be declared as such.<br />
<br />
The empty list {{Lisp2|()}} is also represented as the special atom {{Lisp2|nil}}. This is the only entity in Lisp which is both an atom and a list.<br />
<br />
Expressions are written as lists, using [[Polish notation|prefix notation]]. The first element in the list is the name of a function, the name of a macro, a lambda expression or the name of a "special operator" (see below). The remainder of the list are the arguments. For example, the function {{Lisp2|list}} returns its arguments as a list, so the expression<br />
<syntaxhighlight lang=Lisp><br />
(list 1 2 (quote foo))<br />
</syntaxhighlight><br />
evaluates to the list {{Lisp2|(1 2 foo)}}. The "quote" before the [[foo|{{Lisp2|foo}}]] in the preceding example is a "special operator" which returns its argument without evaluating it. Any unquoted expressions are recursively evaluated before the enclosing expression is evaluated. For example,<br />
<syntaxhighlight lang=Lisp><br />
(list 1 2 (list 3 4))<br />
</syntaxhighlight><br />
evaluates to the list {{Lisp2|(1 2 (3 4))}}. Note that the third argument is a list; lists can be nested.<br />
<br />
===Operators===<br />
Arithmetic operators are treated similarly. The expression<br />
<syntaxhighlight lang=Lisp><br />
(+ 1 2 3 4)<br />
</syntaxhighlight><br />
evaluates to 10. The equivalent under [[infix notation]] would be "{{Lisp2|1 + 2 + 3 + 4}}".<br />
<br />
Lisp has no notion of operators as implemented in Algol-derived languages. Arithmetic operators in Lisp are [[variadic function]]s (or ''[[n-ary]]''), able to take any number of arguments. A C-style '++' increment operator is sometimes implemented under the name <tt>incf</tt> giving syntax <br />
<syntaxhighlight lang=Lisp><br />
(incf x)<br />
</syntaxhighlight><br />
, equivalent to <tt>(setq x (+ x 1))<tt>, returning the new value of <tt>x</tt>.<br />
<br />
"Special operators" (sometimes called "special forms") provide Lisp's control structure. For example, the special operator {{Lisp2|if}} takes three arguments. If the first argument is non-nil, it evaluates to the second argument; otherwise, it evaluates to the third argument. Thus, the expression<br />
<syntaxhighlight lang=Lisp><br />
(if nil<br />
(list 1 2 "foo")<br />
(list 3 4 "bar"))<br />
</syntaxhighlight><br />
evaluates to {{Lisp2|(3 4 "bar")}}. Of course, this would be more useful if a non-trivial expression had been substituted in place of {{Lisp2|nil}}.<br />
<br />
===Lambda expressions and function definition===<br />
Another special operator, {{Lisp2|lambda}}, is used to bind variables to values which are then evaluated within an expression. This operator is also used to create functions: the arguments to {{Lisp2|lambda}} are a list of arguments, and the expression or expressions to which the function evaluates (the returned value is the value of the last expression that is evaluated). The expression<br />
<syntaxhighlight lang=Lisp><br />
(lambda (arg) (+ arg 1))<br />
</syntaxhighlight><br />
evaluates to a function that, when applied, takes one argument, binds it to {{Lisp2|arg}} and returns the number one greater than that argument. Lambda expressions are treated no differently from named functions; they are invoked the same way. Therefore, the expression<br />
<syntaxhighlight lang=Lisp><br />
((lambda (arg) (+ arg 1)) 5)<br />
</syntaxhighlight><br />
evaluates to {{Lisp2|6}}.<br />
<br />
Named functions are created by storing a lambda expression in a symbol using the [[defun]] macro.<br />
<syntaxhighlight lang=Lisp><br />
(defun foo (a b c d) (+ a b c d))<br />
</syntaxhighlight><br />
<br />
{{Lisp2|(defun f (a) b...)}} defines a new function named {{Lisp2|f}} in the global environment. It is a shorthand for the expression:<br />
<br />
<syntaxhighlight lang=Lisp><br />
(place-in-function-definition-slot-of-symbol 'f #'(lambda (a) b...))<br />
</syntaxhighlight><br />
<br />
===Atoms===<br />
In the original '''LISP''' there were two fundamental [[data type]]s: atoms and lists. A list was a finite ordered sequence of elements, where each element is in itself either an atom or a list, and an atom was a [[number]] or a symbol. A symbol was essentially a unique named item, written as an [[alphanumeric]] string in [[source code]], and used either as a variable name or as a data item in [[symbolic processing]]. For example, the list {{Lisp2|(FOO (BAR 1) 2)}} contains three elements: the symbol FOO, the list {{Lisp2|(BAR 1)}}, and the number 2.<br />
<br />
The essential difference between atoms and lists was that atoms were immutable and unique. Two atoms that appeared in different places in source code but were written in exactly the same way represented the same object,{{Citation needed|date=November 2008}} whereas each list was a separate object that could be altered independently of other lists and could be distinguished from other lists by comparison operators.<br />
<br />
As more data types were introduced in later Lisp dialects, and [[programming style]]s evolved, the concept of an atom lost importance.{{Citation needed|date=November 2008}} Many dialects still retained the predicate ''atom'' for [[legacy compatibility]],{{Citation needed|date=November 2008}} defining it true for any object which is not a cons.<br />
<br />
===Conses and lists===<br />
{{Main|Cons}}<br />
[[File:Cons-cells.svg|thumb|right|300px|Box-and-pointer diagram for the list (42 69 613)]]<br />
A Lisp list is [[singly linked list|singly linked]]. Each cell of this list is called a ''cons'' (in Scheme, a ''pair''), and is composed of two [[pointer (computer programming)|pointer]]s, called the ''car'' and ''cdr''. These are respectively equivalent to the {{Lisp2|data}} and {{Lisp2|next}} fields discussed in the article ''[[linked list]]''.<br />
<br />
Of the many data structures that can be built out of cons cells, one of the most basic is called a ''proper list''. A proper list is either the special {{Lisp2|nil}} (empty list) symbol, or a cons in which the {{Lisp2|car}} points to a datum (which may be another cons structure, such as a list), and the {{Lisp2|cdr}} points to another proper list.<br />
<br />
If a given cons is taken to be the head of a linked list, then its car points to the first element of the list, and its cdr points to the rest of the list. For this reason, the {{Lisp2|car}} and {{Lisp2|cdr}} functions are also called {{Lisp2|first}} and {{Lisp2|rest}} when referring to conses which are part of a linked list (rather than, say, a tree).<br />
<br />
Thus, a Lisp list is not an atomic object, as an instance of a container class in C++ or Java would be. A list is nothing more than an aggregate of linked conses. A variable which refers to a given list is simply a pointer to the first cons in the list. Traversal of a list can be done by "cdring down" the list; that is, taking successive cdrs to visit each cons of the list; or by using any of a number of [[higher-order function]]s to map a function over a list.<br />
<br />
Because conses and lists are so universal in Lisp systems, it is a common misconception that they are Lisp's only data structures. In fact, all but the most simplistic Lisps have other data structures – such as vectors ([[Array data type|arrays]]), hash tables, structures, and so forth.<br />
<br />
====S-expressions represent lists====<br />
Parenthesized S-expressions represent linked list structures. There are several ways to represent the same list as an S-expression. A cons can be written in ''dotted-pair notation'' as {{Lisp2|(a . b)}}, where {{Lisp2|a}} is the car and {{Lisp2|b}} the cdr. A longer proper list might be written {{Lisp2|(a . (b . (c . (d . nil))))}} in dotted-pair notation. This is conventionally abbreviated as {{Lisp2|(a b c d)}} in ''list notation''. An improper list<ref>NB: a so-called "dotted list" is only one kind of "improper list". The other kind is the "circular list" where the cons cells form a loop. Typically this is represented using #n=(...) to represent the target cons cell that will have multiple references, and #n# is used to refer to this cons. For instance, (#1=(a b) . #1#) would normally be printed as ((a b) a b) (without circular structure printing enabled), but makes the reuse of the cons cell clear. #1=(a . #1#) cannot normally be printed as it is circular, the CDR of the cons cell defined by #1= is itself.</ref> may be written in a combination of the two – as {{Lisp2|(a b c . d)}} for the list of three conses whose last cdr is {{Lisp2|d}} (i.e., the list {{Lisp2|(a . (b . (c . d)))}} in fully specified form).<br />
<br />
====List-processing procedures====<br />
Lisp provides many built-in procedures for accessing and controlling lists. Lists can be created directly with the {{Lisp2|list}} procedure, which takes any number of arguments, and returns the list of these arguments.<br />
<syntaxhighlight lang=Lisp><br />
(list 1 2 'a 3)<br />
;Output: (1 2 a 3)<br />
</syntaxhighlight><br />
<syntaxhighlight lang=Lisp><br />
(list 1 '(2 3) 4)<br />
;Output: (1 (2 3) 4)<br />
</syntaxhighlight><br />
Because of the way that lists are constructed from [[cons pair]]s, the {{Lisp2|cons}} procedure can be used to add an element to the front of a list. Note that the {{Lisp2|cons}} procedure is asymmetric in how it handles list arguments, because of how lists are constructed.<br />
<syntaxhighlight lang=Lisp><br />
(cons 1 '(2 3))<br />
;Output: (1 2 3)<br />
</syntaxhighlight><br />
<syntaxhighlight lang=Lisp><br />
(cons '(1 2) '(3 4))<br />
;Output: ((1 2) 3 4)<br />
</syntaxhighlight><br />
The {{Lisp2|append}} procedure appends two (or more) lists to one another. Because Lisp lists are linked lists, appending two lists has [[Big O notation|asymptotic time complexity]] <math>O(n)</math><br />
<syntaxhighlight lang=Lisp><br />
(append '(1 2) '(3 4))<br />
;Output: (1 2 3 4)<br />
</syntaxhighlight><br />
<syntaxhighlight lang=Lisp><br />
(append '(1 2 3) '() '(a) '(5 6))<br />
;Output: (1 2 3 a 5 6)<br />
</syntaxhighlight><br />
<br />
====Shared structure====<br />
Lisp lists, being simple linked lists, can share structure with one another. That is to say, two lists can have the same ''tail'', or final sequence of conses. For instance, after the execution of the following Common Lisp code:<br />
<syntaxhighlight lang=Lisp><br />
(setf foo (list 'a 'b 'c))<br />
(setf bar (cons 'x (cdr foo)))<br />
</syntaxhighlight><br />
the lists {{Lisp2|foo}} and {{Lisp2|bar}} are {{Lisp2|(a b c)}} and {{Lisp2|(x b c)}} respectively. However, the tail {{Lisp2|(b c)}} is the same structure in both lists. It is not a copy; the cons cells pointing to {{Lisp2|b}} and {{Lisp2|c}} are in the same memory locations for both lists.<br />
<br />
Sharing structure rather than copying can give a dramatic performance improvement. However, this technique can interact in undesired ways with functions that alter lists passed to them as arguments. Altering one list, such as by replacing the {{Lisp2|c}} with a {{Lisp2|goose}}, will affect the other:<br />
<syntaxhighlight lang=Lisp><br />
(setf (third foo) 'goose)<br />
</syntaxhighlight><br />
This changes {{Lisp2|foo}} to {{Lisp2|(a b goose)}}, but thereby also changes {{Lisp2|bar}} to {{Lisp2|(x b goose)}} – a possibly unexpected result. This can be a source of bugs, and functions which alter their arguments are documented as ''destructive'' for this very reason.<br />
<br />
Aficionados of [[functional programming]] avoid destructive functions. In the Scheme dialect, which favors the functional style, the names of destructive functions are marked with a cautionary exclamation point, or "bang"—such as {{Lisp2|set-car!}} (read ''set car bang''), which replaces the car of a cons. In the Common Lisp dialect, destructive functions are commonplace; the equivalent of {{Lisp2|set-car!}} is named {{Lisp2|rplaca}} for "replace car." This function is rarely seen however as Common Lisp includes a special facility, {{Lisp2|setf}}, to make it easier to define and use destructive functions. A frequent style in Common Lisp is to write code functionally (without destructive calls) when prototyping, then to add destructive calls as an optimization where it is safe to do so.<br />
<br />
===Self-evaluating forms and quoting===<br />
Lisp evaluates expressions which are entered by the user. Symbols and lists evaluate to some other (usually, simpler) expression – for instance, a symbol evaluates to the value of the variable it names; {{Lisp2|(+ 2 3)}} evaluates to {{Lisp2|5}}. However, most other forms evaluate to themselves: if you enter {{Lisp2|5}} into Lisp, it returns {{Lisp2|5}}.<br />
<br />
Any expression can also be marked to prevent it from being evaluated (as is necessary for symbols and lists). This is the role of the {{Lisp2|quote}} special operator, or its abbreviation {{Lisp2|'}} (a single quotation mark). For instance, usually if you enter the symbol {{Lisp2|foo}} you will get back the value of the corresponding variable (or an error, if there is no such variable). If you wish to refer to the literal symbol, you enter {{Lisp2|(quote foo)}} or, usually, {{Lisp2|'foo}}.<br />
<br />
{{anchor|Backquote}}Both Common Lisp and Scheme also support the ''backquote'' operator (known as ''[[quasiquote]]'' in Scheme), entered with the {{Lisp2|`}} character ([[Grave accent#Use in programming|grave accent]]). This is almost the same as the plain quote, except it allows expressions to be evaluated and their values interpolated into a quoted list with the comma {{Lisp2|,}} ''unquote'' and comma-at {{Lisp2|,@}} ''splice'' operators. If the variable {{Lisp2|snue}} has the value {{Lisp2|(bar baz)}} then {{Lisp2|`(foo ,snue)}} evaluates to {{Lisp2|(foo (bar baz))}}, while {{Lisp2|`(foo ,@snue)}} evaluates to {{Lisp2|(foo bar baz)}}. The backquote is most frequently used in defining macro expansions.<ref>{{cite web|url=http://www.cs.washington.edu/education/courses/cse341/04wi/lectures/14-scheme-quote.html |title=CSE 341: Scheme: Quote, Quasiquote, and Metaprogramming |publisher=Cs.washington.edu |date=1999-02-22 |accessdate=2013-11-15}}</ref><ref>[http://repository.readscheme.org/ftp/papers/pepm99/bawden.pdf Quasiquotation in Lisp], Alan Bawden</ref><br />
<br />
Self-evaluating forms and quoted forms are Lisp's equivalent of literals. It may be possible to modify the values of (mutable) literals in program code. For instance, if a function returns a quoted form, and the code that calls the function modifies the form, this may alter the behavior of the function on subsequent iterations.<br />
<br />
<syntaxhighlight lang=lisp><br />
(defun should-be-constant ()<br />
'(one two three))<br />
<br />
(let ((stuff (should-be-constant)))<br />
(setf (third stuff) 'bizarre)) ; bad!<br />
<br />
(should-be-constant) ; returns (one two bizarre)<br />
</syntaxhighlight><br />
<br />
Modifying a quoted form like this is generally considered bad style, and is defined by ANSI Common Lisp as erroneous (resulting in "undefined" behavior in compiled files, because the file-compiler can coalesce similar constants, put them in write-protected memory, etc.).<br />
<br />
Lisp's formalization of quotation has been noted by [[Douglas Hofstadter]] (in ''[[Gödel, Escher, Bach]]'') and others as an example of the [[philosophy|philosophical]] idea of [[self-reference]].<br />
<br />
===Scope and closure===<br />
The Lisp family splits over the use of dynamic or static (a.k.a. lexical) [[scope (programming)|scope]]. Clojure, Common Lisp and Scheme make use of static scoping by default, while [[Newlisp]], [[Picolisp]] and the embedded languages in [[Emacs]] and [[AutoCAD]] use dynamic scoping.<br />
<br />
===List structure of program code; exploitation by macros and compilers===<br />
A fundamental distinction between Lisp and other languages is that in Lisp, the textual representation of a program is simply a human-readable description of the same internal data structures (linked lists, symbols, number, characters, etc.) as would be used by the underlying Lisp system.<br />
<br />
Lisp uses this to implement a very powerful macro system. Like other macro languages such as [[C (programming language)|C]], a macro returns code that can then be compiled. However, unlike C macros, the macros are Lisp functions and so can exploit the full power of Lisp.<br />
<br />
Further, because Lisp code has the same structure as lists, macros can be built with any of the list-processing functions in the language. In short, anything that Lisp can do to a data structure, Lisp macros can do to code. In contrast, in most other languages, the parser's output is purely internal to the language implementation and cannot be manipulated by the programmer.<br />
<br />
This feature makes it easy to develop ''efficient'' languages within languages. For example, the Common Lisp Object System can be implemented cleanly as a language extension using macros. This means that if an application requires a different inheritance mechanism, it can use a different object system. This is in stark contrast to most other languages; for example, Java does not support multiple inheritance and there is no reasonable way to add it.<br />
<br />
In simplistic Lisp implementations, this list structure is directly [[interpreter (computing)|interpreted]] to run the program; a function is literally a piece of list structure which is traversed by the interpreter in executing it. However, most substantial Lisp systems also include a compiler. The compiler translates list structure into machine code or [[bytecode]] for execution. This code can run as fast as code compiled in conventional languages such as C.<br />
<br />
Macros expand before the compilation step, and thus offer some interesting options. If a program needs a precomputed table, then a macro might create the table at compile time, so the compiler need only output the table and need not call code to create the table at run time. Some Lisp implementations even have a mechanism, <code>eval-when</code>, that allows code to be present during compile time (when a macro would need it), but not present in the emitted module.<ref>[http://www.gnu.org/software/emacs/manual/html_node/cl/Time-of-Evaluation.html Time of Evaluation - Common Lisp Extensions]. Gnu.org. Retrieved on 2013-07-17.</ref><br />
<br />
===Evaluation and the read–eval–print loop===<br />
Lisp languages are frequently used with an interactive [[command line]], which may be combined with an [[integrated development environment]]. The user types in expressions at the command line, or directs the IDE to transmit them to the Lisp system. Lisp ''reads'' the entered expressions, ''evaluates'' them, and ''prints'' the result. For this reason, the Lisp command line is called a "[[read–eval–print loop]]", or ''[[REPL]]''.<br />
<br />
The basic operation of the REPL is as follows. This is a simplistic description which omits many elements of a real Lisp, such as quoting and macros.<br />
<br />
The {{Lisp2|read}} function accepts textual S-expressions as input, and parses them into an internal data structure. For instance, if you type the text {{Lisp2|(+ 1 2)}} at the prompt, {{Lisp2|read}} translates this into a linked list with three elements: the symbol {{Lisp2|+}}, the number 1, and the number 2. It so happens that this list is also a valid piece of Lisp code; that is, it can be evaluated. This is because the car of the list names a function—the addition operation.<br />
<br />
Note that a {{Lisp2|foo}} will be read as a single symbol. {{Lisp2|123}} will be read as the number one hundred and twenty-three. {{Lisp2|"123"}} will be read as the string "123".<br />
<br />
The {{Lisp2|eval}} function evaluates the data, returning zero or more other Lisp data as a result. Evaluation does not have to mean interpretation; some Lisp systems compile every expression to native machine code. It is simple, however, to describe evaluation as interpretation: To evaluate a list whose car names a function, {{Lisp2|eval}} first evaluates each of the arguments given in its cdr, then applies the function to the arguments. In this case, the function is addition, and applying it to the argument list {{Lisp2|(1 2)}} yields the answer {{Lisp2|3}}. This is the result of the evaluation.<br />
<br />
The symbol {{Lisp2|foo}} evaluates to the value of the symbol foo. Data like the string "123" evaluates to the same string. The list {{Lisp2|(quote (1 2 3))}} evaluates to the list (1 2 3).<br />
<br />
It is the job of the {{Lisp2|print}} function to represent output to the user. For a simple result such as {{Lisp2|3}} this is trivial. An expression which evaluated to a piece of list structure would require that {{Lisp2|print}} traverse the list and print it out as an S-expression.<br />
<br />
To implement a Lisp REPL, it is necessary only to implement these three functions and an infinite-loop function. (Naturally, the implementation of {{Lisp2|eval}} will be complicated, since it must also implement all special operators like {{Lisp2|if}} or {{Lisp2|lambda}}.) This done, a basic REPL itself is but a single line of code: {{Lisp2|(loop (print (eval (read))))}}.<br />
<br />
The Lisp REPL typically also provides input editing, an input history, error handling and an interface to the debugger.<br />
<br />
Lisp is usually evaluated [[eager evaluation|eagerly]]. In [[Common Lisp]], arguments are evaluated in [[applicative order]] ('leftmost innermost'), while in [[Scheme programming language|Scheme]] order of arguments is undefined, leaving room for optimization by a compiler.<br />
<br />
===Control structures===<br />
Lisp originally had very few control structures, but many more were added during the language's evolution. (Lisp's original conditional operator, {{Lisp2|cond}}, is the precursor to later {{Lisp2|if-then-else}} structures.)<br />
<br />
Programmers in the Scheme dialect often express loops using [[tail recursion]]. Scheme's commonality in academic computer science has led some students to believe that tail recursion is the only, or the most common, way to write iterations in Lisp, but this is incorrect. All frequently seen Lisp dialects have imperative-style iteration constructs, from Scheme's {{Lisp2|do}} loop to [[Common Lisp]]'s complex {{Lisp2|loop}} expressions. Moreover, the key issue that makes this an objective rather than subjective matter is that Scheme makes specific requirements for the handling of [[tail call]]s, and consequently the reason that the use of tail recursion is generally encouraged for Scheme is that the practice is expressly supported by the language definition itself. By contrast, ANSI Common Lisp does not require<ref>[http://www.lispworks.com/documentation/HyperSpec/Body/03_bbc.htm 3.2.2.3 Semantic Constraints] in [http://www.lispworks.com/documentation/HyperSpec/Front/index.htm ''Common Lisp HyperSpec'']</ref> the optimization commonly referred to as tail call elimination. Consequently, the fact that tail recursive style as a casual replacement for the use of more traditional [[iteration]] constructs (such as {{Lisp2|do}}, {{Lisp2|dolist}} or {{Lisp2|loop}}) is discouraged<ref>4.3. Control Abstraction (Recursion vs. Iteration) in [http://www.cs.umd.edu/~nau/cmsc421/norvig-lisp-style.pdf Tutorial on Good Lisp Programming Style] by [[Kent Pitman|Pitman]] and [[Peter Norvig|Norvig]], August, 1993.</ref> in Common Lisp is not just a matter of stylistic preference, but potentially one of efficiency (since an apparent tail call in Common Lisp may not compile as a simple [[Branch (computer science)|jump]]) and program correctness (since tail recursion may increase stack use in Common Lisp, risking [[stack overflow]]).<br />
<br />
Some Lisp control structures are ''special operators'', equivalent to other languages' syntactic keywords. Expressions using these operators have the same surface appearance as function calls, but differ in that the arguments are not necessarily evaluated—or, in the case of an iteration expression, may be evaluated more than once.<br />
<br />
In contrast to most other major programming languages, Lisp allows the programmer to implement control structures using the language itself. Several control structures are implemented as Lisp macros, and can even be macro-expanded by the programmer who wants to know how they work.<br />
<br />
Both Common Lisp and Scheme have operators for non-local control flow. The differences in these operators are some of the deepest differences between the two dialects. Scheme supports ''re-entrant [[continuation]]s'' using the {{Lisp2|call/cc}} procedure, which allows a program to save (and later restore) a particular place in execution. Common Lisp does not support re-entrant continuations, but does support several ways of handling escape continuations.<br />
<br />
Frequently, the same algorithm can be expressed in Lisp in either an imperative or a functional style. As noted above, Scheme tends to favor the functional style, using tail recursion and continuations to express control flow. However, imperative style is still quite possible. The style preferred by many Common Lisp programmers may seem more familiar to programmers used to structured languages such as C, while that preferred by Schemers more closely resembles pure-functional languages such as [[Haskell (programming language)|Haskell]].<br />
<br />
Because of Lisp's early heritage in list processing, it has a wide array of higher-order functions relating to iteration over sequences. In many cases where an explicit loop would be needed in other languages (like a {{Lisp2|for}} loop in C) in Lisp the same task can be accomplished with a higher-order function. (The same is true of many functional programming languages.)<br />
<br />
A good example is a function which in Scheme is called {{Lisp2|map}} and in Common Lisp is called {{Lisp2|mapcar}}. Given a function and one or more lists, {{Lisp2|mapcar}} applies the function successively to the lists' elements in order, collecting the results in a new list:<br />
<syntaxhighlight lang=Lisp><br />
(mapcar #'+ '(1 2 3 4 5) '(10 20 30 40 50))<br />
</syntaxhighlight><br />
This applies the {{Lisp2|+}} function to each corresponding pair of list elements, yielding the result {{Lisp2|(11 22 33 44 55)}}.<br />
<br />
==Examples==<br />
Here are examples of Common Lisp code.<br />
<br />
The basic "[[Hello world]]" program:<br />
<syntaxhighlight lang=Lisp><br />
(print "Hello world")<br />
</syntaxhighlight><br />
Lisp syntax lends itself naturally to recursion. Mathematical problems such as the enumeration of recursively defined sets are simple to express in this notation.<br />
<br />
Evaluate a number's [[factorial]]:<br />
<syntaxhighlight lang=Lisp><br />
(defun factorial (n)<br />
(if (= n 0) 1<br />
(* n (factorial (- n 1)))))<br />
</syntaxhighlight><br />
An alternative implementation, often faster than the previous version if the Lisp system has [[tail recursion]] optimization:<br />
<syntaxhighlight lang=Lisp><br />
(defun factorial (n &optional (acc 1))<br />
(if (= n 0) acc<br />
(factorial (- n 1) (* acc n))))<br />
</syntaxhighlight><br />
Contrast with an iterative version which uses [[Common Lisp]]'s {{Lisp2|loop}} macro:<br />
<syntaxhighlight lang=Lisp><br />
(defun factorial (n)<br />
(loop for i from 1 to n<br />
for fac = 1 then (* fac i)<br />
finally (return fac)))<br />
</syntaxhighlight><br />
<br />
The following function reverses a list. (Lisp's built-in ''reverse'' function does the same thing.)<br />
<syntaxhighlight lang=Lisp><br />
(defun -reverse (list)<br />
(let ((return-value '()))<br />
(dolist (e list) (push e return-value))<br />
return-value))<br />
</syntaxhighlight><br />
<br />
==Object systems==<br />
Various object systems and models have been built on top of, alongside, or into Lisp, including:<br />
*The [[Common Lisp Object System]], CLOS, is an integral part of ANSI Common Lisp. CLOS descended from New Flavors and CommonLOOPS. ANSI Common Lisp was the first standardized object-oriented programming language (1994, ANSI X3J13).<br />
*ObjectLisp<ref>pg 17 of Bobrow 1986</ref> or [[Object Lisp]], used by [[Lisp Machines Incorporated]] and early versions of Macintosh Common Lisp<br />
*LOOPS (Lisp Object-Oriented Programming System) and the later [[CommonLOOPS]]<br />
*[[Flavors (computer science)|Flavors]], built at [[Massachusetts Institute of Technology|MIT]], and its descendant New Flavors (developed by [[Symbolics]]).<br />
*KR (short for Knowledge Representation), a [[Constraint satisfaction|constraint]]s-based object system developed to aid the writing of Garnet, a GUI library for [[Common Lisp]].<br />
*[[Knowledge Engineering Environment|KEE]] used an object system called UNITS and integrated it with an [[inference engine]]<ref>Veitch, p 108, 1988</ref> and a [[Truth maintenance systems|truth maintenance system]] (ATMS).<br />
<br />
==See also==<br />
*[[Fexpr]]<br />
*[[Maxima (software)|Maxima]]<br />
*[[mod_lisp]]<br />
*[[P convention]]<br />
*[[Prolog]]<br />
*[[LFE (programming language)|LFE]] (Lisp Flavored Erlang)<br />
* [[RPL (programming language)|RPL]] (Reverse Polish Lisp)<br />
*[[MATHLAB]]<br />
<br />
==References==<br />
{{Reflist|30em}}<br />
<br />
==Further reading==<br />
{{Refbegin}}<br />
*{{cite web<br />
| last = McCarthy<br />
| first = John<br />
| authorlink =<br />
| title = The implementation of Lisp<br />
| work = History of Lisp<br />
| publisher = Stanford University<br />
| date = 1979-02-12<br />
| url = http://www-formal.stanford.edu/jmc/history/lisp/node3.html<br />
| doi =<br />
| accessdate = 2008-10-17}}<br />
*{{Cite conference<br />
| first = Guy L.<br />
| last = Steele, Jr.<br />
| authorlink =<br />
|author2=Richard P. Gabriel<br />
| title = The evolution of Lisp<br />
| conference = The second ACM SIGPLAN conference on History of programming languages<br />
| pages = 231–270<br />
| publisher = ACM<br />
| year = 1993<br />
| location = New York, NY<br />
| url = http://www.dreamsongs.com/NewFiles/HOPL2-Uncut.pdf<br />
| doi =<br />
| id =<br />
| isbn = 0-89791-570-4<br />
| accessdate = 2008-10-17}}<br />
*{{Cite book<br />
| first = Jim<br />
| last = Veitch<br />
| author-link =<br />
| author2-link =<br />
| editor-last = Salus<br />
| editor-first = Peter H<br />
| editor2-last =<br />
| editor2-first =<br />
| contribution = A history and description of CLOS<br />
| contribution-url =<br />
| title = Handbook of programming languages<br />
| volume = Volume IV, Functional and logic programming languages<br />
| edition = first<br />
| year = 1998<br />
| pages = 107–158<br />
| place = Indianapolis, IN<br />
| publisher = Macmillan Technical Publishing<br />
| url =<br />
| doi =<br />
| id =<br />
| isbn = 1-57870-011-6<br />
| postscript = <!--None--> }}<br />
*{{Cite book<br />
|title= [[Structure and Interpretation of Computer Programs]]<br />
|first= Harold<br />
|last= Abelson<br />
|author-link= Harold Abelson<br />
|first2= Gerald Jay<br />
|last2= Sussman<br />
|author2-link= Gerald Jay Sussman<br />
|first3= Julie<br />
|last3= Sussman<br />
|author3-link= Julie Sussman<br />
|year= 1996<br />
|edition= 2nd<br />
|publisher= MIT Press<br />
|isbn= 0-262-01153-0<br />
|doi= }}<br />
*[http://www.gnu.org/gnu/rms-lisp.html My Lisp Experiences and the Development of GNU Emacs], [[transcription (linguistics)|transcript]] of [[Richard Stallman]]'s speech, 28 October 2002, at the [[International Lisp Conference]]<br />
*{{Cite book<br />
|first= Paul<br />
|last= Graham<br />
|author-link= Paul Graham (computer programmer)<br />
|title= [[Hackers & Painters| Hackers & Painters. Big Ideas from the Computer Age]]<br />
|year= 2004<br />
|publisher= O'Reilly<br />
|isbn= 0-596-00662-4<br />
|doi= }}<br />
*{{Cite book<br />
|editor-last= Berkeley<br />
|editor-first= Edmund C.<br />
|editor-link= Edmund Berkeley<br />
|editor2-last= Bobrow<br />
|editor2-first= Daniel G.<br />
|editor2-link= Daniel G. Bobrow<br />
|title= The Programming Language LISP: Its Operation and Applications<br />
|url= http://www.softwarepreservation.org/projects/LISP/book/III_LispBook_Apr66.pdf<br />
|date= March 1964<br />
|publisher= MIT Press<br />
|location= Cambridge, Massachusetts<br />
|isbn=<br />
|doi= }}<br />
*{{Cite book<br />
|last= Weissman<br />
|first= Clark<br />
|title= LISP 1.5 Primer<br />
|year= 1967<br />
|url= http://www.softwarepreservation.org/projects/LISP/book/Weismann_LISP1.5_Primer_1967.pdf<br />
|publisher= Dickenson Publishing Company Inc.<br />
|location= Belmont, California<br />
|isbn=<br />
|doi=}}<br />
{{Refend}}<br />
<br />
==External links==<br />
{{Sister project links|wikt=Lisp|commons=Category:Lisp (programming language)|n=no|q=Lisp programming language|b=Subject:Lisp programming language|v=Topic:Lisp|s=Lambda Papers}}<br />
;History<br />
*[http://www-formal.stanford.edu/jmc/history/lisp/lisp.html History of Lisp] – [[John McCarthy (computer scientist)|John McCarthy]]'s history of 12 February 1979<br />
*[http://www8.informatik.uni-erlangen.de/html/lisp-enter.html Lisp History]{{dead link|date=May 2013}} – Herbert Stoyan's history compiled from the documents (acknowledged by McCarthy as more complete than his own, see: [http://www-formal.stanford.edu/jmc/history/ McCarthy's history links])<br />
*[http://www.softwarepreservation.org/projects/LISP/ History of LISP at the Computer History Museum]<br />
<br />
;Associations and meetings<br />
*[http://www.alu.org/ Association of Lisp Users]<br />
*[http://www.weitz.de/eclm2013/ European Common Lisp Meeting]<br />
*[http://european-lisp-symposium.org/ European Lisp Symposium]<br />
*[http://www.international-lisp-conference.org/ International Lisp Conference]<br />
<br />
; Books and tutorials<br />
*''[http://www.lisperati.com/casting.html Casting SPELs in Lisp]'', a comic-book style introductory tutorial<br />
*''[http://paulgraham.com/onlisptext.html On Lisp]'', a free book by [[Paul Graham (computer programmer)|Paul Graham]]<br />
*''[http://www.gigamonkeys.com/book/ Practical Common Lisp]'', freeware edition by Peter Seibel<br />
* [http://leanpub.com/lispweb Lisp for the web]<br />
* [http://landoflisp.com/ Land of Lisp]<br />
* [http://letoverlambda.com/ Let over Lambda]<br />
<br />
; Interviews<br />
*[http://purl.umn.edu/107476 Oral history interview with John McCarthy] at [[Charles Babbage Institute]], University of Minnesota, Minneapolis. McCarthy discusses his role in the development of time-sharing at the Massachusetts Institute of Technology. He also describes his work in artificial intelligence (AI) funded by the Advanced Research Projects Agency, including logic-based AI (LISP) and robotics.<br />
*[http://www.se-radio.net/2008/01/episode-84-dick-gabriel-on-lisp/ Interview] with [[Richard P. Gabriel]] (Podcast)<br />
<br />
;Resources<br />
*[http://www.cliki.net/ CLiki: the common lisp wiki]<br />
*[http://www.cl-user.net/ Common Lisp directory]<br />
*[http://www.faqs.org/faqs/lisp-faq/ Lisp FAQ Index]<br />
*[http://paste.lisp.org/ lisppaste]<br />
*[http://planet.lisp.org/ Planet Lisp]<br />
*[http://lispnews.wordpress.com/ Weekly Lisp News]<br />
*{{dmoz|Computers/Programming/Languages/Lisp|Lisp}}<br />
<br />
{{John McCarthy navbox}}<br />
<br />
{{DEFAULTSORT:Lisp Programming Language}}<br />
[[Category:1958 in computer science]]<br />
[[Category:Academic programming languages]]<br />
[[Category:American inventions]]<br />
[[Category:Articles with example Lisp code]]<br />
[[Category:Dynamically typed programming languages]]<br />
[[Category:Functional languages]]<br />
[[Category:Lisp (programming language)| ]]<br />
[[Category:Lisp programming language family| ]]<br />
[[Category:Programming languages created in 1958]]<br />
[[Category:Programming languages created in the 1950s]]<br />
[[Category:Extensible syntax programming languages]]<br />
<br />
[[la:Lisp]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Linda_Cardellini&diff=697813805Linda Cardellini2016-01-02T02:48:43Z<p>PuercoPop: Remove line feed character from web citation template</p>
<hr />
<div>{{Use mdy dates|date=October 2013}}<br />
{{Infobox person<br />
| name = Linda Cardellini<br />
| image = Linda Cardellini Deauville 2011.jpg<br />
| caption = Cardellini at the 2011<br>[[Deauville American Film Festival]]<br />
| alt = Wearing a violet sleeveless wrap, hair in a shoulder-length feather cut<br />
| birth_date = {{Birth date and age|mf=yes|1975|6|25}}<br />
| birth_place = [[Redwood City, California]], U.S.<br />
| birth_name = Linda Edna Cardellini<br />
| occupation = [[Actress]], [[Voice actor]]<br />
| years_active = 1996–present<br />
| education = [[Loyola Marymount University]]<br />
| partner = Steven Rodriguez <small>(2009-present; engaged since 2013)</small><br />
| children = 1<br />
| spouse =<br />
| website =<br />
}}<br />
'''Linda Edna Cardellini''' (born June 25, 1975) is an American actress. She is known for her roles as [[Lindsay Weir (Freaks and Geeks)|Lindsay Weir]] on ''[[Freaks and Geeks]]'', [[Samantha Taggart]] on ''[[ER (TV series)|ER]]'', [[Velma Dinkley]] in the live-action ''[[Scooby-Doo (film)|Scooby-Doo]]'' feature films, Sylvia Rosen, neighbor of [[Don Draper]]'s, on the [[AMC (TV channel)|AMC]] drama series ''[[Mad Men]]'', Meg Rayburn on the [[Netflix]] original series ''[[Bloodline (TV series)|Bloodline]]'', Laura Barton in ''[[Avengers: Age of Ultron]]'', and Wendy Corduroy in ''[[Gravity Falls]]''.<br />
<br />
==Early life==<br />
Cardellini was born in [[Redwood City, California]], the daughter of Lorraine (née Hernan), a homemaker, and Wayne David Cardellini, a businessman.<ref name="knockoutnerd">{{cite web|url=http://www.people.com/people/archive/article/0,,20137425,00.html|title=Knockout Nerd - Scooby-Doo, Linda Cardellini|work=[[People (magazine)|People]]|date=July 1, 2002 |accessdate=June 9, 2013}}</ref> She is the youngest of four children.<ref name="knockoutnerd"/> Cardellini is of Italian (from her paternal grandfather), Irish (her mother), German, English, and Scottish descent,<ref>{{cite web|url=http://www.starpulse.com/news/Jason_Coleman/2012/02/10/interviewreview_linda_cardellini_on_re|title=Interview/Review: Linda Cardellini On Researching 'Return', Michael Shannon And Being A First-Time Mom|publisher=Starpulse.com|date=February 10, 2012|accessdate=June 9, 2013}}</ref><ref>{{cite web | url=http://www.imdb.com/name/nm0004802/bio?ref_=nm_ov_bio_sm|title=Linda Cardellini Biography|publisher=IMDb.com|accessdate=2015-09-19}}</ref> and was raised Catholic.<ref>{{cite web|last=Watkins |first=Gwynne |url=http://www.gq.com/blogs/the-feed/2013/06/mad-men-interview-linda-cardellini-sylvia-rosen.html |title=The Mad Men GQ+A: Linda Cardellini on Sylvia Rosen's Extramarital Bombshell: The Q |publisher=GQ |date=June 12, 2013 |accessdate=October 31, 2013}}</ref> She made her first public appearance at age 10, when she sang in a school play. Subsequently, she acted in several school productions and started attending drama lessons.<ref name="NYDN"/> She graduated from nearby [[Mountain View, California|Mountain View]]'s Catholic [[Saint Francis High School (Mountain View)|St. Francis High School]] in 1993,<ref name="AskMen"/> then moved to Los Angeles to seek roles in television and film.<ref name="NYDN"/><br />
<br />
==Career==<br />
Cardellini received her first big break role in 1996 when she landed a starring role as Sarah on [[American Broadcasting Company|ABC]]'s Saturday morning live-action children's series, ''[[Bone Chillers]]''. Following this, she made guest appearances on prime-time programs such as ''[[Step by Step (TV series)|Step by Step]]'', ''[[Clueless (TV series)|Clueless]]'', ''[[3rd Rock from the Sun]]'', and ''[[Boy Meets World]]'' as Lauren, a girl that came between the show's star couple. Cardellini co-starred in the [[AMC (TV channel)|AMC]] mini-series ''The Lot'' in 1999,<ref name="NYDN" /> and spent the summer in Europe as part of a touring production of ''Lancelot'', a fourteenth-century Dutch tragedy.<ref name="AskMen" /><br />
<br />
[[File:Linda Cardellini onstage.jpg|thumb|left|alt=in black jeans and off-the-shoulder sleeve top, gesturing palm up to audience|Cardellini as part of "Dr. God", 2010]]<br />
Cardellini had her first major success when she landed one of the starring roles in the [[NBC]] series ''[[Freaks and Geeks]]'', which debuted during the 1999–2000 season. As Lindsay Weir, an honor student in the midst of an identity crisis, Cardellini earned positive response that subsequently catapulted her to fame. Cardellini starred in the live-action adaptation of ''[[Scooby-Doo (film)|Scooby-Doo]]'' in 2002, in which she brought to life the cartoon character of Velma Dinkley. She would later reprise the role of Velma in 2004's ''[[Scooby-Doo 2: Monsters Unleashed]]''. She joined the cast of the hospital drama ''[[ER (TV series)|ER]]'' in 2003 as Samantha Taggart, a free-spirited nurse. Cardellini acted for six seasons on ''ER'', until the series finale, "[[And in the End...]]", and with the cast won the [[TV Land]] ensemble ''Icon Award'' in 2009.<ref name="MnC">{{cite web|title=TV Land Awards gives Icon award to 'ER'|first=April|last=MacIntyre|date=April 9, 2009|publisher=[[Monsters and Critics]]|url=http://www.monstersandcritics.com/smallscreen/news/article_1469892.php/2009_TV_Land_Awards_gives_Icon_award_to_ER}}</ref><br />
<br />
Her other film work includes roles in ''[[Dead Man on Campus]]'', ''[[Strangeland (film)|Strangeland]]'', ''[[Good Burger]]'', ''[[Legally Blonde]]'', ''[[Brokeback Mountain]]'' (for which she was nominated for the ensemble [[Gotham Awards|Gotham]]<ref name="FMM">[http://www.filmmakermagazine.com/news/2005/10/gotham-awards-nominations-announced/ Gotham Awards Nominations Announced]. FilmMakerMagazine.com, October 25, 2005.</ref> and [[Screen Actors Guild]] awards),<ref>{{cite web |title=12th Annual Screen Actors Guild Awards and Nominees |publisher=[[Screen Actors Guild]] |year=2006 |url=http://www.sagawards.org/awards/nominees-and-recipients/12th-annual-screen-actors-guild-awards}}</ref> and a starring role in the [[Happy Madison]] film ''[[Grandma's Boy (2006 film)|Grandma's Boy]]'' as Samantha. She was the voice of Ursula in the [[Role-playing game|role-playing]] video game, ''[[Gladius (video game)|Gladius]]'', and played the voice of Bliss Goode on the ABC animated series ''[[The Goode Family]]''. In 2007, Cardellini was chosen to play lovelorn Clara in the [[CBS]] miniseries ''[[Comanche Moon (TV miniseries)|Comanche Moon]]'', a prequel to 1989's ''[[Lonesome Dove]]''.<ref name="ew" /><br />
<br />
In 2010 and 2011, Cardellini returned to the stage with the Dr. God comedy group in Los Angeles and San Francisco,<ref name="drgod"/><ref name="sfsketch"/> appeared in ''[[Kill the Irishman]]'' and [[Super (2011 film)|''Super'']], and starred in the independent film [[Return (2011 film)|''Return'']].<br />
<br />
Cardellini appeared with cast members and producers of ''[[Freaks and Geeks]]'' and ''[[Undeclared]]'' at the [[Paley Center for Media]] PaleyFest on March 12, 2011.<ref>{{cite web|url=http://www.paleycenter.org/paleyfest2011-freaksgeeksundeclared|title=Freaks and Geeks / Undeclared Reunion|publisher=PaleyCenter.org|date=March 12, 2011|accessdate=March 16, 2011}}</ref><ref>{{cite web|url=http://tv.ign.com/articles/115/1155388p1.html|title=Freaks and Geeks Still Rocks|work=IGN|date=March 14, 2011|accessdate=March 16, 2011}}</ref> Since June 15, 2012, she has been the voice of Wendy on the Disney Channel show ''[[Gravity Falls]]''.<br />
<br />
Cardellini voice acts periodically on the podcast and live show ''[[The Thrilling Adventure Hour]]'', on the ''Sparks Nevada: Marshall on Mars'' segments.<ref>{{cite web|url=http://thrillingadventurehour.com/theshow.php |accessdate=October 31, 2013 |title=About the Show and the Segments Within - Sparks Nevada, Marshal on Mars |publisher=The Thrilling Adventure Hour }}</ref><ref>{{cite web|url=http://blogs.laweekly.com/arts/2010/06/martians_and_superheroes_and_n.php |title=Martians and Superheroes and Nazis, Oh My!: 'Adventure Hour' Thrills Sell-Out Largo Crowd|first=Nicole |last=Campos |publisher=LA Weekly |date=June 8, 2010 |work=Public Spectacle art blog (We Recommend) |accessdate=October 31, 2013}}</ref><br />
<br />
In 2013, Cardellini was chosen to play Sylvia Rosen, a love interest of [[Don Draper]] on ''[[Mad Men]]''. For her performance on ''Mad Men'', she received an Emmy nomination for Outstanding Guest Actress in a Drama Series. She joined [[Kyle Chandler]] on a new [[Netflix]] series [[Bloodline (TV series)|''Bloodline'']] from the creators of ''[[Damages (TV series)|Damages]]''.<ref>{{cite web|url=http://www.tvwise.co.uk/2014/03/norbert-leo-butz-joins-netflixs-drama-series-damages-creators-todd-kessler-glenn-kessler-daniel-zelman/ |title=Norbert Leo Butz Joins Netflix's Drama Series From 'Damages' Creators Todd A. Kessler, Glenn Kessler & Daniel Zelman |publisher=TVWise |date= |accessdate=2015-09-19}}</ref><br />
<br />
== Personal life ==<br />
Cardellini attended [[Loyola Marymount University]]'s<ref>[http://www.lmu.edu/sites/alumnirelations/Events/Event_Photos/LA_Leaders__LMU_Distinguished_Alumni_Reception_2007.htm "LA Leaders, LMU Distinguished Alumni Reception 2007"]. [[Loyola Marymount University]]. February 22, 2007. Retrieved January 2, 2013.</ref> College of [[Communication studies|Communication]] and [[fine art|Fine Arts]], graduating in 2000<!-- source ^^^ says 1997 wha?--> with a degree in theatre arts. In 2007, she was recognized as a "Distinguished Alumnus" by the university.<ref>[http://www.lmu.edu/sites/alumnirelations/Awards___Scholarships/Awards/Distinguished_Alumni_Awardees_1970-present.htm "Distinguished Alumni Awardees 1970-present"]. Loyola Marymount University. Retrieved January 2, 2013.</ref><br />
<br />
Cardellini dated her ''Freaks and Geeks'' co-star [[Jason Segel]] for a few years following the show's cancellation.<ref>{{cite web|url=http://www.latimes.com/entertainment/news/la-ca-segel13apr13,0,6976921.story|title=This breakup really broke up Jason Segel |work=[[Los Angeles Times]] |date=April 13, 2008 |accessdate=June 7, 2013}}</ref><br />
<br />
In October 2011, Cardellini and her boyfriend Steven Rodriguez announced her pregnancy.<ref>{{cite web|url=http://celebritybabies.people.com/2011/10/18/linda-cardellini-expecting-first-child/ |title=Linda Cardellini Expecting First Child – Moms & Babies – Moms & Babies - People.com |publisher=Celebritybabies.people.com |date=June 22, 2011 |accessdate=February 8, 2012}}</ref> Cardellini gave birth to their daughter Lilah-Rose in February 2012.<ref>{{cite web|url=http://celebritybabies.people.com/2012/03/06/linda-cardellini-welcomes-daughter-lilah-rose/|title=Linda Cardellini Welcomes Daughter Lilah-Rose |work=[[People (magazine)|People]]|date=March 6, 2012 |accessdate=March 6, 2012}}</ref> Cardellini and Rodriguez became engaged in June 2013.<ref>{{cite web|url=http://www.huffingtonpost.com/2013/06/07/linda-cardellini-engaged-steven-rodriguez_n_3404140.html|title=Linda Cardellini Engaged: 'Freaks And Geeks' Actress And Boyfriend Steven Rodriguez Set To Wed |work=[[The Huffington Post]] |date=June 7, 2013|accessdate=June 7, 2013}}</ref><br />
<br />
== Filmography ==<br />
[[File:PaleyFest 2011 - Freaks and Geeks Reunion - the cast.jpg|thumb|right|150px|alt=Linda seated with group, in director's chair, in white sleeveless mini and silver closed heels |Cardellini at the 2011 PaleyFest]]<br />
<br />
===Film===<br />
{| class="wikitable sortable"<br />
|-<br />
! Year<br />
! Title<br />
! Role<br />
! class="unsortable" | Notes<br />
|-<br />
| 1997<br />
| ''[[Good Burger]]''<br />
| Heather<br />
|<br />
|-<br />
| 1998<br />
| ''[[Dead Man on Campus]]''<br />
| Kelly<br />
|<br />
|-<br />
| 1998<br />
| ''[[Strangeland (film)|Strangeland]]''<br />
| Genevieve Gage<br />
|<br />
|-<br />
| 1999<br />
| ''{{sortname|The|Prince and the Surfer}}''<br />
| Melissa<br />
|<br />
|-<br />
| 2001<br />
| ''[[Legally Blonde]]''<br />
| Chutney Wyndham<br />
|<br />
|-<br />
| 2001<br />
| ''{{sortname|The|Unsaid}}''<br />
| Shelly Hunter<br />
|<br />
|-<br />
| 2002<br />
| ''[[Scooby-Doo (film)|Scooby-Doo]]''<br />
| [[Velma Dinkley]]<br />
|<br />
|-<br />
| 2002<br />
| ''Certainly Not a Fairytale''<ref>{{cite web|title=SEARCHLAB/Shorts: ''Certainly Not A Fairy Tale'' |publisher= Fox Searchlight SearchLab. |date=January 4, 2007 <!-- Produced 2002, per credits -->|url=http://content.foxsearchlight.com/videos/node/617 |archiveurl=http://web.archive.org/web/20101025195928/http://content.foxsearchlight.com/videos/node/617 |archivedate=October 25, 2010}}</ref><br />
| Adelle/Writer<br />
| Short film<br />
|-<br />
| 2004<br />
| ''[[Scooby-Doo 2: Monsters Unleashed]]''<br />
| Velma Dinkley<br />
|<br />
|-<br />
| 2004<br />
| ''[[Jiminy Glick in Lalawood]]''<br />
| Natalie Coolidge<br />
|<br />
|-<br />
| 2004<br />
| ''[[LolliLove]]''<br />
| Linda<br />
|<br />
|-<br />
| 2005<br />
| ''[[Brokeback Mountain]]''<br />
| Cassie Cartwright<br />
|<br />
|-<br />
| 2005<br />
| ''[[American Gun (2005 film)|American Gun]]''<br />
| Mary Ann Wilk<br />
|<br />
|-<br />
| 2006<br />
| ''[[Grandma's Boy (2006 film)|Grandma's Boy]]''<br />
| Samantha<br />
|<br />
|-<br />
| 2008<br />
| ''{{sortname|The|Lazarus Project}}''<br />
| Julie Ingram<br />
|<br />
|-<br />
| 2010<br />
| ''Gleeclipse''<br />
| Coach<br />
| Short film<br />
|-<br />
| 2011<br />
| ''[[Kill the Irishman]]''<br />
| Joan Madigan<br />
|<br />
|-<br />
| 2011<br />
| ''[[Super (2011 film)|Super]]''<br />
| Pet Store Employee<br />
|<br />
|-<br />
| 2011<br />
|''[[All-Star Superman (film)|All-Star Superman]]''<br />
| Nasthalthia "Nasty" Luthor (voice)<br />
| Direct-to-DVD<br />
|-<br />
| 2011<br />
| ''[[Return (2011 film)|Return]]''<br />
| Kelli<br />
|<br />
|-<br />
| 2014<br />
| ''[[Welcome to Me]]''<br />
| Gina<br />
| <br />
|-<br />
| 2015<br />
| ''[[Avengers: Age of Ultron]]''<br />
| Laura Barton<br />
| <br />
|-<br />
| 2015<br />
| ''[[Daddy's Home (film)|Daddy's Home]]''<br />
| Sara Whitaker<br />
| <br />
|-<br />
| 2016<br />
| ''[[The Founder (film)|The Founder]]''<br />
| Joan Smith<br />
| Filming<br />
|}<br />
<br />
===Television===<br />
{| class="wikitable sortable"<br />
|-<br />
! Year<br />
! Title<br />
! Role<br />
! class="unsortable" | Notes<br />
|-<br />
| 1996<br />
|''[[Bone Chillers]]''<br />
|Sarah<br />
|13 episodes<br />
|-<br />
| 1997<br />
|''[[3rd Rock from the Sun]]''<br />
|Lorna<br />
|Episode: "Dickmalion"<br />
|-<br />
| 1997<br />
|''[[Pacific Palisades (TV series)|Pacific Palisades]]''<br />
|Sara<br />
|2 episodes<br />
|-<br />
| 1997<br />
|''[[Clueless (TV series)|Clueless]]''<br />
|Oddrey<br />
|Episode: "Chick Fight Tonight"<br />
|-<br />
| 1997<br />
|''[[Step by Step (TV series)|Step by Step]]''<br />
|Cassie Evans<br />
|Episode: "Girls Just Wanna Have Fun"<br />
|-<br />
|1998<br />
|''[[Promised Land (1996 TV series)|Promised Land]]''<br />
|Amber<br />
|Episode: "Chasin' the Blues"<br />
|-<br />
| 1998<br />
|''[[Kenan & Kel]]''<br />
|Becky<br />
|Episode: "Chicago Witch Trials"<br />
|-<br />
|1998–1999<br />
|''[[Guys Like Us]]''<br />
|Jude<br />
|6 episodes<br />
|-<br />
|1998–1999<br />
|''[[Boy Meets World]]''<br />
|Lauren<br />
|4 episodes<br />
|-<br />
| 1999<br />
| ''Dying to Live''<br />
| Leslie Dugger<br />
| Television film<br />
|-<br />
|1999<br />
|''[[The Lot]]''<br />
|June Parker<br />
|4 episodes<br />
|-<br />
|1999–2000<br />
|''[[Freaks and Geeks]]''<br />
|[[Lindsay Weir (Freaks and Geeks)|Lindsay Weir]]<br />
|18 episodes<br />
|-<br />
|2003<br />
|''[[The Twilight Zone (2002 TV series)|The Twilight Zone]]''<br />
|Ali Warner<br />
|Episode: "[[The Path (The Twilight Zone)|The Path]]"<br />
|-<br />
|2003–2009<br />
|''[[ER (TV series)|ER]]''<br />
|[[Samantha Taggart]]<br />
|128 episodes<br />
|-<br />
|2005–2012<br />
|''[[Robot Chicken]]''<br />
|Velma Dinkley / Various voices<br />
|3 episodes<br />
|-<br />
|2007<br />
|''[[Human Giant]]''<br />
|Melody Richards<br />
|Episode: "Mind Explosion"<br />
|-<br />
|2008<br />
|''[[Comanche Moon (TV miniseries)|Comanche Moon]]''<br />
|Clara Forsythe<br />
|3 episodes<br />
|-<br />
|2009<br />
|''[[Cupid (2009 TV series)|Cupid]]''<br />
|Masseuse<br />
|Episode: "My Fair Masseuse" (uncredited){{citation needed|date=July 2015}}<br />
|-<br />
|2009<br />
|''[[The Goode Family]]''<br />
|Bliss Goode (voice)<br />
|13 episodes<br />
|-<br />
|2011<br />
|''[[Person of Interest (TV series)|Person of Interest]]''<br />
|Dr. Megan Tillman<br />
|Episode: "Cura Te Ipsum"<br />
|-<br />
|2011–2013<br />
|''[[Scooby-Doo! Mystery Incorporated]]''<br />
|Marcy 'Hot Dog Water' Fleach / Various voices<br />
|8 episodes<br />
|-<br />
|2012–present<br />
|''[[Regular Show]]''<br />
|C.J. (voice)<br />
|24 episodes<br />
|-<br />
|2012–present<br />
|''[[Gravity Falls]]''<br />
|Wendy Corduroy (voice)<br />
|29 episodes<br />
|-<br />
|2013<br />
|''[[Out There (2013 TV series)|Out There]]''<br />
|Sharla Lemoyne (voice)<br />
|5 episodes<br />
|-<br />
|2013–2015<br />
|''[[Mad Men]]''<br />
|Sylvia Rosen<br />
|9 episodes<br />
|-<br />
|2013–present<br />
|''[[Sanjay and Craig]]''<br />
|Megan Sparkles (voice)<br />
|27 episodes<br />
|-<br />
|2014<br />
|''[[New Girl]]''<br />
|Abby Day<br />
|3 episodes<br />
|-<br />
|2015–present<br />
|''[[Bloodline (TV series)|Bloodline]]''<br />
|Meg Rayburn<br />
|13 episodes<br />
|}<br />
<br />
===Music videos===<br />
{| class="wikitable"<br />
|-<br />
! Year<br />
! Title<br />
! Artist<br />
|-<br />
| 2002<br />
| "[[Land of a Million Drums]]"<br />
| [[Outkast]]<br />
|-<br />
| 2008<br />
| "[[Sing Along]]"<br />
| [[Virginia Coalition]]<br />
|}<br />
<br />
===Video games===<br />
{| class="wikitable"<br />
|-<br />
! Year<br />
! Title<br />
! Voice role<br />
|-<br />
|2003<br />
|''[[Gladius (video game)|Gladius]]''<br />
|Ursula<br />
|-<br />
|2004<br />
|''Scooby-Doo 2: Monsters Unleashed''<br />
|Velma Dinkley<br />
|-<br />
|2012<br />
|''[[Lollipop Chainsaw]]''<br />
|Cordelia Starling<br />
|}<br />
<br />
==Awards and nominations==<br />
{| class="wikitable sortable"<br />
|-<br />
! Year<br />
! Association<br />
! Category<br />
! Nominated work<br />
! Result<br />
|-<br />
|2005<br />
| [[Gotham Awards]]<br />
|Best Ensemble Cast{{citation needed|date=April 2015}}<br />
|rowspan=2|''Brokeback Mountain''<br />
| {{nom}}<br />
|-<br />
|2006<br />
| [[Screen Actors Guild]]<br />
|[[Screen Actors Guild Award for Outstanding Performance by a Cast in a Motion Picture|Outstanding Performance by a Cast in a Motion Picture]]<br />
| {{nom}}<br />
|-<br />
|2009<br />
| [[TV Land Awards]]<br />
|[[TV Land Award#Recipients|Icon]]<br />
|''ER''<br />
| {{won}}<br />
|-<br />
|rowspan=2|2013<br />
| [[Independent Spirit Awards]]<br />
|[[Independent Spirit Award for Best Female Lead|Best Female Lead]]<br />
|''Return''<br />
| {{nom}}<br />
|-<br />
| [[Primetime Emmy Awards]]<br />
|[[Primetime Emmy Award for Outstanding Guest Actress in a Drama Series|Outstanding Guest Actress in a Drama Series]]<br />
|''Mad Men''<br />
| {{nom}}<br />
|}<br />
<br />
== References ==<br />
{{Reflist<br />
| colwidth = 30em<br />
| refs =<br />
<ref name="NYDN">{{cite news|title=Young Actress Takes Shine To Playing A Movie Starlet|first=Donna|last=Petrozzello|work=New York Daily News|date=August 19, 1999|url=http://articles.nydailynews.com/1999-08-19/entertainment/18114779_1_linda-cardellini-jonathan-frakes-rue-mcclanahan}}</ref><br />
<ref name="AskMen">[http://www.askmen.com/women/actress_200/212_linda_cardellini.html Linda Cardellini]. AskMen.com.</ref><br />
<ref name="ew">{{cite web|last=Stransky|first=Tanner|date=August 17, 2007|title=Where are the 'Freaks and Geeks' now?|work=Entertainment Weekly|url=http://www.ew.com/ew/article/0,,20052164,00.html}}</ref><br />
<ref name="drgod">{{cite web|title=Angels & Prophets: Linda Cardellini|url=http://www.drgodcomedy.com/angels-prophets/linda-cardellini/|publisher=drgodcomedy.com}}</ref><br />
<ref name="sfsketch">{{cite web|title=Performers 2011 Line Up : Linda Cardellini|publisher=SFSketchFest.com|url=http://www.sfsketchfest.com/performers/#}}</ref><br />
}}<br />
<br />
== External links ==<br />
{{Portal|United States|Biography|Film}}<br />
*{{Commons category-inline}}<br />
* {{IMDb name|0004802}}<br />
* [http://www.nbc.com/ER/bios/Linda_Cardellini.html Linda Cardellini] at [[NBC]]<br />
* [http://vimeo.com/10190008 Linda Cardellini on stage with ''Dr. God'']. Vimeo.com, Neil Garguilo.<!-- authorized video: Neil Garguilo is a member of Dr. God --><br />
<br />
{{Authority control}}<br />
<br />
{{Persondata <!-- Metadata: see [[Wikipedia:Persondata]]. --><br />
| NAME = Cardellini, Linda<br />
| ALTERNATIVE NAMES =<br />
| SHORT DESCRIPTION = Actress<br />
| DATE OF BIRTH = June 25, 1975<br />
| PLACE OF BIRTH = Redwood City, California, U.S.<br />
| DATE OF DEATH =<br />
| PLACE OF DEATH =<br />
}}<br />
{{DEFAULTSORT:Cardellini, Linda}}<br />
[[Category:1975 births]]<br />
[[Category:Living people]]<br />
[[Category:20th-century American actresses]]<br />
[[Category:21st-century American actresses]]<br />
[[Category:Actresses from California]]<br />
[[Category:American child actresses]]<br />
[[Category:American film actresses]]<br />
[[Category:American people of English descent]]<br />
[[Category:American people of German descent]]<br />
[[Category:American people of Irish descent]]<br />
[[Category:American people of Italian descent]]<br />
[[Category:American television actresses]]<br />
[[Category:American voice actresses]]<br />
[[Category:Loyola Marymount University alumni]]<br />
[[Category:People from Redwood City, California]]<br />
[[Category:Actresses of Italian descent]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Cotton_swab&diff=697783897Cotton swab2016-01-01T22:22:01Z<p>PuercoPop: /* Medical risks */ Request for citation</p>
<hr />
<div>{{hatnote|"Q-tip" redirects here. For the rapper, see [[Q-Tip (musician)]]. For the band, see [[Q-Tips (band)]].}}<br />
[[Image:White menbo.jpg|thumb|220px|A tool used for aural hygiene and cosmetics application, and even to clear the belly button.]]<br />
[[Image:Cotton swabs (or cotton buds) -in round container.jpg|right|thumb|220px|Many cotton swabs in a round container]]<br />
[[Image:Q Tips plain BG.jpg|upright|thumb|220px|A pack of 54 Q-tips safety swabs]]<br />
'''Cotton swabs''' (American) or '''cotton buds''' (British) consist of a small wad of [[cotton]] wrapped around one or both ends of a short rod, usually made of either wood, rolled paper, or plastic. They are commonly used in a variety of applications including [[first aid]], [[cosmetics]] application, cleaning, and arts and crafts. <br />
The cotton swab is a tool invented in the 1920s by [[Leo Gerstenzang]]<ref name="howproductsmade"><br />
{{Citation<br />
| last=Schueller<br />
| first=Randy<br />
| contribution=Cotton Swab<br />
| editor-last= <br />
| editor-first= <br />
| title=History<br />
| volume=4<br />
| pages= <br />
| publisher=FindArticles.com<br />
| place= <br />
| year=1996<br />
| contribution-url=http://findarticles.com/p/articles/mi_gx5205/is_1996/ai_n19124735}}</ref> after he attached wads of cotton to [[toothpick]]s.<ref name="History of Q-tips">{{Citation<br />
| last=<br />
| first=<br />
| contribution=Cotton Swab<br />
| editor-last= <br />
| editor-first= <br />
| title=Q-tips History<br />
| volume=<br />
| pages= <br />
| publisher=Unilever Home and Personal Care<br />
| place= <br />
| year=2007–2008<br />
| contribution-url=http://www.qtips.com/history.php}}</ref> His product, which he named "Baby Gays", went on to become the most widely sold brand name, "'''Q-tips'''", with the Q standing for "quality". The term "Q-tips" is often used as a [[genericized trademark]] for cotton swabs in the [[United States|USA]] and [[Canada]].<ref>http://www.qtips.com/home/about</ref> Although doctors have said for years that usage of the cotton swab for ear cleaning or scratching is not safe, such use remains the most common.<ref>Rod Moser, PA, PhD, [http://blogs.webmd.com/all-ears/2006/11/q-tips-weapons-of-ear-destruction.html Q-Tips – Weapons of Ear Destruction?], WebMD, Nov. 13, 2006</ref><ref>Joel Stein, [http://content.time.com/time/nation/article/0,8599,105556,00.html Something Evil in the Ear Canal], ''Time'', Mar. 26, 2001</ref><br />
<br />
==Construction==<br />
The traditional cotton swab has a single tip on a wooden handle, and these are still often used, especially in medical settings. They are usually relatively long, about six inches (15&nbsp;cm). These often are packaged sterile, one or two to a paper or plastic sleeve. The advantage of the paper sleeve and the wooden handle is that the package can be [[autoclave]]d to be sterilized (plastic sleeves or handles would melt in the autoclave).<br />
<br />
Cotton swabs manufactured for home use are usually shorter, about three inches (7.6&nbsp;cm) long, and usually double-tipped. The handles were first made of wood, then made of rolled paper, which is still most common (although tubular plastic is also used). They are often sold in large quantities, 100 or more to a container.<br />
<br />
Plastic swab stems exist in a wide variety of colors, such as blue, pink or green. However, the cotton itself is traditionally white.<br />
<br />
==Usage==<br />
The most common use for cotton swabs is to clean or caress the [[ear canal]] and/or to remove [[earwax]], despite this not being a medically recommended method for removing [[earwax]]. Cotton swabs are also commonly used for applying and removing makeup, as well as for household uses such as cleaning and arts and crafts.<br />
<br />
Medical-type swabs are often used to take [[microbiology|microbiological]] cultures. They are swabbed onto or into the infected area, then wiped across the [[culture medium]], such as an [[agar plate]], where bacteria from the swab may grow. They are also used to take DNA samples, most commonly by scraping cells from the inner cheek in the case of humans. They can be used to apply medicines to a targeted area, to selectively remove substances from a targeted area, or to apply cleaning substances like [[Betadine]]. They are also used as an applicator for various cosmetics, ointments, and other substances.<br />
<br />
A related area is the use of swabs for microbiological environmental monitoring. Once taken, the swab can be streaked onto an agar plate, or the contents of the tip removed by agitation or dilution into the broth. The broth can either then be filtered or incubated and examined for microbial growth.<ref>{{Cite journal|author=Sandle, T. |title=A study of a new type of swab for the environmental monitoring of isolators and cleanrooms|journal=[[PDA (journal)|European Journal of Pharenteral and Pharmaceutical Sciences]] |volume=16 |issue=2 |pages=42–48|date=July 2011 }}</ref><br />
<br />
Cotton swabs are also often used outside of the field of personal hygiene:<br />
<br />
* Often used in [[Plastic model|plastic model kits]] construction, for various applications during decaling or painting. Special brands of cotton swabs exist for this purpose, characterised by sturdier cotton heads and varied shapes of those heads.<br />
* Can be used in the [[Dyne|dyne test]] for measuring [[surface energy]]. This use is problematic, as manufacturers differ in the binders they use to fix the cotton to the stem, affecting the outcome of the test.<ref>{{cite web |url=http://pffc-online.com/mag/paper_taking_measure_surface/ |title=Taking the measure of surface treatment is a learning process |publisher=PFFC: Paper, Film & Foil Converter |date=Sep 1, 1996 |author=Edward Boyle |accessdate=2010-03-20 }}</ref><br />
* They are frequently used for cleaning the laser of an [[optical drive]] in conjunction with rubbing alcohol. Similarly, they're used for cleaning larger computer parts such as video cards, and fans. They were also used widely in the past to clean video game cartridges.<br />
<br />
==Medical risks==<br />
The use of cotton swabs in the ear canal is associated with no medical benefits and poses definite medical risks{{ citation needed}}. [[Cerumen]] (ear wax) is a naturally occurring, normally extruded product of the external auditory canal that protects the skin inside the ear, serves beneficial lubrication and cleaning functions, and provides some protection from bacteria, fungi, insects, and water.<ref>{{cite journal|last=McCarter|first=Daniel F.|title=Cerumen Impaction|journal=American Family Physician|date=May 2007|volume=75|issue=10|pages=1523–1528|url=http://www.aafp.org/afp/2007/0515/p1523.html|accessdate=5 September 2012|display-authors=etal}}</ref><ref>[http://american-hearing.org/disorders/ear-wax/#whatis Earwax] at the American Hearing Research Foundation. Chicago, Illinois 2008.</ref> A 2004 study found that the "[u]se of a cotton-tip applicator to clean the ear seems to be the leading cause of [[otitis externa]] in children and should be avoided."<ref name=Nussinovitch>{{cite journal|last=Nussinovitch|first=Moshe|title=Cotton-tip applicators as a leading cause of otitis externa|journal=International Journal of Pediatric Otorhinolaryngology|date=April 2004|volume=68|issue=4|pages=433–435|url=http://www.ijporlonline.com/article/S0165-5876(03)00484-1/abstract|accessdate=5 September 2012|doi=10.1016/j.ijporl.2003.11.014|display-authors=etal}}</ref> Attempts to remove cerumen with cotton swabs may result in cerumen impaction, a buildup or blockage of cerumen in the ear canal, which can cause pain, hearing problems, ringing in the ear, or dizziness, and may require medical treatment to resolve.<ref Name=AAFP>{{cite journal|last=American Academy of Family Physicians|title=Information from Your Family Doctor---Earwax: What You Should Know|journal=American Family Physician|date=May 2007|volume=75|issue=10|pages=1530|url=http://www.aafp.org/afp/2007/0515/p1523.html}}</ref> The use of cotton swabs in the ear canal is one of most common causes of [[perforated eardrum]], a condition which sometimes requires surgery to correct.<ref>{{cite journal|last=Smith|first=Matthew|author2=Darrat|title=Otologic complications of cotton swab use: One institution's experience|journal=The Laryngoscope|date=February 2012|volume=122|issue=2|pages=409–411|url=http://onlinelibrary.wiley.com/doi/10.1002/lary.22437/abstract|doi=10.1002/lary.22437}}</ref> For these reasons, the American Academy of Family Physicians, among many other professional medical associations, recommends never placing cotton swabs in the ear canal.<ref name="AAFP" /><br />
<br />
==See also==<br />
* [[Ear pick]]<br />
<br />
==References==<br />
{{Reflist|2}}<br />
<br />
==External links==<br />
{{Commons category|Cotton swabs}}<br />
<br />
[[Category:Personal hygiene products]]<br />
[[Category:Microbiology equipment]]<br />
[[Category:American inventions]]<br />
[[Category:Cotton]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Futures_and_promises&diff=697313705Futures and promises2015-12-29T18:06:06Z<p>PuercoPop: /* List of implementations */ add a CL implementation to the list, blackbird</p>
<hr />
<div>{{merge|Promise theory|date=December 2015}}<br />
{{Use dmy dates|date=July 2013}}<br />
In [[computer science]], '''future''', '''promise''', and '''delay''' refer to constructs used for synchronization in some [[concurrent programming language]]s. They describe an object that acts as a proxy for a result that is initially unknown, usually because the [[computation]] of its value is yet incomplete.<br />
<br />
The term ''promise'' was proposed in 1976 by [[Daniel P. Friedman]] and David Wise,<ref>{{cite conference<br />
| first = Daniel<br />
| last = Friedman<br />
|author2=David Wise<br />
| year = 1976<br />
| title = The Impact of Applicative Programming on Multiprocessing<br />
| conference= International Conference on Parallel Processing<br />
| page=263-272.<br />
}}</ref><br />
and Peter Hibbard called it ''eventual''.<ref>{{cite conference<br />
| first = Peter<br />
| last = Hibbard<br />
| year = 1976<br />
| title = Parallel Processing Facilities<br />
| conference= New Directions in Algorithmic Languages, (ed.) Stephen A. Schuman, IRIA, 1976.<br />
}}</ref><br />
A somewhat similar concept ''future'' was introduced in 1977 in a paper by [[Henry Baker (computer scientist)|Henry Baker]] and [[Carl Hewitt]].<ref><br />
{{cite conference<br />
| author =Henry Baker and Carl Hewitt<br />
| title = The Incremental Garbage Collection of Processes<br />
| conference= Proceedings of the Symposium on Artificial Intelligence Programming Languages,<br />
| publisher= ACM Sigplan Notices 12, 8 <br />
| date=August 1977<br />
| pages=55-59<br />
| url=http://home.pipeline.com/~hbaker1/Futures.html<br />
}}</ref> <br />
<br />
The terms ''future'', ''promise'', and ''delay'' are often used interchangeably, although some differences in usage between ''future'' and ''promise'' are treated below. Specifically, when usage is distinguished, a future is a ''read-only'' placeholder view of a variable, while a promise is a writable, [[single assignment]] container which sets the value of the future.<ref>"[http://docs.scala-lang.org/sips/completed/futures-promises.html SIP-14 - Futures and Promises]"</ref> Notably, a future may be defined without specifying which specific promise will set its value, and different possible promises may set the value of a given future, though this can be done only once for a given future. In other cases a future and a promise are created together and associated with each other: the future is the value, the promise is the function that sets the value – essentially the return value (future) of an asynchronous function (promise). Setting the value of a future is also called ''resolving'', ''fulfilling'', or ''binding'' it.<br />
<br />
==Applications==<br />
Futures and promises originated in [[functional programming]] and related paradigms (such as [[logic programming]]) to decouple a value (a future) from how it was computed (a promise), allowing the computation to be done more flexibly, notably by parallelizing it. It later found use in [[distributed computing]], in reducing the latency from communication round trips. More recently, it has gained popularity by allowing writing asynchronous programs in [[direct style]], rather than in [[continuation-passing style]].<br />
<br />
==Implicit vs. explicit==<br />
Use of futures may be ''implicit'' (any use of the future automatically obtains its value, as if it were an ordinary [[reference (programming)|reference]]) or ''explicit'' (the user must call a function to obtain the value, such as the <code>get</code> method of {{Javadoc:SE|package=java.util.concurrent|java/util/concurrent|Future}} in [[Java (programming language)|Java]]). Obtaining the value of an explicit future can be called ''stinging'' or ''forcing''. Explicit futures can be implemented as a library, whereas implicit futures are usually implemented as part of the language.<br />
<br />
The original Baker and Hewitt paper described implicit futures, which are naturally supported in the [[Actor model]] of computation and pure [[object-oriented programming]] languages like [[Smalltalk]]. The Friedman and Wise paper described only explicit futures, probably reflecting the difficulty of efficiently implementing implicit futures on stock hardware. The difficulty is that stock hardware does not deal with futures for primitive data types like integers. For example, an add instruction does not know how to deal with <code>3 + ''future '' factorial(100000)</code>. In pure object or Actor languages this problem can be solved by sending <code>''future '' factorial(100000)</code> the message <code>+[3]</code>, which asks the future to add <code>3</code> to itself and return the result. Note that the message passing approach works regardless of when <code>factorial(100000)</code> finishes computation and that no stinging/forcing is needed.<br />
<br />
==Promise pipelining==<br />
The use of futures can dramatically reduce [[latency (engineering)|latency]] in [[distributed computing|distributed systems]]. For instance, futures enable ''promise pipelining'',<ref>[http://www.erights.org/elib/distrib/pipeline.html Promise Pipelining at erights.org]</ref><ref>[http://c2.com/cgi/wiki?PromisePipelining Promise Pipelining on the C2 wiki]</ref> as implemented in the languages [[E (programming language)|E]] and [[Joule (programming language)|Joule]], which was also called ''call-stream'' in the language [[Argus (programming language)|Argus]].<br />
<br />
Consider an expression involving conventional [[remote procedure call]]s, such as:<br />
<source lang="e"><br />
t3 := ( x.a() ).c( y.b() )<br />
</source><br />
which could be expanded to<br />
<source lang="e"><br />
t1 := x.a();<br />
t2 := y.b();<br />
t3 := t1.c(t2);<br />
</source><br />
Each statement needs a message to be sent and a reply received before the next statement can proceed. Suppose, for example, that <code>x</code>, <code>y</code>, <code>t1</code>, and <code>t2</code> are all located on the same remote machine. In this case, two complete network round-trips to that machine must take place before the third statement can begin to execute. The third statement will then cause yet another round-trip to the same remote machine.<br />
<br />
Using futures, the above expression could be written<br />
<source lang="e"><br />
t3 := (x <- a()) <- c(y <- b())<br />
</source><br />
<br />
which could be expanded to<br />
<source lang="e"><br />
t1 := x <- a();<br />
t2 := y <- b();<br />
t3 := t1 <- c(t2);<br />
</source><br />
<br />
The syntax used here is that of the language E, where <code>x <- a()</code> means to send the message <code>a()</code> asynchronously to <code>x</code>. All three variables are immediately assigned futures for their results, and execution proceeds to subsequent statements. Later attempts to resolve the value of <code>t3</code> may cause a delay; however, pipelining can reduce the number of round-trips needed. If, as in the previous example, <code>x</code>, <code>y</code>, <code>t1</code>, and <code>t2</code> are all located on the same remote machine, a pipelined implementation can compute <code>t3</code> with one round-trip instead of three. Because all three messages are destined for objects which are on the same remote machine, only one request need be sent and only one response need be received containing the result. Note also that the send <code>t1 <- c(t2)</code> would not block even if <code>t1</code> and <code>t2</code> were on different machines to each other, or to <code>x</code> or <code>y</code>.<br />
<br />
Promise pipelining should be distinguished from parallel asynchronous message passing. In a system supporting parallel message passing but not pipelining, the message sends <code>x <- a()</code> and <code>y <- b()</code> in the above example could proceed in parallel, but the send of <code>t1 <- c(t2)</code> would have to wait until both <code>t1</code> and <code>t2</code> had been received, even when <code>x</code>, <code>y</code>, <code>t1</code>, and <code>t2</code> are on the same remote machine. The relative latency advantage of pipelining becomes even greater in more complicated situations involving many messages.<br />
<br />
Promise pipelining also should not be confused with [[Actor model#No requirement on order of message arrival|pipelined message processing]] in Actor systems, where it is possible for an actor to specify and begin executing a behaviour for the next message before having completed processing of the current message.<br />
<br />
==Read-only views==<br />
In some programming languages such as [[Oz (programming language)|Oz]], [[E (programming language)|E]], and [[AmbientTalk]], it is possible to obtain a ''read-only view'' of a future, which allows reading its value when resolved, but does not permit resolving it:<br />
<br />
* In Oz, the <code>!!</code> operator is used to obtain a read-only view.<br />
* In E and AmbientTalk, a future is represented by a pair of values called a ''promise/resolver pair''. The promise represents the read-only view, and the resolver is needed in order to set the future's value.<br />
* In [[C++11]] a <code>std::future</code> provides a read-only view. The value is set directly by using a <code>std::promise</code>, or set to the result of a function call using <code>std::packaged_task</code> or <code>std::async</code>.<br />
* In the [[Dojo Toolkit]]'s Deferred API as of version 1.5, a ''consumer-only promise object'' represents a read-only view.<ref>{{citation | url = http://www.sitepen.com/blog/2010/05/03/robust-promises-with-dojo-deferred-1-5/ | publisher = Site Pen | date = 2010-05-03 | title = Robust promises with Dojo deferred}}.</ref><br />
* In [[Alice ML]], futures only provide a ''read-only view'', whereas a promise contains both a future and the ability to resolve the future<ref name = "Alice ML promise">{{citation | url = http://www.ps.uni-sb.de/alice/manual/library/promise.html | title = Alice Manual | chapter = Promise | publisher = Uni-SB | place = DE}}.</ref><ref name = "Alice ML future">{{citation | url = http://www.ps.uni-sb.de/alice/manual/library/future.html | title = Alice manual | chapter = Future | publisher = Uni-SB | place = DE}}.</ref><br />
* In [[.NET Framework 4.0|.NET 4.0]] <code>System.Threading.Tasks.Task<T></code> represents a read-only view. Resolving the value can be done through <code>System.Threading.Tasks.TaskCompletionSource<T></code>.<br />
<br />
Support for read-only views is consistent with the [[Principle of Least Authority]], since it enables the ability to set the value to be restricted to [[subject (access control)|subjects]] that need to set it. In a system that also supports pipelining, the sender of an asynchronous message (with result) receives the read-only promise for the result, and the target of the message receives the resolver.<br />
<br />
==Thread-specific futures==<br />
Some languages, such as [[Alice (programming language)|Alice ML]], define futures that are associated with a specific thread that computes the future's value.<ref name = "Alice ML future" /> This computation may be started either [[eager evaluation|eagerly]] when the future is created, or [[lazy evaluation|lazily]] when its value is first needed. A lazy future is similar to a [[thunk (functional programming)|thunk]] (in the sense of a delayed computation).<br />
<br />
Alice ML also supports futures that can be resolved by any thread, and calls these ''promises''.<ref name = "Alice ML promise" /> Note that this usage of ''promise'' is different from its usage in E as described [[#Read-only views|above]]: an Alice promise is ''not'' a read-only view, and Alice also does not support pipelining for promises themselves. Instead, pipelining naturally happens for futures (including ones associated with promises).<br />
<br />
==Blocking vs non-blocking semantics==<br />
If the value of a future is accessed asynchronously, for example by sending a message to it, or by explicitly waiting for it using a construct such as <code>when</code> in E, then there is no difficulty in delaying until the future is resolved before the message can be received or the wait completes. This is the only case to be considered in purely asynchronous systems such as pure Actor languages.<br />
<br />
However, in some systems it may also be possible to attempt to ''immediately'' or ''synchronously'' access a future's value. Then there is a design choice to be made:<br />
<br />
* the access could block the current thread or process until the future is resolved (possibly with a timeout). This is the semantics of ''dataflow variables'' in the language [[Oz (programming language)|Oz]].<br />
* the attempted synchronous access could always signal an error, for example throwing an [[exception (computer science)|exception]]. This is the semantics of remote promises in E.<ref>{{citation |url=http://wiki.erights.org/wiki/Promise | title = Promise | publisher = E rights}}.</ref><br />
* potentially, the access could succeed if the future is already resolved, but signal an error if it is not. This would have the disadvantage of introducing nondeterminism and the potential for [[race conditions]], and does not appear to be a common design choice.<br />
<br />
As an example of the first possibility, in [[C++11]], a thread that needs the value of a future can block until it is available by calling the <code>wait()</code> or <code>get()</code> member functions. You can also specify a timeout on the wait using the <code>wait_for()</code> or <code>wait_until()</code> member functions to avoid indefinite blocking. If the future arose from a call to <code>std::async</code> then a blocking wait (without a timeout) may cause synchronous invocation of the function to compute the result on the waiting thread.<br />
<br />
==Related constructs==<br />
An ''I-var'' (as in the language [[Id (programming language)|Id]]) is a future with blocking semantics as defined above. An ''I-structure'' is a [[data structure]] containing I-vars. A related synchronization construct that can be set multiple times with different values is called an ''M-var''. M-vars support atomic operations to ''take'' or ''put'' the current value, where taking the value also sets the M-var back to its initial ''empty'' state.<ref>{{citation | url = http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Concurrent-MVar.html | publisher = Haskell | title = Control Concurrent MVar}}.</ref><br />
<br />
A ''concurrent logic variable'' is similar to a future, but is updated by [[unification (computing)|unification]], in the same way as ''logic variables'' in [[logic programming]]. Thus it can be bound more than once to unifiable values (but cannot be set back to an empty or unresolved state). The dataflow variables of Oz act as concurrent logic variables, and also have blocking semantics as mentioned above.<br />
<br />
A ''concurrent constraint variable'' is a generalization of concurrent logic variables to support [[constraint logic programming]]: the constraint may be ''narrowed'' multiple times, indicating smaller sets of possible values. Typically there is a way to specify a thunk that should be run whenever the constraint is narrowed further; this is necessary to support ''constraint propagation''.<br />
<br />
==Relations between the expressiveness of different forms of future==<br />
Eager thread-specific futures can be straightforwardly implemented in terms of non-thread-specific futures, by creating a thread to calculate the value at the same time as creating the future. In this case it is desirable to return a read-only view to the client, so that only the newly created thread is able to resolve this future.<br />
<br />
To implement implicit lazy thread-specific futures (as provided by Alice ML, for example) in terms in non-thread-specific futures, needs a mechanism to determine when the future's value is first needed (for example, the <code>WaitNeeded</code> construct in Oz<ref>{{citation | url = http://www.mozart-oz.org/home/doc/base/node13.html | title = WaitNeeded | publisher= Mozart Oz}}.</ref>). If all values are objects, then the ability to implement transparent forwarding objects is sufficient, since the first message sent to the forwarder indicates that the future's value is needed.<br />
<br />
Non-thread-specific futures can be implemented in terms of thread-specific futures, assuming that the system supports message passing, by having the resolving thread send a message to the future's own thread. However, this could be argued to be unnecessary complexity: in programming languages based on threads, the most expressive approach appears to be to provide a combination of non-thread-specific futures, read-only views, and either a 'WaitNeeded' construct or support for transparent forwarding.<br />
<br />
==Evaluation strategy==<br />
{{further|Call by future}}<br />
<br />
The [[evaluation strategy]] of futures, which may be termed '''[[call by future]]''', is non-deterministic: the value of a future will be evaluated at some time between when the future is created and when its value is used, but the precise time is not determined beforehand and can change from run to run. The computation may be started as soon as the future is created ([[eager evaluation]]) or only when the value is actually needed ([[lazy evaluation]]), and may be suspended part-way through or executed in one run. Once the value of a future is assigned, it is not recomputed on future accesses; this is like the [[memoization]] used in [[call by need]].<br />
<br />
A '''{{visible anchor|lazy future}}''' is a future that deterministically has lazy evaluation semantics: the computation of the future's value starts when the value is first needed, as in call by need. Lazy futures are of use in languages whose evaluation strategy is by default not lazy. For example, in [[C++11]] such lazy futures can be created by passing the <code>std::launch::deferred</code> launch policy to <code>std::async</code>, along with the function to compute the value.<br />
<br />
==Semantics of futures in the Actor model==<br />
In the Actor model, an expression of the form <code>''future'' <Expression></code> is defined by how it responds to an <code>Eval</code> message with environment ''E'' and customer ''C'' as follows: The future expression responds to the <code>Eval</code> message by sending the customer ''C'' a newly created actor ''F'' (the proxy for the response of evaluating <code><Expression></code>) as a return value ''concurrently'' with sending <code><Expression></code> an <code>Eval</code> message with environment ''E'' and customer ''C''. The default behavior of ''F'' is as follows:<br />
<br />
* When ''F'' receives a request ''R'', then it checks to see if it has already received a response (that can either be a return value or a thrown exception) from evaluating <code><Expression></code> proceeding as follows:<br />
*# If it already has a response ''V'', then<br />
*#*If ''V'' is a return value, then it is sent the request ''R''.<br />
*#*If ''V'' is an exception, then it is thrown to the customer of the request ''R''.<br />
*# If it does not already have a response, then ''R'' is stored in the queue of requests inside the ''F''.<br />
<br />
* When ''F'' receives the response ''V'' from evaluating <code><Expression></code>, then ''V'' is stored in ''F'' and<br />
**If ''V'' is a return value, then all of the queued requests are sent to ''V''.<br />
**If ''V'' is an exception, then it is thrown to the customer of each of the queued requests.<br />
<br />
However, some futures can deal with requests in special ways to provide greater parallelism. For example, the expression <code>1 + future factorial(n)</code> can create a new future that will behave like the number <code>1+factorial(n)</code>. This trick does not always work. For example the following conditional expression:<br />
: <code>''if'' m>future factorial(n) ''then'' print("bigger") ''else'' print("smaller")</code><br />
suspends until the future for <code>factorial(n)</code> has responded to the request asking if <code>m</code> is greater than itself.<br />
<br />
==History==<br />
The ''future'' and/or ''promise'' constructs were first implemented in programming languages such as [[MultiLisp]] and [[Actor model|Act 1]]. The use of logic variables for communication in [[concurrency (computer science)|concurrent]] [[logic programming]] languages was quite similar to futures. These started with ''Prolog with Freeze'' and ''IC Prolog'', and became a true concurrency primitive with [[Relational Language]], [[Concurrent Prolog]], [[Guarded Horn Clauses]] (GHC), [[Parlog]], [[Strand (programming language)|Strand]], [[Vulcan (programming language)|Vulcan]], [[Janus (programming language)|Janus]], [[Mozart Programming System|Mozart]]/[[Oz (programming language)|Oz]], [[Flow Java]], and [[Alice (programming language)|Alice ML]]. The single-assignment ''I-var'' from [[dataflow programming]] languages, originating in [[Id (programming language)|Id]] and included in Reppy's ''[[Concurrent ML]]'', is much like the concurrent logic variable.<br />
<br />
The promise pipelining technique (using futures to overcome latency) was invented by [[Barbara Liskov]] and [[Liuba Shrira]] in 1988,<ref>{{cite journal<br />
| author = Barbara Liskov and Liuba Shrira<br />
| title = Promises: Linguistic Support for Efficient Asynchronous Procedure Calls in Distributed Systems<br />
| year = 1988<br />
| doi = 10.1145/53990.54016<br />
| publisher = Proceedings of the SIGPLAN '88 Conference on Programming Language Design and Implementation; Atlanta, Georgia, United States, pp. 260&ndash;267. ISBN 0-89791-269-1, published by ACM. Also published in ACM SIGPLAN Notices, Volume 23, Issue 7, July 1988<br />
}}</ref> and independently by [[Mark S. Miller]], Dean Tribble and Rob Jellinghaus in the context of [[Project Xanadu]] circa 1989.<ref>{{citation | url = http://www.sunless-sea.net/Transcripts/promise.html | publisher = Sunless Sea | title = Promise | archiveurl = http://web.archive.org/web/20071023111712/http://www.sunless-sea.net/Transcripts/promise.html | archivedate = October 23, 2007}}.</ref><br />
<br />
The term ''promise'' was coined by Liskov and Shrira, although they referred to the pipelining mechanism by the name ''call-stream'', which is now rarely used.<br />
<br />
Both the design described in Liskov and Shrira's paper, and the implementation of promise pipelining in Xanadu, had the limitation that promise values were not [[first-class value|first-class]]: an argument to, or the value returned by a call or send could not directly be a promise (so the example of promise pipelining given earlier, which uses a promise for the result of one send as an argument to another, would not have been directly expressible in the call-stream design or in the Xanadu implementation). It appears that promises and call-streams were never implemented in any public release of Argus<ref>{{citation | url = http://www.pmg.csail.mit.edu/Argus.html | publisher = MIT | title = Argus}}.</ref> (the programming language used in the Liskov and Shrira paper); Argus development stopped around 1988.<ref>{{citation | url = http://www.ieeeghn.org/wiki/index.php/Oral-History:Barbara_Liskov#Distributed_Computing_and_Argus | publisher = IEEE GHN | series = Oral history | first = Barbara | last = Liskov | title = Distributed computing and Argus}}.</ref> The Xanadu implementation of promise pipelining only became publicly available with the release of the source code for Udanax Gold<ref>{{citation | url = http://www.udanax.com/gold/ | publisher = Udanax | title = Gold}}.</ref> in 1999, and was never explained in any published document.<ref>{{citation | url = http://www.erights.org/elib/distrib/pipeline.html | publisher = E rights | title = Pipeline}}.</ref> The later implementations in Joule and E support fully first-class promises and resolvers.<br />
<br />
Several early Actor languages, including the Act series of languages,<ref>{{cite journal<br />
| author = Henry Lieberman<br />
| title = A Preview of Act 1<br />
|date=June 1981<br />
| publisher = MIT AI memo 625<br />
}}</ref><ref>{{cite journal<br />
| author = Henry Lieberman<br />
| title = Thinking About Lots of Things at Once without Getting Confused: Parallelism in Act 1<br />
|date=June 1981<br />
| publisher = MIT AI memo 626<br />
}}</ref> supported both parallel message passing and pipelined message processing, but not promise pipelining. (Although it is technically possible to implement the last of these features in terms of the first two, there is no evidence that the Act languages did so.)<br />
<br />
More recently, there has been a major revival of interest in futures and promises, due particularly to their use in [[responsiveness]] of user interfaces, and their use in [[web development]], due to the [[request–response]] model of message-passing. Several mainstream languages now have language support for futures and promises, most notably popularized by the <code>async</code> and <code>await</code> constructions in .NET 4.5 (announced 2010, released 2012)<ref name="asyncdotnet45">{{cite web|url=http://blogs.msdn.com/b/dotnet/archive/2012/04/03/async-in-4-5-worth-the-await.aspx |title=Async in 4.5: Worth the Await - .NET Blog - Site Home - MSDN Blogs |publisher=Blogs.msdn.com |date= |accessdate=2014-05-13}}</ref><ref name="dotnetasyncawait">{{cite web|url=http://msdn.microsoft.com/en-us/library/hh191443.aspx |title=Asynchronous Programming with Async and Await (C# and Visual Basic) |publisher=Msdn.microsoft.com |date= |accessdate=2014-05-13}}</ref> largely inspired by the ''asynchronous workflows'' of F#,<ref>{{cite web<br />
|title=Asynchronous C# and F# (I.): Simultaneous introduction<br />
|url=http://tomasp.net/blog/csharp-fsharp-async-intro.aspx/<br />
|date=29 October 2010<br />
|author=Tomas Petricek<br />
}}</ref> which dates to 2007.<ref>{{cite web<br />
|title=The F# Asynchronous Programming Model, PADL 2011<br />
|url=http://blogs.msdn.com/b/dsyme/archive/2010/10/21/the-f-asynchronous-programming-model-padl-2010-pre-publication-draft.aspx<br />
|date=21 Oct 2010 <br />
|author1=Don Syme<br />
|author2=Tomas Petricek<br />
|author3=Dmitry Lomov<br />
}}</ref> This has subsequently been adopted by other languages, notably Dart (2014),<ref name="dart"/> Python (2015),<ref name="python">{{cite web<br />
|title=PEP 0492 -- Coroutines with async and await syntax<br />
|url=https://www.python.org/dev/peps/pep-0492/<br />
}}</ref> Hack (HHVM), and drafts of ECMAScript 7 (JavaScript), Scala, and C++.<br />
<br />
==List of implementations==<br />
Languages supporting futures, promises, concurrent logic variables, dataflow variables, or I-vars, either by direct language support or in the standard library, include:<br />
* ABCL/f<ref>{{cite conference<br />
| author = Kenjiro Taura, Satoshi Matsuoka, and Akinori Yonezawa<br />
| year = 1994<br />
| title = ABCL/f: A Future-Based Polymorphic Typed Concurrent Object-Oriented Language -- Its Design and Implementation.<br />
| booktitle = In Proceedings of the DIMACS workshop on Specification of Parallel Algorithms, number 18 in Dimacs Series in Discrete Mathematics and Theoretical Computer Science<br />
| pages = 275–292<br />
| url = http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.23.1161<br />
| doi = <br />
| publisher = American Mathematical Society<br />
}}</ref><br />
* [[Alice (programming language)|Alice ML]]<br />
* [[AmbientTalk]] (including first-class resolvers and read-only promises)<br />
* [[Clojure]]<ref>{{cite web<br />
| author = Rich Hickey<br />
| year = 2009<br />
| title = changes.txt at 1.1.x from richhickey's clojure<br />
| url = https://github.com/richhickey/clojure/blob/1.1.x/changes.txt#L130<br />
}}</ref><br />
* [[C++11#Threading facilities|C++11]] (std::future and std::promise)<br />
* [[C Sharp (programming language)|C#]], since .NET 4.5,<ref name="asyncdotnet45"/> through the <code>async</code> and <code>await</code> keywords.<ref name="dotnetasyncawait"/><br />
* [[Compositional C++]]<br />
* [[Dart (programming language)|Dart]] (with ''Future''/''Completer'' classes<ref name="dartCompleter"> {{cite url<br />
|url=https://api.dartlang.org/1.12.1/dart-async/Completer-class.html<br />
|title=Dart SDK dart async Completer<br />
}}</ref> and the ''await''/''async'' keywords<ref name="dart">{{cite url<br />
|url=https://www.dartlang.org/articles/await-async/<br />
|title=Dart Language Asynchrony Support: Phase 1<br />
|author=Gilad Bracha <br />
|date=October 2014<br />
}}</ref>)<br />
* [[Flow Java]]<br />
* Glasgow [[Haskell (programming language)|Haskell]] (I-vars and M-vars only)<br />
* [[Id (programming language)|Id]] (I-vars and M-vars only)<br />
* [[Io (programming language)|Io]]<ref>{{cite web<br />
| author = Steve Dekorte<br />
| year = 2005<br />
| title = Io, The Programming Language<br />
| url = http://iolanguage.com/docs/manual<br />
}}</ref><br />
* [[Java (programming language)|Java]] through {{Javadoc:SE|package=java.util.concurrent|java/util/concurrent|Future}}<br />
* [[JavaScript]] (limited, as of ECMAScript 6)<br />
* [[Lucid (programming language)|Lucid]] (dataflow only)<br />
* [[MultiLisp]]<br />
* [[.NET_Framework|.NET]] through ''Task''s<br />
* [[Oxygene (programming language)|Oxygene]]<br />
* [[Oz (programming language)|Oz]] version 3<ref>{{cite web|url=http://www.mozart-oz.org/documentation/tutorial/node1.html|title=Tutorial of Oz|publisher=MOzart Global User Library|accessdate=12 April 2011|author=Seif Haridi|author2=Nils Franzen}}</ref><br />
* [[Python (programming language)|Python]] [https://docs.python.org/3/library/concurrent.futures.html concurrent.futures], since 3.2,<ref>[https://www.python.org/download/releases/3.2/ Python 3.2 Release]</ref> as proposed by the [https://www.python.org/dev/peps/pep-3148/ PEP 3148], and Python 3.5 added async and await <ref>[https://www.python.org/downloads/release/python-350/ Python 3.5 Release]</ref><br />
* [[R (programming language)|R]] (promises for lazy evaluation - still single threaded)<br />
* [[Racket (programming language)|Racket]]<ref>{{cite web|url=http://docs.racket-lang.org/guide/performance.html#(part._effective-futures)|title=Parallelism with Futures|publisher=PLT|accessdate=2 March 2012|author=}}</ref><br />
* [[Scala (programming language)|Scala]]<br />
* [[Scheme (programming language)|Scheme]]<br />
* [[Squeak Smalltalk]]<br />
* [[Strand (programming language)|Strand]]<br />
* [[Swift (Apple programming language)|Swift]]<br />
* [[Visual Basic.NET|Visual Basic]] 11 (through the ''Async'' and ''Await'' keywords)<ref name="dotnetasyncawait"/><br />
* [[μC++]]<br />
<br />
Languages also supporting promise pipelining include:<br />
* [[E (programming language)|E]]<br />
* [[Joule (programming language)|Joule]]<br />
<br />
Non-standard library based implementations of futures:<br />
* For [[Common Lisp]]:<br />
** [http://orthecreedence.github.io/blackbird/ Blackbird]<br />
** [http://common-lisp.net/project/eager-future/ Eager Future2]<br />
** [http://marijnhaverbeke.nl/pcall/ PCall] <br />
* For C++: <br />
** [[Boost (C++ libraries)|Boost library]] <ref>{{cite web<br />
|url=http://www.boost.org/doc/libs/release/doc/html/thread.html<br />
|title=Chapter 30. Thread 4.0.0<br />
|accessdate=26 June 2013}}</ref><br />
** [[Dlib]] <ref>{{cite web<br />
|url=http://www.boost.org/doc/libs/release/doc/html/thread.html<br />
|title=Dlib C++ Library #thread_pool<br />
|accessdate=26 June 2013}}</ref><br />
** [[Qt (framework)|Qt]] <ref>{{cite web<br />
|url=https://qt-project.org/doc/qt-5.0/qtcore/qfuture.html<br />
|title=QtCore 5.0: QFuture Class<br />
|publisher=Qt Project<br />
|accessdate=26 June 2013}}</ref><br />
* For [[C Sharp (programming language)|C#]] and other [[.NET Framework|.NET]] languages: The [[Parallel Extensions]] library<br />
* For [[Groovy (programming language)|Groovy]]: [http://gpars.codehaus.org GPars]<br />
* For [[JavaScript]]:<br />
** [http://cujojs.com Cujo.js's] [https://github.com/cujojs/when when.js] provides promises conforming to the [http://promisesaplus.com Promises/A+] 1.1 specification.<br />
** The [[Dojo Toolkit]] supplies both [http://dojotoolkit.org/documentation/tutorials/1.6/promises/ promises] and [[Twisted (software)|Twisted]] style Deferreds<br />
** [[MochiKit]] [http://mochi.github.io/mochikit/doc/html/MochiKit/Async.html MochKit.Async] inspired by [[Twisted (software)#Deferreds|Twisted's Deferreds]] <br />
** [http://jquery.com/ jQuery's] [//api.jquery.com/category/deferred-object/ Deferred Object] is based on the [http://wiki.commonjs.org/wiki/Promises/A CommonJS Promises/A] design.<br />
** [http://angularjs.org/ Angularjs]<br />
** [https://github.com/kriszyp/node-promise node-promise]<br />
** [http://documentup.com/kriskowal/q Q] by Kris Kowal, conforms to Promises/A+ 1.1.<br />
** [https://github.com/tildeio/rsvp.js RSVP.js] also conforms to Promises/A+ 1.1.<br />
** [http://yuilibrary.com/ YUI's] [http://yuilibrary.com/yui/docs/promise/ Promise class] conforms to the Promises/A+ 1.0 specification.<br />
** [https://github.com/petkaantonov/bluebird Bluebird] by Petka Antonov<br />
** The [[Google_Closure_Tools#Closure_Library|Closure Library]]'s [https://github.com/google/closure-library/tree/master/closure/goog/promise promise] package conforms to the Promises/A+ specification.<br />
** See [http://promisesaplus.com/implementations Promise/A+'s] list for more implementations based on the Promise/A+ design.<br />
<br />
* For [[Java (programming language)|Java]]:<br />
** [http://jdeferred.org JDeferred] provides Deferred/Promise API and behavior similar to [[JQuery]].Deferred object<br />
** [https://github.com/linkedin/parseq/wiki ParSeq] provides Task/Promise API ideal for asynchronous pipelining and branching, maintained by [[LinkedIn]].<br />
* For [[Objective-C]]: [https://github.com/mikeash/MAFuture MAFuture] ([http://www.mikeash.com/pyblog/friday-qa-2010-02-26-futures.html reference]), [https://github.com/couchdeveloper/RXPromise RXPromise], [https://github.com/Strilanc/ObjC-CollapsingFutures ObjC-CollapsingFutures], [http://promisekit.org/ PromiseKit], [https://github.com/mproberts/objc-promise objc-promise], [https://github.com/oleganza/OAPromise OAPromise]<br />
* For [[OCaml]]: [http://caml.inria.fr/pub/docs/manual-ocaml/libref/Lazy.html Lazy] module implements lazy explicit futures.<br />
* For [[Perl]]: [http://metacpan.org/module/Future Future], [https://metacpan.org/pod/Promises Promises] and [http://metacpan.org/module/Reflex/ Reflex] <br />
* For [[Php|PHP]]: [https://github.com/reactphp/promise React/Promise]<br />
* For [[Python (programming language)|Python]]:<br />
** [https://docs.python.org/3/library/asyncio-task.html#future Built-in implementation]<br />
** [http://code.google.com/p/pythonfutures/ pythonfutures]<br />
** [[Twisted (software)|Twisted's]] [http://twistedmatrix.com/documents/current/core/howto/defer.html Deferreds]<br />
* For [[R (programming language)|R]]:<br />
** [https://cran.r-project.org/package=future future] provides an extendable Future API and an implementation of lazy and eager synchronous and multi-core asynchronous futures.<br />
* For [[Ruby (programming language)|Ruby]]:<br />
** The [http://rubygems.org/gems/promise Promise] gem<br />
** [https://github.com/cotag/libuv libuv] gem, which implements promises<br />
** [http://celluloid.io Celluloid] gem, which implements futures<br />
** [https://github.com/adhearsion/future-resource future-resource]<br />
* For [[Swift (Apple programming language)|Swift]]: <br />
** The [https://bitbucket.org/al45tair/async Async] framework, which implements C#-style <code>async</code>/non-blocking <code>await</code><br />
** [https://github.com/FutureKit/FutureKit FutureKit] - which implements a version specifically targeting [https://developer.apple.com/library/prerelease/mac/documentation/Performance/Reference/GCD_libdispatch_Ref/index.html Apple GCD].<br />
** [https://github.com/couchdeveloper/FutureLib FutureLib] A pure Swift 2 library implementing Scala-style Futures and Promises with TPL-style cancellation.<br />
===Coroutines===<br />
Futures can be implemented in terms of [[coroutine]]s<ref name="python"/> or generators,<ref>[https://esdiscuss.org/topic/does-async-await-solve-a-real-problem#content-2 Does async/await solve a real problem?]</ref> resulting in the same evaluation strategy (e.g., cooperative multitasking or lazy evaluation).<br />
<br />
===Channels===<br />
{{main|Channel (programming)}}<br />
Futures can easily be implemented in terms of [[Channel (programming)|channels]]: a future is a one-element channel, and a promise is a process that sends to the channel, fulfilling the future.<ref>"[https://sites.google.com/site/gopatterns/concurrency/futures Futures]", ''[https://sites.google.com/site/gopatterns Go Language Patterns]''</ref> This allows futures to be implemented in concurrent programming languages with support for channels, such as CSP and [[Go (programming language)|Go]] – the resulting futures are explicit, as they must be accessed by reading from the channel, rather than just evaluation.<br />
<br />
== References ==<br />
<references/><br />
<br />
== External links ==<br />
*[http://shairosenfeld.com/concurrency.html Concurrency patterns presentation] given at [http://scaleconf.org scaleconf]<br />
* [http://c2.com/cgi/wiki?FutureValue Future Value] and [http://c2.com/cgi/wiki?PromisePipelining Promise Pipelining] at the [[Portland Pattern Repository]]<br />
* [http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/84317 Easy Threading with Futures] in [[Python (language)|Python]]<br />
<br />
{{DEFAULTSORT:Futures and promises}}<br />
[[Category:Inter-process communication]]<br />
[[Category:Actor model]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Coin_in_the_fish%27s_mouth&diff=690187211Coin in the fish's mouth2015-11-11T20:38:28Z<p>PuercoPop: Citation needed</p>
<hr />
<div>[[File:Tuenger Facetie.jpg|thumb|[[Apostle Peter]] paying the temple tax with coin from the fish's mouth by Augustin Tünger, 1486.]]<br />
[[File:Tilapia zilli Kineret.jpg|thumb|Tilapia zilli ("[[St. Peter's fish]]") - served in a [[Tiberias]] restaurant.]]<br />
The '''coin in the fish's mouth''' is one of the [[miracles of Jesus]], told in the Gospel of {{bibleverse||Matthew|17:24-27|NIV}}.<ref>Daniel J. Scholz 2009 ''Introducing the New Testament'' ISBN 0-88489-955-1 page 86</ref><ref>Steven L. Cox, Kendell H Easley, 2007 Harmony of the Gospels ISBN 0-8054-9444-8 page 349</ref><ref>[[Herbert Lockyer]], ''All the Miracles of the Bible'' (Zondervan, 1988) page 219.</ref><br />
<br />
In the Gospel account, in [[Capernaum]] the collectors of the two-[[Greek drachma|drachma]] temple tax ask [[Apostle Peter|Peter]] whether Jesus pays the tax, and he replies that he does. When Peter returns to where they are staying, Jesus speaks of the matter, asking his opinion: "From whom do the kings of the earth collect duty and taxes — from their own children or from others?" Peter answers, "from others," and Jesus replies: "Then the children are exempt. But so that we may not cause offense, go to the lake and throw out your line. Take the first fish you catch; open its mouth and you will find a [[Tetradrachm|four-drachma coin]]. Take it and give it to them for my tax and yours." <br />
<br />
The story ends at this point, without stating that Peter caught the fish as Jesus predicted.<ref name=Twelftree>[[Graham Twelftree|Graham H. Twelftree]], ''Jesus the Miracle Worker: A Historical and Theological Study'' (InterVarsity Press, 1999), page 137.</ref><br />
<br />
The four-drachma coin would be exactly enough to pay the [[temple tax]] (two-drachma coin) for two people.<ref>[[Craig S. Keener|Keener, Craig S.]], 2009, ''The Gospel of Matthew: A Socio-Rhetorical Commentary'', Wm. B. Eerdmans Publishing, ISBN 0-8028-6498-8, page [http://books.google.com/books?id=8C2Y_HaL5W0C&pg=PA445 445].</ref> The coin in the fish's mouth is generally seen as a symbolic act or sign, but there is little agreement concerning what it signifies.<ref name=Twelftree /><br />
<br />
The Bible does not specify the species of the fish caught by Peter, but [[Tilapia]] is sometimes referred to as "St. Peter's fish"{{citation required}}.<br />
<br />
==See also==<br />
* [[Render unto Caesar]]<br />
* [[Life of Jesus in the New Testament]]<br />
* [[Miracles of Jesus]]<br />
* [[The Tribute Money (Masaccio)]]<br />
<br />
==References==<br />
{{Reflist}}<br />
<br />
{{Jesus footer}}<br />
{{Miracles of Jesus|state=expanded}}<br />
<br />
[[Category:Miracles of Jesus]]<br />
[[Category:Coins in the Bible]]<br />
[[Category:Interactions between humans and fish]]<br />
[[Category:Gospel of Matthew]]<br />
[[Category:Peter the Apostle]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Common_Lisp&diff=689834701Common Lisp2015-11-09T18:13:31Z<p>PuercoPop: /* Sorting a list of person objects */ Fix code tag left openned from the previous edit</p>
<hr />
<div>{{Infobox programming language<br />
| name = Common Lisp<br />
| family = [[Lisp (programming language)|Lisp]]<br />
| paradigm = [[Multi-paradigm programming language|Multi-paradigm]]: [[procedural programming|procedural]], [[functional programming|functional]], [[object-oriented programming|object-oriented]], [[metaprogramming|meta]], [[reflective programming|reflective]], [[generic programming|generic]]<br />
| generation = [[3GL]]<br />
| released = 1984, 1994 for ANSI Common Lisp<br />
| designer = [[Scott Fahlman]], [[Richard P. Gabriel]], [[Dave Moon]], [[Guy Steele]], [[Dan Weinreb]]<br />
| developer = ANSI [[X3J13]] committee<br />
| standard reference = [[Common Lisp HyperSpec]]<br />
| latest release version =<br />
| latest release date =<br />
| typing = [[Dynamic typing|dynamic]], [[Strongly-typed programming language|strong]]<br />
| scope = lexical, optionally dynamic<br />
| namespace style = Lisp-2<br />
| implementations = [[Allegro Common Lisp|Allegro CL]], [[Armed Bear Common Lisp|ABCL]], [[CLISP]], [[Clozure CL]], [[CMUCL]], [[Embeddable Common Lisp|ECL]], [[GNU Common Lisp|GCL]], [[LispWorks]], [[Scieneer Common Lisp|Scieneer CL]], [[SBCL]], [[Genera (operating system)|Symbolics Common Lisp]]<br />
| dialects = CLtL1, CLtL2, ANSI Common Lisp<br />
| influenced_by = [[Lisp (programming language)|Lisp]], [[Lisp Machine Lisp]], [[Maclisp]], [[Scheme (programming language)|Scheme]], [[Interlisp]]<br />
| influenced = [[Clojure]], [[Dylan (programming language)|Dylan]], [[Emacs Lisp]], [[EuLisp]], [[ISLISP]], [[Julia (programming language)|Julia]], [[Moose (Perl)|Moose]], [[R (programming language)|R]], [[Cadence SKILL|SKILL]], [[SubL]]<br />
| operating_system = [[Cross-platform]]<br />
| license =<br />
| website = {{URL|http://common-lisp.net/}}<br />
| file_ext = .lisp, .lsp, .l, .cl, .fasl<br />
}}<br />
<br />
'''Common Lisp''' ('''CL''') is a dialect of the [[Lisp (programming language)|Lisp]] [[programming language]], published in [[American National Standards Institute|ANSI]] standard document ''ANSI INCITS 226-1994 (R2004)'' (formerly ''X3.226-1994 (R1999)'').<ref>Quoted from cover of cited standard. ANSI INCITS 226-1994 (R2004), for sale on standard's [http://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+INCITS+226-1994+(R2004) document page].</ref> From the ANSI Common Lisp standard the [[Common Lisp HyperSpec]], a hyperlinked HTML version, has been derived.<ref>[http://www.lispworks.com/documentation/HyperSpec/Front/Help.htm#Authorship Authorship of the Common Lisp HyperSpec]</ref><br />
<br />
The Common Lisp language was developed as a standardized and improved successor of [[Maclisp]]. Thus it is not an implementation, but rather a language [[specification]].<ref>[http://www.lispworks.com/documentation/HyperSpec/Body/01_ab.htm Common Lisp HyperSpec 1.1.2 History]</ref> Several [[#Implementations|implementations]] of the Common Lisp standard are available, including [[free and open source software]] and proprietary products.<ref>[http://common-lisp.net/~dlw/LispSurvey.html Common Lisp Implementations: A Survey]</ref><br />
<br />
The first language documentation was published 1984 as [[Common Lisp the Language]], first edition. A second edition, published in 1990, incorporated many changes to the language, made during the ANSI Common Lisp standardization process. The final ANSI Common Lisp standard then was published in 1994. Since then no update to the standard has been published. Various extensions and improvements to Common Lisp (examples are Unicode, Concurrency, CLOS-based IO) have been provided by implementations.<br />
<br />
Common Lisp is a general-purpose, [[multi-paradigm programming language]]. It supports a combination of [[procedural programming|procedural]], [[functional programming|functional]], and [[object-oriented programming]] paradigms. As a [[dynamic programming language]], it facilitates evolutionary and [[Iterative and incremental development|incremental software development]], with iterative [[Compiler|compilation]] into efficient run-time programs. This incremental development is often done interactively without interrupting the running application.<br />
<br />
It also supports optional type annotation and casting, which can be added as necessary at the later profiling and optimization stages, to permit the compiler to generate more efficient code. For instance, <code>fixnum</code> can hold an [[Boxing (computer science)|unboxed]] integer in a range supported by the hardware and implementation, permitting more efficient arithmetic than on big integers or arbitrary precision types. Similarly, the compiler can be told on a per-module or per-function basis which type safety level is wanted, using ''optimize'' declarations.<br />
<br />
Common Lisp includes [[Common Lisp Object System|CLOS]], an [[object system]] that supports [[multimethods]] and method combinations. It is often implemented with a [[Metaobject]] Protocol.<br />
<br />
Common Lisp is extensible through standard features such as Lisp [[Macro (computer science)|macros]] (code transformations) and reader macros (input parsers for characters).<br />
<br />
Common Lisp provides some backwards compatibility to [[Maclisp]] and to John McCarthy's original [[Lisp (programming language)|Lisp]]. This allows older Lisp software to be ported to Common Lisp.<ref>{{cite web<br />
| url = http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/wang.html<br />
| title = Old LISP programs still run in Common Lisp | accessdate = 2015-05-13<br />
}}</ref><br />
<br />
==Syntax==<br />
<br />
Common Lisp is a dialect of Lisp; it uses [[S-expression]]s to denote both code and data structure. Function calls, macro forms and special forms are written as lists, with the name of the function first, as in these examples:<br />
<br />
<source lang="lisp"><br />
(+ 2 2) ; adds 2 and 2, yielding 4. The function's name is '+'. Lisp has no operators as such.<br />
</source><br />
<source lang="lisp"><br />
(defvar *x*) ; Ensures that a variable *x* exists,<br />
; without giving it a value. The asterisks are part of<br />
; the name, by convention denoting a special (global) variable. <br />
; The symbol *x* is also hereby endowed with the property that<br />
; subsequent bindings of it are dynamic, rather than lexical.<br />
(setf *x* 42.1) ; sets the variable *x* to the floating-point value 42.1<br />
</source><br />
<source lang="lisp"><br />
;; Define a function that squares a number:<br />
(defun square (x)<br />
(* x x))<br />
</source><br />
<source lang="lisp"><br />
;; Execute the function:<br />
(square 3) ; Returns 9<br />
</source><br />
<!-- I truncated this a bit; in smaller browsers, it runs off the side--><br />
<source lang="lisp"><br />
;; the 'let' construct creates a scope for local variables. Here<br />
;; the variable 'a' is bound to 6 and the variable 'b' is bound<br />
;; to 4. Inside the 'let' is a 'body', where the last computed value is returned.<br />
;; Here the result of adding a and b is returned from the 'let' expression.<br />
;; The variables a and b have lexical scope, unless the symbols have been<br />
;; marked as special variables (for instance by a prior DEFVAR).<br />
(let ((a 6)<br />
(b 4))<br />
(+ a b)) ; returns 10<br />
</source><br />
<br />
==Data types==<br />
Common Lisp has many data types.<br />
<br />
===Scalar types===<br />
''Number'' types include [[integer]]s, [[ratio]]s, [[Floating point|floating-point number]]s, and [[complex number]]s.<ref name="reddy">{{cite web<br />
| url = http://random-state.net/features-of-common-lisp.html<br />
| title = Features of Common Lisp<br />
| first = Abhishek | last = Reddy<br />
| date = 2008-08-22<br />
}}</ref> Common Lisp uses [[Arbitrary-precision arithmetic|bignum]]s to represent numerical values of arbitrary size and precision. The ratio type represents fractions exactly, a facility not available in many languages. Common Lisp automatically coerces numeric values among these types as appropriate.<br />
<br />
The Common Lisp ''[[character (computing)|character]]'' type is not limited to [[ASCII]] characters. Most modern implementations allow [[Unicode]] characters.<ref>{{cite web<br />
| url = http://www.cliki.net/Unicode%20Support<br />
| title = Unicode support | work = The Common Lisp Wiki | accessdate = 2008-08-21<br />
}}</ref><br />
<br />
The ''[[Symbol (programming)|symbol]]'' type is common to Lisp languages, but largely unknown outside them. A symbol is a unique, named data object with several parts: name, value, function, property list and package. Of these, ''value cell'' and ''function cell'' are the most important. Symbols in Lisp are often used similarly to identifiers in other languages: to hold the value of a variable; however there are many other uses. Normally, when a symbol is evaluated, its value is returned. Some symbols evaluate to themselves, for example all symbols in the keyword package are self-evaluating. Boolean values in Common Lisp are represented by the self-evaluating symbols T and NIL. Common Lisp has namespaces for symbols, called 'packages'.<br />
<br />
A number of functions are available for [[rounding]] scalar numeric values in various ways. The function <code>round</code> rounds the argument to the nearest integer, with halfway cases rounded to the even integer. The functions <code>truncate</code>, <code>floor</code>, and <code>ceiling</code> round towards zero, down, or up respectively. All these functions return the discarded fractional part as a secondary value. For example, <code>(floor -2.5)</code> yields -3, 0.5; <code>(ceiling -2.5)</code> yields -2, -0.5; <code>(round 2.5)</code> yields 2, 0.5; and <code>(round 3.5)</code> yields 4, -0.5.<br />
<br />
===Data structures===<br />
''Sequence'' types in Common Lisp include lists, vectors, bit-vectors, and strings. There are many operations which can work on any sequence type.<br />
<br />
As in almost all other Lisp dialects, ''lists'' in Common Lisp are composed of ''conses'', sometimes called ''cons cells'' or ''pairs''. A cons is a data structure with two slots, called its ''car'' and ''cdr''. A list is a linked chain of conses or the empty list. Each cons's car refers to a member of the list (possibly another list). Each cons's cdr refers to the next cons—except for the last cons in a list, whose cdr refers to the <code>nil</code> value. Conses can also easily be used to implement trees and other complex data structures; though it is usually advised to use structure or class instances instead. It is also possible to create circular data structures with conses.<br />
<br />
Common Lisp supports multidimensional ''arrays'', and can dynamically resize ''adjustable'' arrays if required. Multidimensional arrays can be used for matrix mathematics. A ''vector'' is a one-dimensional array. Arrays can carry any type as members (even mixed types in the same array) or can be specialized to contain a specific type of members, as in a vector of bits. Usually only a few types are supported. Many implementations can optimize array functions when the array used is type-specialized. Two type-specialized array types are standard: a ''string'' is a vector of characters, while a ''bit-vector'' is a vector of [[bit]]s.<br />
<br />
''[[Hash table]]s'' store associations between data objects. Any object may be used as key or value. Hash tables are automatically resized as needed.<br />
<br />
''Packages'' are collections of symbols, used chiefly to separate the parts of a program into [[namespaces]]. A package may ''export'' some symbols, marking them as part of a public interface. Packages can use other packages.<br />
<br />
''Structures'', similar in use to [[C (programming language)|C]] structs and [[Pascal (programming language)|Pascal]] records, represent arbitrary complex data structures with any number and type of fields (called ''slots''). Structures allow single-inheritance.<br />
<br />
''Classes'' are similar to structures, but offer more dynamic features and multiple-inheritance. (See [[Common Lisp Object System|CLOS]]). Classes have been added late to Common Lisp and there is some conceptual overlap with structures. Objects created of classes are called ''Instances''. A special case are Generic Functions. Generic Functions are both functions and instances.<br />
<br />
===Functions===<br />
Common Lisp supports [[first-class function]]s. For instance, it is possible to write functions that take other functions as arguments or return functions as well. This makes it possible to describe very general operations.<br />
<br />
The Common Lisp library relies heavily on such higher-order functions. For example, the <code>sort</code> function takes a [[relational operator]] as an argument and key function as an optional keyword argument. This can be used not only to sort any type of data, but also to sort data structures according to a key.<br />
<br />
<source lang="lisp"><br />
;; Sorts the list using the > and < function as the relational operator.<br />
(sort (list 5 2 6 3 1 4) #'>) ; Returns (6 5 4 3 2 1)<br />
(sort (list 5 2 6 3 1 4) #'<) ; Returns (1 2 3 4 5 6)<br />
</source><br />
<source lang="lisp"><br />
;; Sorts the list according to the first element of each sub-list.<br />
(sort (list '(9 A) '(3 B) '(4 C)) #'< :key #'first) ; Returns ((3 B) (4 C) (9 A))<br />
</source><br />
<br />
The evaluation model for functions is very simple. When the evaluator encounters a form <code>(f a1 a2...)</code> then it presumes that the symbol named f is one of the following:<br />
<br />
# A special operator (easily checked against a fixed list)<br />
# A macro operator (must have been defined previously)<br />
# The name of a function (default), which may either be a symbol, or a sub-form beginning with the symbol <code>lambda</code>.<br />
<br />
If f is the name of a function, then the arguments a1, a2, ..., an are evaluated in left-to-right order, and the function is found and invoked with those values supplied as parameters.<br />
<br />
====Defining functions====<br />
The [[Defun|macro <code>defun</code>]] defines functions where a function definition gives the name of the function, the names of any arguments, and a function body:<br />
<br />
<source lang="lisp"><br />
(defun square (x)<br />
(* x x))<br />
</source><br />
<br />
Function definitions may include compiler [[Directive (programming)|directives]], known as ''declarations'', which provide hints to the compiler about optimization settings or the data types of arguments. They may also include ''documentation strings'' (docstrings), which the Lisp system may use to provide interactive documentation:<br />
<br />
<source lang="lisp"><br />
(defun square (x)<br />
"Calculates the square of the single-float x."<br />
(declare (single-float x) (optimize (speed 3) (debug 0) (safety 1)))<br />
(the single-float (* x x)))<br />
</source><br />
<br />
Anonymous functions ([[function literal]]s) are defined using <code>lambda</code> expressions, e.g. <code>(lambda&nbsp;(x)&nbsp;(*&nbsp;x&nbsp;x))</code> for a function that squares its argument. Lisp programming style frequently uses higher-order functions for which it is useful to provide anonymous functions as arguments.<br />
<br />
Local functions can be defined with <code>flet</code> and <code>labels</code>.<br />
<br />
<source lang="lisp"><br />
(flet ((square (x)<br />
(* x x)))<br />
(square 3))<br />
</source><br />
<br />
There are a number of other operators related to the definition and manipulation of functions. For instance, a function may be compiled with the <code>compile</code> operator. (Some Lisp systems run functions using an interpreter by default unless instructed to compile; others compile every function).<br />
<br />
====Defining generic functions and methods====<br />
The macro <code>defgeneric</code> defines generic functions.<br />
The macro <code>defmethod</code> defines methods. Generic functions are a collection of methods.<br />
<br />
Methods can specialize their parameters over CLOS ''standard classes'', ''system classes'', ''structure classes'' or objects. For many types there are corresponding ''system classes''.<br />
<br />
When a generic function is called, multiple-dispatch will determine the effective method to use.<br />
<br />
<source lang="lisp"><br />
(defgeneric add (a b))<br />
</source><br />
<br />
<source lang="lisp"><br />
(defmethod add ((a number) (b number))<br />
(+ a b))<br />
</source><br />
<br />
<source lang="lisp"><br />
(defmethod add ((a vector) (b number))<br />
(map 'vector (lambda (n) (+ n b)) a))<br />
</source><br />
<br />
<source lang="lisp"><br />
(defmethod add ((a vector) (b vector))<br />
(map 'vector #'+ a b))<br />
</source><br />
<source lang="lisp"><br />
(defmethod add ((a string)(b string))<br />
(concatenate 'string a b) )<br />
</source><br />
<source lang="lisp"><br />
(add 2 3) ; returns 5<br />
(add #(1 2 3 4) 7) ; returns #(8 9 10 11)<br />
(add #(1 2 3 4) #(4 3 2 1)) ; returns #(5 5 5 5)<br />
(add "COMMON " "LISP") ; returns "COMMON LISP"<br />
</source><br />
<br />
Generic Functions are also a first class data type. There are many more features to Generic Functions and Methods than described above.<br />
<br />
====The function namespace====<br />
<!-- This section name is linked from several places; if you change it, update the links. --><br />
<br />
The namespace for function names is separate from the namespace for data variables. This is a key difference between Common Lisp and [[Scheme (programming language)|Scheme]]. For Common Lisp, operators that define names in the function namespace include <code>defun</code>, <code>flet</code>, <code>labels</code>, <code>defmethod</code> and <code>defgeneric</code>.<br />
<br />
To pass a function by name as an argument to another function, one must use the <code>function</code> special operator, commonly abbreviated as <code>#'</code>. The first <code>sort</code> example above refers to the function named by the symbol <code>&gt;</code> in the function namespace, with the code <code>#'&gt;</code>. Conversely, to call a function passed in such a way, one would use the <code>funcall</code> operator on the argument.<br />
<br />
[[Scheme (programming language)|Scheme's]] evaluation model is simpler: there is only one namespace, and all positions in the form are evaluated (in any order) -- not just the arguments. Code written in one dialect is therefore sometimes confusing to programmers more experienced in the other. For instance, many Common Lisp programmers like to use descriptive variable names such as ''list'' or ''string'' which could cause problems in Scheme, as they would locally shadow function names.<br />
<br />
Whether a separate namespace for functions is an advantage is a source of contention in the Lisp community. It is usually referred to as the ''Lisp-1 vs. Lisp-2 debate''. Lisp-1 refers to Scheme's model and Lisp-2 refers to Common Lisp's model. These names were coined in a 1988 paper by [[Richard P. Gabriel]] and [[Kent Pitman]], which extensively compares the two approaches.<ref>{{cite journal |title=Technical Issues of Separation in Function Cells and Value Cells |url=http://www.nhplace.com/kent/Papers/Technical-Issues.html |authors=Richard P. Gabriel, Kent M. Pitman |journal=Lisp and Symbolic Computation |date = June 1988|volume=1 |issue=1 |pages=81–101 |doi=10.1007/bf01806178}}</ref><br />
<br />
===Other types===<br />
Other data types in Common Lisp include:<br />
<br />
*''Pathnames'' represent files and directories in the [[filesystem]]. The Common Lisp pathname facility is more general than most operating systems' file naming conventions, making Lisp programs' access to files broadly portable across diverse systems.<br />
*Input and output ''streams'' represent sources and sinks of binary or textual data, such as the terminal or open files.<br />
*Common Lisp has a built-in [[pseudo-random number generator]] (PRNG). ''Random state'' objects represent reusable sources of pseudo-random numbers, allowing the user to seed the PRNG or cause it to replay a sequence.<br />
*''Conditions'' are a type used to represent errors, exceptions, and other "interesting" events to which a program may respond.<br />
*''Classes'' are [[first-class object]]s, and are themselves instances of classes called [[metaclasses|metaobject classes]] ([[metaclasses]] for short).<br />
*''Readtables'' are a type of object which control how Common Lisp's reader parses the text of source code. By controlling which readtable is in use when code is read in, the programmer can change or extend the language's syntax.<br />
<br />
==Scope==<br />
<br />
Like programs in many other programming languages, Common Lisp programs make use of names to refer to variables, functions, and many other kinds of entities. Named references are subject to scope.<br />
<br />
The association between a name and the entity which the name refers to is called a binding.<br />
<br />
Scope refers to the set of circumstances in which a name is determined to have a particular binding.<br />
<br />
===Determiners of scope===<br />
<br />
The circumstances which determine scope in Common Lisp include:<br />
<br />
* the location of a reference within an expression. If it's the leftmost position of a compound, it refers to a special operator or a macro or function binding, otherwise to a variable binding or something else.<br />
* the kind of expression in which the reference takes place. For instance, <code>(go x)</code> means transfer control to label <code>x</code>, whereas <code>(print x)</code> refers to the variable <code>x</code>. Both scopes of <code>x</code> can be active in the same region of program text, since tagbody labels are in a separate namespace from variable names. A special form or macro form has complete control over the meanings of all symbols in its syntax. For instance in <code>(defclass x (a b) ())</code>, a class definition, the <code>(a b)</code> is a list of base classes, so these names are looked up in the space of class names, and <code>x</code> isn't a reference to an existing binding, but the name of a new class being derived from <code>a</code> and <code>b</code>. These facts emerge purely from the semantics of <code>defclass</code>. The only generic fact about this expression is that <code>defclass</code> refers to a macro binding; everything else is up to <code>defclass</code>.<br />
* the location of the reference within the program text. For instance, if a reference to variable <code>x</code> is enclosed in a binding construct such as a <code>let</code> which defines a binding for <code>x</code>, then the reference is in the scope created by that binding.<br />
* for a variable reference, whether or not a variable symbol has been, locally or globally, declared special. This determines whether the reference is resolved within a lexical environment, or within a dynamic environment.<br />
* the specific instance of the environment in which the reference is resolved. An environment is a run-time dictionary which maps symbols to bindings. Each kind of reference uses its own kind of environment. References to lexical variables are resolved in a lexical environment, et cetera. More than one environment can be associated with the same reference. For instance, thanks to recursion or the use of multiple threads, multiple activations of the same function can exist at the same time. These activations share the same program text, but each has its own lexical environment instance.<br />
<br />
To understand what a symbol refers to, the Common Lisp programmer must know what kind of reference is being expressed, what kind of scope it uses if it is a variable reference (dynamic versus lexical scope), and also the run-time situation: in what environment is the reference resolved, where was the binding introduced into the environment, et cetera.<br />
<br />
===Kinds of environment===<br />
<br />
====Global====<br />
<br />
Some environments in Lisp are globally pervasive. For instance, if a new type is defined, it is known everywhere thereafter. References to that type look it up in this global environment.<br />
<br />
====Dynamic====<br />
<br />
One type of environment in Common Lisp is the dynamic environment. Bindings established in this environment have dynamic extent, which means that a binding is established at the start of the execution of some construct, such as a <code>let</code> block, and disappears when that construct finishes executing: its lifetime is tied to the dynamic activation and deactivation of a block. However, a dynamic binding is not just visible within that block; it is also visible to all functions invoked from that block. This type of visibility is known as indefinite scope. Bindings which exhibit dynamic extent (lifetime tied to the activation and deactivation of a block) and indefinite scope (visible to all functions which are called from that block) are said to have dynamic scope.<br />
<br />
Common Lisp has support for dynamically scoped variables, which are also called special variables. Certain other kinds of bindings are necessarily dynamically scoped also, such as restarts and catch tags. Function bindings cannot be dynamically scoped using <code>flet</code> (which only provides lexically scoped function bindings), but function objects (a first-level object in Common Lisp) can be assigned to dynamically scoped variables, bound using <code>let</code> in dynamic scope, then called using <code>funcall</code> or <code>APPLY</code>.<br />
<br />
Dynamic scope is extremely useful because it adds referential clarity and discipline to [[global variable]]s. Global variables are frowned upon in computer science as potential sources of error, because they can give rise to ad-hoc, covert channels of communication among modules that lead to unwanted, surprising interactions.<br />
<br />
In Common Lisp, a special variable which has only a top-level binding behaves just like a global variable in other programming languages. A new value can be stored into it, and that value simply replaces what is in the top-level binding. Careless replacement of the value of a global variable is at the heart of bugs caused by use of global variables. However, another way to work with a special variable is to give it a new, local binding within an expression. This is sometimes referred to as "rebinding" the variable. Binding a dynamically scoped variable temporarily creates a new memory location for that variable, and associates the name with that location. While that binding is in effect, all references to that variable refer to the new binding; the previous binding is hidden. When execution of the binding expression terminates, the temporary memory location is gone, and the old binding is revealed, with the original value intact. Of course, multiple dynamic bindings for the same variable can be nested.<br />
<br />
In Common Lisp implementations which support multithreading, dynamic scopes are specific to each thread of execution. Thus special variables serve as an abstraction for thread local storage. If one thread rebinds a special variable, this rebinding has no effect on that variable in other threads. The value stored in a binding can only be retrieved by the thread which created that binding. If each thread binds some special variable <code>*x*</code>, then <code>*x*</code> behaves like thread-local storage. Among threads which do not rebind <code>*x*</code>, it behaves like an ordinary global: all of these threads refer to the same top-level binding of <code>*x*</code>.<br />
<br />
Dynamic variables can be used to extend the execution context with additional context information which is implicitly passed from function to function without having to appear as an extra function parameter. This is especially useful when the control transfer has to pass through layers of unrelated code, which simply cannot be extended with extra parameters to pass the additional data. A situation like this usually calls for a global variable. That global variable must be saved and restored, so that the scheme doesn't break under recursion: dynamic variable rebinding takes care of this. And that variable must be made thread-local (or else a big mutex must be used) so the scheme doesn't break under threads: dynamic scope implementations can take care of this also.<br />
<br />
In the Common Lisp library, there are many standard special variables. For instance, all standard I/O streams are stored in the top-level bindings of well-known special variables. The standard output stream is stored in *standard-output*.<br />
<br />
Suppose a function foo writes to standard output:<br />
<br />
<source lang="lisp"><br />
(defun foo ()<br />
(format t "Hello, world"))<br />
</source><br />
<br />
To capture its output in a character string, *standard-output* can be bound to a string stream and called:<br />
<br />
<source lang="lisp"><br />
(with-output-to-string (*standard-output*)<br />
(foo))<br />
</source><br />
<br />
-> "Hello, world" ; gathered output returned as a string<br />
<br />
====Lexical====<br />
<br />
Common Lisp supports lexical environments. Formally, the bindings in a lexical environment have [[lexical scope]] and may have either indefinite extent or dynamic extent, depending on the type of namespace. [[Lexical scope]] means that visibility is physically restricted to the block in which the binding is established. References which are not textually (i.e. lexically) embedded in that block simply do not see that binding.<br />
<br />
The tags in a TAGBODY have lexical scope. The expression (GO X) is erroneous if it is not actually embedded in a TAGBODY which contains a label X. However, the label bindings disappear when the TAGBODY terminates its execution, because they have dynamic extent. If that block of code is re-entered by the invocation of a lexical closure, it is invalid for the body of that closure to try to transfer control to a tag via GO:<br />
<br />
<source lang="lisp"><br />
(defvar *stashed*) ;; will hold a function<br />
<br />
(tagbody<br />
(setf *stashed* (lambda () (go some-label)))<br />
(go end-label) ;; skip the (print "Hello")<br />
some-label<br />
(print "Hello")<br />
end-label)<br />
-> NIL<br />
</source><br />
<br />
When the TAGBODY is executed, it first evaluates the setf form which stores a function in the special variable *stashed*. Then the (go end-label) transfers control to end-label, skipping the code (print "Hello"). Since end-label is at the end of the tagbody, the tagbody terminates, yielding NIL. Suppose that the previously remembered function is now called:<br />
<br />
<source lang="lisp"><br />
(funcall *stashed*) ;; Error!<br />
</source><br />
<br />
This situation is erroneous. One implementation's response is an error condition containing the message, "GO: tagbody for tag SOME-LABEL has already been left". The function tried to evaluate (go some-label), which is lexically embedded in the tagbody, and resolves to the label. However, the tagbody isn't executing (its extent has ended), and so the control transfer cannot take place.<br />
<br />
Local function bindings in Lisp have [[lexical scope]], and variable bindings also have lexical scope by default. By contrast with GO labels, both of these have indefinite extent. When a lexical function or variable binding is established, that binding continues to exist for as long as references to it are possible, even after the construct which established that binding has terminated. References to lexical variables and functions after the termination of their establishing construct are possible thanks to [[lexical closure]]s.<br />
<br />
Lexical binding is the default binding mode for Common Lisp variables. For an individual symbol, it can be switched to dynamic scope, either by a local declaration, by a global declaration. The latter may occur implicitly through the use of a construct like DEFVAR or DEFPARAMETER. It is an important convention in Common Lisp programming that special (i.e. dynamically scoped) variables have names which begin and end with an asterisk [[Sigil (computer programming)|sigil]] <code>*</code> in what is called the “[[earmuff]] convention”.<ref>[http://letoverlambda.com/index.cl/guest/chap2.html Chapter 2] of [[Let Over Lambda]]</ref> If adhered to, this convention effectively creates a separate namespace for special variables, so that variables intended to be lexical are not accidentally made special.<br />
<br />
[[Lexical scope]] is useful for several reasons.<br />
<br />
Firstly, references to variables and functions can be compiled to efficient machine code, because the run-time environment structure is relatively simple. In many cases it can be optimized to stack storage, so opening and closing lexical scopes has minimal overhead. Even in cases where full closures must be generated, access to the closure's environment is still efficient; typically each variable becomes an offset into a vector of bindings, and so a variable reference becomes a simple load or store instruction with a base-plus-offset [[addressing mode]].<br />
<br />
Secondly, lexical scope (combined with indefinite extent) gives rise to the [[lexical closure]], which in turn creates a whole paradigm of programming centered around the use of functions being first-class objects, which is at the root of functional programming.<br />
<br />
Thirdly, perhaps most importantly, even if lexical closures are not exploited, the use of lexical scope isolates program modules from unwanted interactions. Due to their restricted visibility, lexical variables are private. If one module A binds a lexical variable X, and calls another module B, references to X in B will not accidentally resolve to the X bound in A. B simply has no access to X. For situations in which disciplined interactions through a variable are desirable, Common Lisp provides special variables. Special variables allow for a module A to set up a binding for a variable X which is visible to another module B, called from A. Being able to do this is an advantage, and being able to prevent it from happening is also an advantage; consequently, Common Lisp supports both lexical and [[dynamic scope]].<br />
<br />
==Macros==<br />
A ''[[Macro (computer science)|macro]]'' in Lisp superficially resembles a function in usage. However, rather than representing an expression which is evaluated, it represents a transformation of the program source code. The macro gets the source it surrounds as arguments, binds them to its parameters and computes a new source form. This new form can also use a macro. The macro expansion is repeated until the new source form does not use a macro. The final computed form is the source code executed at runtime.<br />
<br />
Typical uses of macros in Lisp:<br />
<br />
* new control structures (example: looping constructs, branching constructs)<br />
* scoping and binding constructs<br />
* simplified syntax for complex and repeated source code<br />
* top-level defining forms with compile-time side-effects<br />
* data-driven programming<br />
* embedded domain specific languages (examples: SQL, HTML, Prolog)<br />
* implicit finalization forms<br />
<br />
Various standard Common Lisp features also need to be implemented as macros, such as:<br />
<br />
* the standard <code>setf</code> abstraction, to allow custom compile-time expansions of assignment/access operators<br />
* <code>with-accessors</code>, <code>with-slots</code>, <code>with-open-file</code> and other similar <code>WITH</code> macros<br />
* Depending on implementation, <code>if</code> or <code>cond</code> is a macro built on the other, the special operator; <code>when</code> and <code>unless</code> consist of macros<br />
* The powerful <code>loop</code> domain-specific language<br />
<br />
Macros are defined by the ''defmacro'' macro. The special operator ''macrolet'' allows the definition of local (lexically scoped) macros. It is also possible to define macros for symbols using ''define-symbol-macro'' and ''symbol-macrolet''.<br />
<br />
[[Paul Graham (computer programmer)|Paul Graham]]'s book [[On Lisp]] describes the use of macros in Common Lisp in detail. [[Doug Hoyte]]'s book [[Let Over Lambda]] extends the discussion on macros, claiming "Macros are the single greatest advantage that lisp has as a programming language and the single greatest advantage of any programming language." Hoyte provides several examples of iterative development of macros.<br />
<br />
===Example using a macro to define a new control structure===<br />
Macros allow Lisp programmers to create new syntactic forms in the language. One typical use is to create new control structures. The example macro provides an <code>until</code> looping construct. The syntax is:<br />
<br />
<source lang="text"><br />
(until test form*)<br />
</source><br />
<br />
The macro definition for ''until'':<br />
<source lang="lisp"><br />
(defmacro until (test &body body)<br />
(let ((start-tag (gensym "START"))<br />
(end-tag (gensym "END")))<br />
`(tagbody ,start-tag<br />
(when ,test (go ,end-tag))<br />
(progn ,@body)<br />
(go ,start-tag)<br />
,end-tag)))<br />
</source><br />
<br />
''tagbody'' is a primitive Common Lisp special operator which provides the ability to name tags and use the ''go'' form to jump to those tags. The backquote ''`'' provides a notation that provides code templates, where the value of forms preceded with a comma are filled in. Forms preceded with comma and at-sign are ''spliced'' in. The tagbody form tests the end condition. If the condition is true, it jumps to the end tag. Otherwise the provided body code is executed and then it jumps to the start tag.<br />
<br />
An example form using above ''until'' macro:<br />
<source lang="lisp"><br />
(until (= (random 10) 0)<br />
(write-line "Hello"))<br />
</source><br />
<br />
The code can be expanded using the function ''macroexpand-1''. The expansion for above example looks like this:<br />
<source lang="lisp"><br />
(TAGBODY<br />
#:START1136<br />
(WHEN (ZEROP (RANDOM 10))<br />
(GO #:END1137))<br />
(PROGN (WRITE-LINE "hello"))<br />
(GO #:START1136)<br />
#:END1137)<br />
</source><br />
<br />
During macro expansion the value of the variable ''test'' is ''(= (random 10) 0)'' and the value of the variable ''body'' is ''((write-line "Hello"))''. The body is a list of forms.<br />
<br />
Symbols are usually automatically upcased. The expansion uses the TAGBODY with two labels. The symbols for these labels are computed by GENSYM and are not interned in any package. Two ''go'' forms use these tags to jump to. Since ''tagbody'' is a primitive operator in Common Lisp (and not a macro), it will not be expanded into something else. The expanded form uses the ''when'' macro, which also will be expanded. Fully expanding a source form is called ''code walking''.<br />
<br />
In the fully expanded (''walked'') form, the ''when'' form is replaced by the primitive ''if'':<br />
<source lang="lisp"><br />
(TAGBODY<br />
#:START1136<br />
(IF (ZEROP (RANDOM 10))<br />
(PROGN (GO #:END1137))<br />
NIL)<br />
(PROGN (WRITE-LINE "hello"))<br />
(GO #:START1136))<br />
#:END1137)<br />
</source><br />
<br />
All macros must be expanded before the source code containing them can be evaluated or compiled normally. Macros can be considered functions that accept and return [[abstract syntax tree]]s (Lisp S-expressions). These functions<br />
are invoked before the evaluator or compiler to produce the final source code.<br />
Macros are written in normal Common Lisp, and may use any Common Lisp (or third-party) operator available.<br />
<br />
===Variable capture and shadowing===<br />
Common Lisp macros are capable of what is commonly called ''variable capture'', where symbols in the macro-expansion body coincide with those in the calling context, allowing the programmer to create macros wherein various symbols have special meaning. The term ''variable capture'' is somewhat misleading, because all namespaces are vulnerable to unwanted capture, including the operator and function namespace, the tagbody label namespace, catch tag, condition handler and restart namespaces.<br />
<br />
''Variable capture'' can introduce software defects. This happens in one of the following two ways:<br />
<br />
* In the first way, a macro expansion can inadvertently make a symbolic reference which the macro writer assumed will resolve in a global namespace, but the code where the macro is expanded happens to provide a local, shadowing definition which steals that reference. Let this be referred to as type 1 capture.<br />
<br />
* The second way, type 2 capture, is just the opposite: some of the arguments of the macro are pieces of code supplied by the macro caller, and those pieces of code are written such that they make references to surrounding bindings. However, the macro inserts these pieces of code into an expansion which defines its own bindings that accidentally captures some of these references.<br />
<br />
The Scheme dialect of Lisp provides a macro-writing system which provides the referential transparency that eliminates both types of capture problem. This type of macro system is sometimes called "hygienic", in particular by its proponents (who regard macro systems which do not automatically solve this problem as unhygienic). {{Citation needed|date=May 2011}}<br />
<br />
In Common Lisp, macro hygiene is ensured one of two different ways.<br />
<br />
One approach is to use [[gensym]]s: guaranteed-unique symbols which can be used in a macro-expansion without threat of capture. The use of gensyms in a macro definition is a manual chore, but macros can be written which simplify the instantiation and use of gensyms. Gensyms solve type 2 capture easily, but they are not applicable to type 1 capture in the same way, because the macro expansion cannot rename the interfering symbols in the surrounding code which capture its references. Gensyms could be used to provide stable aliases for the global symbols which the macro expansion needs. The macro expansion would use these secret aliases rather than the well-known names, so redefinition of the well-known names would have no ill effect on the macro.<br />
<br />
Another approach is to use packages. A macro defined in its own package can simply use internal symbols in that package in its expansion. The use of packages deals with type 1 and type 2 capture.<br />
<br />
However, packages don't solve the type 1 capture of references to standard Common Lisp functions and operators. The reason is that the use of packages to solve capture problems revolves around the use of private symbols (symbols in one package, which are not imported into, or otherwise made visible in other packages). Whereas the Common Lisp library symbols are external, and frequently imported into or made visible in user-defined packages.<br />
<br />
The following is an example of unwanted capture in the operator namespace, occurring in the expansion of a macro:<br />
<br />
<source lang="lisp"><br />
;; expansion of UNTIL makes liberal use of DO<br />
(defmacro until (expression &body body)<br />
`(do () (,expression) ,@body))<br />
<br />
;; macrolet establishes lexical operator binding for DO<br />
(macrolet ((do (...) ... something else ...))<br />
(until (= (random 10) 0) (write-line "Hello")))<br />
</source><br />
<br />
The <code>until</code> macro will expand into a form which calls <code>do</code> which is intended to refer to the standard Common Lisp macro <code>do</code>. However, in this context, <code>do</code> may have a completely different meaning, so <code>until</code> may not work properly.<br />
<br />
Common Lisp solves the problem of the shadowing of standard operators and functions by forbidding their redefinition. Because it redefines the standard operator <code>do</code>, the preceding is actually a fragment of non-conforming Common Lisp, which allows implementations to diagnose and reject it.<br />
<br />
==Condition system==<br />
The ''condition system'' is responsible for [[exception handling]] in Common Lisp.<ref name="Seibel2005">{{cite book|author=Peter Seibel|title=Practical Common Lisp|url=http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html|date=7 April 2005|publisher=Apress|isbn=978-1-59059-239-7}}</ref> It provides ''conditions'', ''handler''s and ''restart''s. ''Condition''s are objects describing an exceptional situation (for example an error). If a ''condition'' is signaled, the Common Lisp system searches for a ''handler'' for this condition type and calls the handler. The ''handler'' can now search for restarts and use one of these restarts to repair the current problem. As part of a user interface (for example of a debugger), these restarts can also be presented to the user, so that the user can select and invoke one of the available restarts. Since the condition handler is called in the context of the error (without unwinding the stack), full error recovery is possible in many cases, where other exception handling systems would have already terminated the current routine. The debugger itself can also be customized or replaced using the <code>*debugger-hook*</code> dynamic variable.<br />
<br />
In the following example (using [[Symbolics Genera]]) the user tries to open a file in a Lisp function ''test'' called from the Read-Eval-Print-LOOP ([[REPL]]), when the file does not exist. The Lisp system presents four restarts. The user selects the ''Retry OPEN using a different pathname'' restart and enters a different pathname (lispm-init.lisp instead of lispm-int.lisp). The user code does not contain any error handling code. The whole error handling and restart code is provided by the Lisp system, which can handle and repair the error without terminating the user code.<br />
<br />
<source lang="text"><br />
Command: (test ">zippy>lispm-int.lisp")<br />
<br />
Error: The file was not found.<br />
For lispm:>zippy>lispm-int.lisp.newest<br />
<br />
LMFS:OPEN-LOCAL-LMFS-1<br />
Arg 0: #P"lispm:>zippy>lispm-int.lisp.newest"<br />
<br />
s-A, <Resume>: Retry OPEN of lispm:>zippy>lispm-int.lisp.newest<br />
s-B: Retry OPEN using a different pathname<br />
s-C, <Abort>: Return to Lisp Top Level in a TELNET server<br />
s-D: Restart process TELNET terminal<br />
<br />
-> Retry OPEN using a different pathname<br />
Use what pathname instead [default lispm:>zippy>lispm-int.lisp.newest]:<br />
lispm:>zippy>lispm-init.lisp.newest<br />
<br />
...the program continues<br />
</source><br />
<br />
==Common Lisp Object System (CLOS)==<br />
<br />
{{Main|Common Lisp Object System}}<br />
<br />
Common Lisp includes a toolkit for [[object-oriented programming]], the Common Lisp Object System or [[Common Lisp Object System|CLOS]], which is one of the most powerful object systems available in any language. For example, [[Peter Norvig]] explains how many [[Design pattern (computer science)|Design Patterns]] are simpler to implement in a dynamic language with the features of CLOS (Multiple Inheritance, Mixins, Multimethods, Metaclasses, Method combinations, etc.).<ref>[http://norvig.com/design-patterns/ppframe.htm Peter Norvig, Design Patterns in Dynamic Programming]</ref><br />
Several extensions to Common Lisp for object-oriented programming have been proposed to be included into the ANSI Common Lisp standard, but eventually CLOS was adopted as the standard object-system for Common Lisp. CLOS is a [[dynamic programming language|dynamic]] object system with [[multiple dispatch]] and [[multiple inheritance]], and differs radically from the OOP facilities found in static languages such as [[C++]] or [[Java (programming language)|Java]]. As a dynamic object system, CLOS allows changes at runtime to generic functions and classes. Methods can be added and removed, classes can be added and redefined, objects can be updated for class changes and the class of objects can be changed.<br />
<br />
CLOS has been integrated into ANSI Common Lisp. Generic Functions can be used like normal functions and are a first-class data type. Every CLOS class is integrated into the Common Lisp type system. Many Common Lisp types have a corresponding class. There is more potential use of CLOS for Common Lisp. The specification does not say whether conditions are implemented with CLOS. Pathnames and streams could be implemented with CLOS. These further usage possibilities of CLOS for ANSI Common Lisp are not part of the standard. Actual Common Lisp implementations are using CLOS for pathnames, streams, input/output, conditions, the implementation of CLOS itself and more.<br />
<br />
==Compiler and interpreter==<br />
Several implementations of earlier Lisp dialects provided both an interpreter and a compiler. Unfortunately often the semantics were different. These earlier Lisps implemented lexical scoping in the compiler and dynamic scoping in the interpreter. Common Lisp requires that both the interpreter and compiler use lexical scoping by default. The Common Lisp standard describes both the semantics of the interpreter and a compiler. The compiler can be called using the function ''compile'' for individual functions and using the function ''compile-file'' for files. Common Lisp allows type declarations and provides ways to influence the compiler code generation policy. For the latter various optimization qualities can be given values between 0 (not important) and 3 (most important): ''speed'', ''space'', ''safety'', ''debug'' and ''compilation-speed''.<br />
<br />
There is also a function to evaluate Lisp code: ''eval''. ''eval'' takes code as pre-parsed s-expressions and not, like in some other languages, as text strings. This way code can be constructed with the usual Lisp functions for constructing lists and symbols and then this code can be evaluated with ''eval''. Several Common Lisp implementations (like Clozure CL and SBCL) are implementing ''eval'' using their compiler. This way code is compiled, even though it is evaluated using the function ''eval''.<br />
<br />
The file compiler is invoked using the function ''compile-file''. The generated file with compiled code is called a ''fasl'' (from ''fast load'') file. These ''fasl'' files and also source code files can be loaded with the function ''load'' into a running Common Lisp system. Depending on the implementation, the file compiler generates byte-code (for example for the [[Java Virtual Machine]]), [[C (programming language)|C language]] code (which then is compiled with a C compiler) or, directly, native code.<br />
<br />
Common Lisp implementations can be used interactively, even though the code gets fully compiled. The idea of an [[Interpreted language]] thus does not apply for interactive Common Lisp.<br />
<br />
The language makes distinction between read-time, compile-time, load-time and run-time, and allows user code to also make this distinction to perform the wanted type of processing at the wanted step.<br />
<br />
Some special operators are provided to especially suit interactive development; for instance, <code>defvar</code> will only assign a value to its provided variable if it wasn't already bound, while <code>defparameter</code> will always perform the assignment. This distinction is useful when interactively evaluating, compiling and loading code in a live image.<br />
<br />
Some features are also provided to help writing compilers and interpreters. Symbols consist of first-level objects and are directly manipulable by user code. The <code>progv</code> special operator allows to create lexical bindings programmatically, while packages are also manipulable. The Lisp compiler itself is available at runtime to compile files or individual functions. These make it easy to use Lisp as an intermediate compiler or interpreter for another language.<br />
<br />
==Code examples==<br />
<br />
===Birthday paradox===<br />
The following program calculates the smallest number of people in a room for whom the probability of completely unique birthdays is less than 50% (the [[birthday paradox]], where for 1 person the probability is obviously 100%, for 2 it is 364/365, etc.). The Answer is 23.<br />
<br />
<source lang="lisp"><br />
;; By convention, constants in Common Lisp are enclosed with + characters.<br />
(defconstant +year-size+ 365)<br />
<br />
(defun birthday-paradox (probability number-of-people)<br />
(let ((new-probability (* (/ (- +year-size+ number-of-people)<br />
+year-size+)<br />
probability)))<br />
(if (< new-probability 0.5)<br />
(1+ number-of-people)<br />
(birthday-paradox new-probability (1+ number-of-people)))))<br />
</source><br />
<br />
Calling the example function using the [[REPL]] (Read Eval Print Loop):<br />
<source lang="text"><br />
CL-USER > (birthday-paradox 1.0 1)<br />
23<br />
</source><br />
<br />
===Sorting a list of person objects===<br />
<br />
We define a class <code>person</code> and a method for displaying the name and age of a person.<br />
Next we define a group of persons as a list of PERSON objects.<br />
Then we iterate over the sorted list.<br />
<br />
<source lang="lisp"><br />
(defclass person ()<br />
((name :initarg :name :reader person-name)<br />
(age :initarg :age :reader person-age))<br />
(:documentation "The class PERSON with slots NAME and AGE."))<br />
<br />
(defmethod print-object ((object person) stream)<br />
"Displaying a PERSON object to an output stream."<br />
(print-unreadable-object (object stream :type t)<br />
(format stream "~a (~a)" (person-name object) (person-age object))))<br />
<br />
(defparameter *group*<br />
(list (make-instance 'person :name "Bob" :age 33)<br />
(make-instance 'person :name "Chris" :age 16)<br />
(make-instance 'person :name "Ash" :age 23))<br />
"A list of PERSON objects.")<br />
<br />
(dolist (person (sort (copy-list *group*)<br />
#'><br />
:key #'person-age))<br />
(print person))<br />
</source><br />
<br />
It prints the three names with descending age.<br />
<source lang="text"><br />
#<PERSON Bob (33)> <br />
#<PERSON Ash (23)> <br />
#<PERSON Chris (16)> <br />
</source><br />
<br />
===Exponentiating by squaring===<br />
<br />
Use of the LOOP macro is demonstrated:<br />
<br />
<source lang="lisp"><br />
(defun power (x n)<br />
(loop with result = 1<br />
while (plusp n)<br />
when (oddp n) do (setf result (* result x))<br />
do (setf x (* x x)<br />
n (truncate n 2))<br />
finally (return result)))<br />
</source><br />
<br />
Example use:<br />
<br />
<source lang="text"><br />
CL-USER > (power 2 200)<br />
1606938044258990275541962092341162602522202993782792835301376<br />
</source><br />
<br />
Compare with the built in exponentiation:<br />
<br />
<source lang="text"><br />
CL-USER > (= (expt 2 200) (power 2 200))<br />
T<br />
</source><br />
<br />
===Find the list of available shells===<br />
<br />
WITH-OPEN-FILE is a macro that opens a file and provides a stream. When the form is returning, the file is automatically closed. FUNCALL calls a function object. The LOOP collects all lines that match the predicate.<br />
<br />
<source lang="lisp"><br />
(defun list-matching-lines (file predicate)<br />
"Returns a list of lines in file, for which the predicate applied to<br />
the line returns T."<br />
(with-open-file (stream file)<br />
(loop for line = (read-line stream nil nil)<br />
while line<br />
when (funcall predicate line)<br />
collect it)))<br />
</source><br />
<br />
The function AVAILABLE-SHELLS calls above function LIST-MATCHING-LINES with a pathname and an anonymous function as the predicate. The predicate returns the pathname of a shell or NIL (if the string is not the filename of a shell).<br />
<br />
<source lang="lisp"><br />
(defun available-shells (&optional (file #p"/etc/shells"))<br />
(list-matching-lines<br />
file<br />
(lambda (line)<br />
(and (plusp (length line))<br />
(char= (char line 0) #\/)<br />
(pathname<br />
(string-right-trim '(#\space #\tab) line))))))<br />
</source><br />
<br />
Example results (on Mac OS X 10.6):<br />
<br />
<source lang="lisp"><br />
CL-USER > (available-shells)<br />
(#P"/bin/bash" #P"/bin/csh" #P"/bin/ksh" #P"/bin/sh" #P"/bin/tcsh" #P"/bin/zsh")<br />
</source><br />
<br />
==Comparison with other Lisps==<br />
<!-- needs lots --><br />
Common Lisp is most frequently compared with, and contrasted to, [[Scheme (programming language)|Scheme]]—if only because they are the two most popular Lisp dialects. Scheme predates CL, and comes not only from the same Lisp tradition but from some of the same engineers—[[Guy L. Steele, Jr.|Guy L. Steele]], with whom [[Gerald Jay Sussman]] designed Scheme, chaired the standards committee for Common Lisp.<br />
<br />
Common Lisp is a general-purpose programming language, in contrast to Lisp variants such as [[Emacs Lisp]] and [[AutoLISP]] which are [[extension languages]] embedded in particular products. Unlike many earlier Lisps, Common Lisp (like [[Scheme (programming language)|Scheme]]) uses lexical variable [[scope (programming)|scope]] by default for both interpreted and compiled code.<br />
<br />
Most of the Lisp systems whose designs contributed to Common Lisp—such as [[ZetaLisp]] and Franz Lisp—used dynamically [[scope (programming)|scoped]] variables in their interpreters and lexically scoped variables in their compilers. Scheme introduced the sole use of lexically scoped variables to Lisp; an inspiration from [[ALGOL 68]] which was widely recognized as a good idea. CL supports dynamically scoped variables as well, but they must be explicitly declared as "special". There are no differences in scoping between ANSI CL interpreters and compilers.<br />
<br />
Common Lisp is sometimes termed a ''Lisp-2'' and Scheme a ''Lisp-1'', referring to CL's use of separate namespaces for functions and variables. (In fact, CL has ''many'' namespaces, such as those for go tags, block names, and <code>loop</code> keywords). There is a long-standing controversy between CL and Scheme advocates over the tradeoffs involved in multiple namespaces. In Scheme, it is (broadly) necessary to avoid giving variables names which clash with functions; Scheme functions frequently have arguments named <code>lis</code>, <code>lst</code>, or <code>lyst</code> so as not to conflict with the system function <code>list</code>. However, in CL it is necessary to explicitly refer to the function namespace when passing a function as an argument—which is also a common occurrence, as in the <code>sort</code> example above.<br />
<br />
CL also differs from Scheme in its handling of boolean values. Scheme uses the special values #t and #f to represent truth and falsity. CL follows the older Lisp convention of using the symbols T and NIL, with NIL standing also for the empty list. In CL, ''any'' non-NIL value is treated as true by conditionals, such as <code>if</code>, whereas in Scheme all non-#f values are treated as true. These conventions allow some operators in both languages to serve both as predicates (answering a boolean-valued question) and as returning a useful value for further computation, but in Scheme the value '() which is equivalent to NIL in Common Lisp evaluates to true in a boolean expression.<br />
<br />
Lastly, the Scheme standards documents require [[tail recursion|tail-call optimization]], which the CL standard does not. Most CL implementations do offer tail-call optimization, although often only when the programmer uses an optimization directive. Nonetheless, common CL coding style does not favor the ubiquitous use of recursion that Scheme style prefers—what a Scheme programmer would express with tail recursion, a CL user would usually express with an iterative expression in <code>do</code>, <code>dolist</code>, <code>loop</code>, or (more recently) with the <code>iterate</code> package.<br />
<br />
==Implementations==<br />
<br />
See the Category [[:Category:Common Lisp implementations|Common Lisp implementations]].<br />
<br />
Common Lisp is defined by a specification (like [[Ada (programming language)|Ada]] and [[C (programming language)|C]]) rather than by one implementation (like [[Perl]] before version 6). There are many implementations, and the standard details areas in which they may validly differ.<br />
<br />
In addition, implementations tend to come with library packages, which provide functionality not covered in the standard. [[Free and open source software]] libraries have been created to support such features in a portable way, and are most notably found in the repositories of the [http://common-lisp.net/ Common-Lisp.net] and [http://clocc.sourceforge.net/ Common Lisp Open Code Collection] projects.<br />
<br />
Common Lisp implementations may use any mix of native code compilation, byte code compilation or interpretation. Common Lisp has been designed to support [[incremental compiler]]s, file compilers and block compilers. Standard declarations to optimize compilation (such as function inlining or type specialization) are proposed in the language specification. Most Common Lisp implementations compile source code to native [[machine code]]. Some implementations can create (optimized) stand-alone applications. Others compile to interpreted [[bytecode]], which is less efficient than native code, but eases binary-code portability. There are also compilers that compile Common Lisp code to C code. The misconception that Lisp is a purely interpreted language is most likely because Lisp environments provide an interactive prompt and that code is compiled one-by-one, in an incremental way. With Common Lisp incremental compilation is widely used.<br />
<br />
Some [[Unix]]-based implementations ([[CLISP]], [[SBCL]]) can be used as a [[scripting language]]; that is, invoked by the system transparently in the way that a [[Perl]] or [[Unix shell]] interpreter is.<ref>[http://clisp.cons.org/impnotes/quickstart.html#quickstart-unix CLISP as a scripting language under Unix]</ref><br />
<br />
===List of implementations===<br />
<br />
====Commercial implementations====<br />
<br />
; [[Allegro Common Lisp]]: for Microsoft Windows, FreeBSD, Linux, Apple Mac OS X and various UNIX variants. Allegro CL provides an [[integrated development environment|Integrated Development Environment (IDE)]] (for Windows and Linux) and extensive capabilities for application delivery.<br />
; [[Liquid Common Lisp]]: formerly called [[Lucid Common Lisp]]. Only maintenance, no new releases.<br />
; [[LispWorks]]: for Microsoft Windows, FreeBSD, Linux, Apple Mac OS X and various UNIX variants. LispWorks provides an [[integrated development environment|Integrated Development Environment (IDE)]] (available for all platforms) and extensive capabilities for application delivery.<br />
; [[mocl]]: for iOS, Android and Mac OS X.<br />
; [[Open Genera]]: for DEC Alpha.<br />
; [[Scieneer Common Lisp]]: which is designed for high-performance scientific computing.<br />
<br />
====Freely redistributable implementations====<br />
<br />
; Armed Bear Common Lisp (ABCL) : A CL implementation that runs on the [[Java Virtual Machine]].<ref>{{cite web | url = http://common-lisp.net/project/armedbear/ | title = Armed Bear Common Lisp }}</ref> It includes a compiler to [[Java byte code]], and allows access to Java libraries from CL. It was formerly just a component of the [[Armed Bear J Editor]].<br />
; [[CLISP]]: A bytecode-compiling implementation, portable and runs on a number of Unix and Unix-like systems (including [[Mac OS X]]), as well as Microsoft Windows and several other systems.<br />
; [[Clozure CL]] (CCL) : Originally a [[free and open source software|free and open source]] fork of Macintosh Common Lisp. As that history implies, CCL was written for the Macintosh, but Clozure CL now runs on [[Mac OS X]], [[FreeBSD]], [[Linux]], [[Solaris (operating system)|Solaris]] and [[Microsoft Windows|Windows]]. 32 and 64 bit [[x86]] ports are supported on each platform. Additionally there are Power PC ports for Mac OS and Linux. CCL was previously known as OpenMCL, but that name is no longer used, to avoid confusion with the open source version of Macintosh Common Lisp.<br />
; [[CMUCL]]: Originally from [[Carnegie Mellon University]], now maintained as [[free and open source software]] by a group of volunteers. CMUCL uses a fast native-code compiler. It is available on [[Linux]] and [[Berkeley Software Distribution|BSD]] for Intel x86; [[Linux]] for Alpha; [[Mac OS X]] for Intel x86 and PowerPC; and Solaris, IRIX, and HP-UX on their native platforms.<br />
; [[Corman Common Lisp]]: for Microsoft Windows. In January 2015 Corman Lisp has been published under MIT license.<ref>{{cite web|title=Corman Lisp sources are now available|url=http://lispblog.xach.com/post/107215169193/corman-lisp-sources-are-now-available}}</ref><br />
; [[Embeddable Common Lisp]] (ECL) : ECL includes a bytecode interpreter and compiler. It can also compile Lisp code to machine code via a C compiler. ECL then compiles Lisp code to C, compiles the C code with a C compiler and can then load the resulting machine code. It is also possible to embed ECL in [[C (programming language)|C]] programs, and C code into Common Lisp programs.<br />
; [[GNU Common Lisp]] (GCL) : The [[GNU]] Project's Lisp compiler. Not yet fully ANSI-compliant, GCL is however the implementation of choice for several large projects including the mathematical tools [[Maxima (software)|Maxima]], [[Axiom (computer algebra system)|AXIOM]] and (historically) [[ACL2]]. GCL runs on [[Linux]] under eleven different architectures, and also under Windows, Solaris, and [[FreeBSD]].<br />
; [[Macintosh Common Lisp]] (MCL) : Version 5.2 for Apple Macintosh computers with a PowerPC processor running Mac OS X is open source. RMCL (based on MCL 5.2) runs on Intel-based Apple Macintosh computers using the Rosetta binary translator from Apple.<br />
; [[ManKai Common Lisp]] (MKCL) : A branch of [[Embeddable Common Lisp|ECL]]. MKCL emphasises reliability, stability and overall code quality through a heavily reworked, natively multi-threaded, runtime system. On Linux, MKCL features a fully POSIX compliant runtime system.<br />
; [[Movitz]]: Implements a Lisp environment for [[x86]] computers without relying on any underlying OS.<br />
; [[Poplog]]: Poplog implements a version of CL, with [[POP-11]], and optionally [[Prolog]], and [[Standard ML]] (SML), allowing mixed language programming. For all, the implementation language is POP-11, which is compiled incrementally. It also has an integrated [[Emacs]]-like editor that communicates with the compiler.<br />
; [[Steel Bank Common Lisp]] (SBCL) : A branch from [[CMUCL]]. "Broadly speaking, SBCL is distinguished from CMU CL by a greater emphasis on maintainability."<ref>{{cite web<br />
| url = http://sbcl.sourceforge.net/history.html<br />
| title = History and Copyright | work = Steel Bank Common Lisp<br />
}}</ref> SBCL runs on the platforms CMUCL does, except HP/UX; in addition, it runs on Linux for AMD64, PowerPC, SPARC, MIPS, Windows x86<ref>{{cite web<br />
| url = http://www.sbcl.org/platform-table.html<br />
| title = Platform Table | work = Steel Bank Common Lisp<br />
}}</ref> and has experimental support for running on Windows AMD64. SBCL does not use an interpreter by default; all expressions are compiled to native code unless the user switches the interpreter on. The SBCL compiler generates fast native code.<ref>[http://benchmarksgame.alioth.debian.org/u32q/benchmark.php?test=all&lang=all SBCL ranks above other dynamic language implementations in the 'Computer Language Benchmark Game']</ref><br />
; [[Ufasoft Common Lisp]]: port of CLISP for windows platform with core written in C++.<br />
<br />
====Other implementations====<br />
{{unreferenced section|date=July 2013}}<br />
; Austin Kyoto Common Lisp : an evolution of [[Kyoto Common Lisp]]<br />
; Butterfly Common Lisp : an implementation written in Scheme for the [[BBN Butterfly]] multi-processor computer<br />
; CLICC : a Common Lisp to C compiler<br />
; CLOE : Common Lisp for PCs by [[Symbolics]]<br />
; Codemist Common Lisp : used for the commercial version of the computer algebra system Axiom<br />
; ExperCommon Lisp : an early implementation for the Apple Macintosh by ExperTelligence<br />
; [[Golden Common Lisp]]: an implementation for the PC by GoldHill Inc.<br />
; Ibuki Common Lisp : a commercialized version of Kyoto Common Lisp<br />
; [[Kyoto Common Lisp]]: the first Common Lisp compiler that used C as a target language. GCL, ECL and MKCL originate from this Common Lisp implementation.<br />
; L : a small version of Common Lisp for embedded systems developed by IS Robotics, now iRobot<br />
; [[Lisp Machine]]s (from [[Symbolics]], TI and Xerox): provided implementations of Common Lisp in addition to their native Lisp dialect (Lisp Machine Lisp or Interlisp). CLOS was also available. Symbolics provides a version of Common Lisp that is based on ANSI Common Lisp.<br />
; Procyon Common Lisp : an implementation for Windows and Mac OS, used by Franz for their Windows port of Allegro CL<br />
; Star Sapphire Common LISP : an implementation for the PC<br />
; [[SubL]]: a variant of Common Lisp used for the implementation of the [[Cyc]] knowledge-based system<br />
; Top Level Common Lisp : an early implementation for concurrent execution<br />
; WCL : a shared library implementation<br />
; [[Vax Common Lisp]]: [[Digital Equipment Corporation]]'s implementation that ran on [[VAX]] systems running [[OpenVMS|VMS]] or [[ULTRIX]]<br />
; [[XLISP]] by David Betz<br />
<br />
==Applications==<br />
See the Category [[:Category:Common Lisp software|Common Lisp software]].<br />
<br />
Common Lisp is used to develop research applications (often in Artificial Intelligence), for rapid development of prototypes or for deployed applications.<br />
<br />
Common Lisp is used in many commercial applications, including the [[Yahoo!]] Store web-commerce site, which originally involved [[Paul Graham (computer programmer)|Paul Graham]] and was later rewritten in C++ and Perl.<ref name="doubt-not-corporate-foolishness">"In January 2003, Yahoo released a new version of the editor written in C++ and Perl. It's hard to say whether the program is no longer written in Lisp, though, because to translate this program into C++ they literally had to write a Lisp interpreter: the source files of all the page-generating templates are still, as far as I know, Lisp code." [[Paul Graham (computer programmer)|Paul Graham]], [http://www.paulgraham.com/avg.html Beating the Averages]</ref> Other notable examples include:<br />
<br />
* [[ACT-R]], a cognitive architecture used in a large number of research projects.<br />
* Authorizer's Assistant,<ref>[http://www.aaai.org/Papers/IAAI/1989/IAAI89-031.pdf Authorizer's Assistant]</ref><ref>[http://www.prenhall.com/divisions/bp/app/alter/student/useful/ch9amex.html American Express Authorizer's Assistant]</ref> a large rule-based system used by American Express, analyzing credit requests.<br />
* [[Cyc]], a long running project with the aim to create a knowledge-based system that provides a huge amount of common sense knowledge<br />
* The [[Dynamic Analysis and Replanning Tool]] (DART), which is said to alone have paid back during the years from 1991 to 1995 for all thirty years of [[DARPA]] investments in AI research.<br />
* G2 from Gensym, a real-time business rules engine (BRE)<ref>[http://www.gensym.com/index.php?option=com_content&view=article&id=47&Itemid=54 Real-time Application Development]. Gensym. Retrieved on 2013-07-17.</ref><br />
* [http://www.genworks.com Genworks GDL], based on the open-source [http://github.com/genworks/gendl Gendl] kernel.<br />
* The development environment for the [[Jak and Daxter]] video game series, developed by [[Naughty Dog]].<br />
* [[ITA Software]]'s low fare search engine, used by travel websites such as [[Orbitz]] and [[Kayak.com]] and airlines such as [[American Airlines]], [[Continental Airlines]] and [[US Airways]].<br />
* [[Mirai (software)|Mirai]], a 3d graphics suite. It was used to animate the face of Gollum in the movie Lord of the Rings: The Two Towers.<br />
* [[Prototype Verification System]] (PVS), a mechanized environment for formal specification and verification.<br />
* PWGL is a sophisticated visual programming environment based on Common Lisp, used in [[Computer assisted composition]] and sound synthesis.<ref>[http://www2.siba.fi/PWGL/ PWGL - Home]. . Retrieved on 2013-07-17.</ref> <br />
* SPIKE, a scheduling system for earth or space based observatories and satellites, notably the Hubble Space Telescope.<ref>[http://www.stsci.edu/resources/software_hardware/spike/ Spike Planning and Scheduling System]. Stsci.edu. Retrieved on 2013-07-17.</ref><br />
<br />
There also exist open-source applications written in Common Lisp, such as:<br />
<br />
* [[ACL2]], a full-featured [[automated theorem prover]] for an [[applicative programming language|applicative]] variant of Common Lisp.<br />
* [[Axiom (computer algebra system)|Axiom]], a sophisticated [[computer algebra system]].<br />
* [[Maxima (software)|Maxima]], a sophisticated [[computer algebra system]].<br />
* [[OpenMusic]] is an object-oriented visual programming environment based on Common Lisp, used in [[Computer assisted composition]].<br />
* [[Stumpwm]], a tiling, keyboard driven X11 Window Manager written entirely in Common Lisp.<br />
<br />
==Libraries==<br />
<br />
Since 2011 Zach Beane, with support of the Common Lisp Foundation, maintains the [[Quicklisp]] library manager. It allows easy access to several hundred libraries written in Common Lisp.<br />
<br />
==See also==<br />
{{Portal|Computer Science|Computer programming}}<br />
*''[[Common Lisp the Language]]''<br />
*''[[On Lisp]]''<br />
*''[[Practical Common Lisp]]''<br />
{{Clear}}<br />
<br />
==References==<br />
{{Reflist|2}}<br />
<br />
==Bibliography==<br />
A chronological list of books published (or about to be published) about Common Lisp (the language) or about programming with Common Lisp (especially AI programming).<br />
{{Refbegin|2}}<br />
* [[Guy L. Steele]]: ''Common Lisp the Language, 1st Edition'', Digital Press, 1984, ISBN 0-932376-41-X<br />
* [[Rodney Allen Brooks]]: ''Programming in Common Lisp'', John Wiley and Sons Inc, 1985, ISBN 0-471-81888-7<br />
* [[Richard P. Gabriel]]: ''Performance and Evaluation of Lisp Systems'', The MIT Press, 1985, ISBN 0-262-57193-5, [http://www.dreamsongs.com/Files/Timrep.pdf PDF]<br />
* [[Robert Wilensky]]: ''Common LISPcraft'', W.W. Norton & Co., 1986, ISBN 0-393-95544-3<br />
* [[Eugene Charniak]], [[Christopher K. Riesbeck]], [[Drew V. McDermott]], [[James R. Meehan]]: ''Artificial Intelligence Programming, 2nd Edition'', Lawrence Erlbaum, 1987, ISBN 0-89859-609-2<br />
* [[Wendy L. Milner]]: ''Common Lisp: A Tutorial'', Prentice Hall, 1987, ISBN 0-13-152844-0<br />
* [[Deborah G. Tatar]]: ''A Programmer's Guide to Common Lisp'', Longman Higher Education, 1987, ISBN 0-13-728940-5<br />
* [[Taiichi Yuasa]], [[Masami Hagiya]]: ''Introduction to Common Lisp'', Elsevier Ltd, 1987, ISBN 0-12-774860-1<br />
* [[Christian Queinnec]], [[Jerome Chailloux]]: ''Lisp Evolution and Standardization'', Ios Pr Inc., 1988, ISBN 90-5199-008-1<br />
* [[Taiichi Yuasa]], [[Richard Weyhrauch]], [[Yasuko Kitajima]]: ''Common Lisp Drill'', Academic Press Inc, 1988, ISBN 0-12-774861-X<br />
* [[Wade L. Hennessey]]: ''Common Lisp'', McGraw-Hill Inc., 1989, ISBN 0-07-028177-7<br />
* [[Tony Hasemer]], [[John Dominque]]: ''Common Lisp Programming for Artificial Intelligence'', Addison-Wesley Educational Publishers Inc, 1989, ISBN 0-201-17579-7<br />
* [[Sonya E. Keene]]: ''Object-Oriented Programming in Common Lisp: A Programmer's Guide to CLOS'', Addison-Wesley, 1989, ISBN 0-201-17589-4<br />
* [[David Jay Steele]]: ''Golden Common Lisp: A Hands-On Approach'', Addison Wesley, 1989, ISBN 0-201-41653-0<br />
* [[David S. Touretzky]]: ''Common Lisp: A Gentle Introduction to Symbolic Computation'', Benjamin-Cummings, 1989, ISBN 0-8053-0492-4. [http://www.cs.cmu.edu/~dst/LispBook/ Web/PDF] Dover reprint (2013) ISBN 978-0486498201<br />
* [[Christopher K. Riesbeck]], [[Roger C. Schank]]: ''Inside Case-Based Reasoning'', Lawrence Erlbaum, 1989, ISBN 0-89859-767-6<br />
* [[Patrick Winston]], [[Berthold Horn]]: ''Lisp, 3rd Edition'', Addison-Wesley, 1989, ISBN 0-201-08319-1, [http://people.csail.mit.edu/phw/Books/LISPBACK.HTML Web]<br />
* [[Gerard Gazdar]], [[Chris Mellish]]: ''Natural Language Processing in LISP: An Introduction to Computational Linguistics'', Addison-Wesley Longman Publishing Co., 1990, ISBN 0-201-17825-7<br />
* [[Patrick R. Harrison]]: ''Common Lisp and Artificial Intelligence'', Prentice Hall PTR, 1990, ISBN 0-13-155243-0<br />
* [[Timothy Koschmann]]: ''The Common Lisp Companion'', John Wiley & Sons, 1990, ISBN 0-471-50308-8<br />
* [[Molly M. Miller]], [[Eric Benson]]: ''Lisp Style & Design'', Digital Press, 1990, ISBN 1-55558-044-0<br />
* [[Guy L. Steele]]: ''[[Common Lisp the Language]], 2nd Edition'', Digital Press, 1990, ISBN 1-55558-041-6, [http://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html Web]<br />
* [[Steven L. Tanimoto]]: ''The Elements of Artificial Intelligence Using Common Lisp'', Computer Science Press, 1990, ISBN 0-7167-8230-8<br />
* [[Peter Lee (computer scientist)|Peter Lee]]: ''Topics in Advanced Language Implementation'', The MIT Press, 1991, ISBN 0-262-12151-4<br />
* [[John H. Riley]]: ''A Common Lisp Workbook'', Prentice Hall, 1991, ISBN 0-13-155797-1<br />
* [[Peter Norvig]]: ''Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp'', Morgan Kaufmann, 1991, ISBN 1-55860-191-0, [http://norvig.com/paip.html Web]<br />
* [[Gregor Kiczales]], [[Jim des Rivieres]], [[Daniel G. Bobrow]]: ''The Art of the Metaobject Protocol'', The MIT Press, 1991, ISBN 0-262-61074-4<br />
* [[Jo A. Lawless]], [[Molly M. Miller]]: ''Understanding CLOS: The Common Lisp Object System'', Digital Press, 1991, ISBN 0-13-717232-X<br />
* Mark Watson: ''Common Lisp Modules: Artificial Intelligence in the Era of Neural Networks and Chaos Theory'', Springer Verlag New York Inc., 1991, ISBN 0-387-97614-0<br />
* [[James L. Noyes]]: ''Artificial Intelligence with Common Lisp: Fundamentals of Symbolic and Numeric Processing'', Jones & Bartlett Pub, 1992, ISBN 0-669-19473-5<br />
* [[Stuart C. Shapiro]]: ''COMMON LISP: An Interactive Approach'', Computer Science Press, 1992, ISBN 0-7167-8218-9, [http://www.cse.buffalo.edu/pub/WWW/faculty/shapiro/Commonlisp/ Web/PDF]<br />
* [[Kenneth D. Forbus]], [[Johan de Kleer]]: ''Building Problem Solvers'', The MIT Press, 1993, ISBN 0-262-06157-0<br />
* [[Andreas Paepcke]]: ''Object-Oriented Programming: The CLOS Perspective'', The MIT Press, 1993, ISBN 0-262-16136-2<br />
* [[Paul Graham (computer programmer)|Paul Graham]]: ''[[On Lisp]]'', Prentice Hall, 1993, ISBN 0-13-030552-9, [http://www.paulgraham.com/onlisp.html Web/PDF]<br />
* [[Paul Graham (computer programmer)|Paul Graham]]: ''ANSI Common Lisp'', Prentice Hall, 1995, ISBN 0-13-370875-6<br />
* [[Otto Mayer]]: ''Programmieren in Common Lisp'', German, Spektrum Akademischer Verlag, 1995, ISBN 3-86025-710-2<br />
* [[Stephen Slade]]: ''Object-Oriented Common Lisp'', Prentice Hall, 1997, ISBN 0-13-605940-6<br />
* [[Richard P. Gabriel]]: ''Patterns of Software: Tales from the Software Community'', Oxford University Press, 1998, ISBN 0-19-512123-6, [http://www.dreamsongs.org/Files/PatternsOfSoftware.pdf PDF]<br />
* [[Taiichi Yuasa]], [[Hiroshi G. Okuno]]: ''Advanced Lisp Technology'', CRC, 2002, ISBN 0-415-29819-9<br />
* [[David B. Lamkins]]: ''Successful Lisp: How to Understand and Use Common Lisp'', bookfix.com, 2004. ISBN 3-937526-00-5, [http://www.psg.com/~dlamkins/sl/contents.html Web]<br />
* [[Peter Seibel]]: ''[[Practical Common Lisp]]'', Apress, 2005. ISBN 1-59059-239-5, [http://www.gigamonkeys.com/book/ Web]<br />
* [[Doug Hoyte]]: ''Let Over Lambda'', Lulu.com, 2008, ISBN 1-4357-1275-7, [http://letoverlambda.com/ Web]<br />
* [[George F. Luger]], [[William A. Stubblefield]]: ''AI Algorithms, Data Structures, and Idioms in Prolog, Lisp and Java'', Addison Wesley, 2008, ISBN 0-13-607047-7, [http://wps.aw.com/wps/media/objects/5771/5909832/PDF/Luger_0136070477_1.pdf PDF]<br />
* [[Conrad Barski]]: ''Land of Lisp: Learn to program in Lisp, one game at a time!'', No Starch Press, 2010, ISBN 1-59327-200-6, [http://www.lisperati.com/landoflisp/ Web]<br />
* [[Pavel Penev]]: ''Lisp Web Tales'', Leanpub, 2013, [https://leanpub.com/lispwebtales Web]<br />
{{Refend}}<br />
<br />
==External links==<br />
{{Wikibooks}}<br />
* The [http://www.cliki.net/ CLiki], a Wiki for [[free and open source software|free and open source]] Common Lisp systems running on Unix-like systems.<br />
* [http://www.common-lisp.net/ Common Lisp software repository].<br />
* {{cite web | url = http://www.lispworks.com/documentation/HyperSpec/Body/01_ab.htm | title = History | work = [[Common Lisp HyperSpec]] }}<br />
* [http://www.flownet.com/gat/jpl-lisp.html Lisping at JPL]<br />
* [http://www.defmacro.org/ramblings/lisp.html The Nature of Lisp] Essay that examines Lisp by comparison with XML.<br />
* [http://common-lisp.net/~dlw/LispSurvey.html Common Lisp Implementations: A Survey] Survey of maintained Common Lisp implementations.<br />
* [http://clqr.boundp.org Common Lisp Quick Reference]<br />
* [http://planet.lisp.org Planet Lisp] Articles about Common Lisp.<br />
<br />
{{Common Lisp}}<br />
<br />
[[Category:Common Lisp]]<br />
[[Category:Multi-paradigm programming languages]]<br />
[[Category:Functional languages]]<br />
[[Category:Dynamically typed programming languages]]<br />
[[Category:Dynamic programming languages]]<br />
[[Category:Object-oriented programming languages]]<br />
[[Category:Class-based programming languages]]<br />
[[Category:Procedural programming languages]]<br />
[[Category:Extensible syntax programming languages]]<br />
[[Category:Lisp programming language family]]<br />
[[Category:Lisp (programming language)]]<br />
[[Category:Articles with example Lisp code]]<br />
[[Category:Cross-platform software]]<br />
[[Category:Cross-platform free software]]<br />
[[Category:Programming languages created in 1984]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Common_Lisp&diff=689834551Common Lisp2015-11-09T18:12:31Z<p>PuercoPop: /* Sorting a list of person objects */ Use print-object instead of ad-hoc method display.</p>
<hr />
<div>{{Infobox programming language<br />
| name = Common Lisp<br />
| family = [[Lisp (programming language)|Lisp]]<br />
| paradigm = [[Multi-paradigm programming language|Multi-paradigm]]: [[procedural programming|procedural]], [[functional programming|functional]], [[object-oriented programming|object-oriented]], [[metaprogramming|meta]], [[reflective programming|reflective]], [[generic programming|generic]]<br />
| generation = [[3GL]]<br />
| released = 1984, 1994 for ANSI Common Lisp<br />
| designer = [[Scott Fahlman]], [[Richard P. Gabriel]], [[Dave Moon]], [[Guy Steele]], [[Dan Weinreb]]<br />
| developer = ANSI [[X3J13]] committee<br />
| standard reference = [[Common Lisp HyperSpec]]<br />
| latest release version =<br />
| latest release date =<br />
| typing = [[Dynamic typing|dynamic]], [[Strongly-typed programming language|strong]]<br />
| scope = lexical, optionally dynamic<br />
| namespace style = Lisp-2<br />
| implementations = [[Allegro Common Lisp|Allegro CL]], [[Armed Bear Common Lisp|ABCL]], [[CLISP]], [[Clozure CL]], [[CMUCL]], [[Embeddable Common Lisp|ECL]], [[GNU Common Lisp|GCL]], [[LispWorks]], [[Scieneer Common Lisp|Scieneer CL]], [[SBCL]], [[Genera (operating system)|Symbolics Common Lisp]]<br />
| dialects = CLtL1, CLtL2, ANSI Common Lisp<br />
| influenced_by = [[Lisp (programming language)|Lisp]], [[Lisp Machine Lisp]], [[Maclisp]], [[Scheme (programming language)|Scheme]], [[Interlisp]]<br />
| influenced = [[Clojure]], [[Dylan (programming language)|Dylan]], [[Emacs Lisp]], [[EuLisp]], [[ISLISP]], [[Julia (programming language)|Julia]], [[Moose (Perl)|Moose]], [[R (programming language)|R]], [[Cadence SKILL|SKILL]], [[SubL]]<br />
| operating_system = [[Cross-platform]]<br />
| license =<br />
| website = {{URL|http://common-lisp.net/}}<br />
| file_ext = .lisp, .lsp, .l, .cl, .fasl<br />
}}<br />
<br />
'''Common Lisp''' ('''CL''') is a dialect of the [[Lisp (programming language)|Lisp]] [[programming language]], published in [[American National Standards Institute|ANSI]] standard document ''ANSI INCITS 226-1994 (R2004)'' (formerly ''X3.226-1994 (R1999)'').<ref>Quoted from cover of cited standard. ANSI INCITS 226-1994 (R2004), for sale on standard's [http://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+INCITS+226-1994+(R2004) document page].</ref> From the ANSI Common Lisp standard the [[Common Lisp HyperSpec]], a hyperlinked HTML version, has been derived.<ref>[http://www.lispworks.com/documentation/HyperSpec/Front/Help.htm#Authorship Authorship of the Common Lisp HyperSpec]</ref><br />
<br />
The Common Lisp language was developed as a standardized and improved successor of [[Maclisp]]. Thus it is not an implementation, but rather a language [[specification]].<ref>[http://www.lispworks.com/documentation/HyperSpec/Body/01_ab.htm Common Lisp HyperSpec 1.1.2 History]</ref> Several [[#Implementations|implementations]] of the Common Lisp standard are available, including [[free and open source software]] and proprietary products.<ref>[http://common-lisp.net/~dlw/LispSurvey.html Common Lisp Implementations: A Survey]</ref><br />
<br />
The first language documentation was published 1984 as [[Common Lisp the Language]], first edition. A second edition, published in 1990, incorporated many changes to the language, made during the ANSI Common Lisp standardization process. The final ANSI Common Lisp standard then was published in 1994. Since then no update to the standard has been published. Various extensions and improvements to Common Lisp (examples are Unicode, Concurrency, CLOS-based IO) have been provided by implementations.<br />
<br />
Common Lisp is a general-purpose, [[multi-paradigm programming language]]. It supports a combination of [[procedural programming|procedural]], [[functional programming|functional]], and [[object-oriented programming]] paradigms. As a [[dynamic programming language]], it facilitates evolutionary and [[Iterative and incremental development|incremental software development]], with iterative [[Compiler|compilation]] into efficient run-time programs. This incremental development is often done interactively without interrupting the running application.<br />
<br />
It also supports optional type annotation and casting, which can be added as necessary at the later profiling and optimization stages, to permit the compiler to generate more efficient code. For instance, <code>fixnum</code> can hold an [[Boxing (computer science)|unboxed]] integer in a range supported by the hardware and implementation, permitting more efficient arithmetic than on big integers or arbitrary precision types. Similarly, the compiler can be told on a per-module or per-function basis which type safety level is wanted, using ''optimize'' declarations.<br />
<br />
Common Lisp includes [[Common Lisp Object System|CLOS]], an [[object system]] that supports [[multimethods]] and method combinations. It is often implemented with a [[Metaobject]] Protocol.<br />
<br />
Common Lisp is extensible through standard features such as Lisp [[Macro (computer science)|macros]] (code transformations) and reader macros (input parsers for characters).<br />
<br />
Common Lisp provides some backwards compatibility to [[Maclisp]] and to John McCarthy's original [[Lisp (programming language)|Lisp]]. This allows older Lisp software to be ported to Common Lisp.<ref>{{cite web<br />
| url = http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/wang.html<br />
| title = Old LISP programs still run in Common Lisp | accessdate = 2015-05-13<br />
}}</ref><br />
<br />
==Syntax==<br />
<br />
Common Lisp is a dialect of Lisp; it uses [[S-expression]]s to denote both code and data structure. Function calls, macro forms and special forms are written as lists, with the name of the function first, as in these examples:<br />
<br />
<source lang="lisp"><br />
(+ 2 2) ; adds 2 and 2, yielding 4. The function's name is '+'. Lisp has no operators as such.<br />
</source><br />
<source lang="lisp"><br />
(defvar *x*) ; Ensures that a variable *x* exists,<br />
; without giving it a value. The asterisks are part of<br />
; the name, by convention denoting a special (global) variable. <br />
; The symbol *x* is also hereby endowed with the property that<br />
; subsequent bindings of it are dynamic, rather than lexical.<br />
(setf *x* 42.1) ; sets the variable *x* to the floating-point value 42.1<br />
</source><br />
<source lang="lisp"><br />
;; Define a function that squares a number:<br />
(defun square (x)<br />
(* x x))<br />
</source><br />
<source lang="lisp"><br />
;; Execute the function:<br />
(square 3) ; Returns 9<br />
</source><br />
<!-- I truncated this a bit; in smaller browsers, it runs off the side--><br />
<source lang="lisp"><br />
;; the 'let' construct creates a scope for local variables. Here<br />
;; the variable 'a' is bound to 6 and the variable 'b' is bound<br />
;; to 4. Inside the 'let' is a 'body', where the last computed value is returned.<br />
;; Here the result of adding a and b is returned from the 'let' expression.<br />
;; The variables a and b have lexical scope, unless the symbols have been<br />
;; marked as special variables (for instance by a prior DEFVAR).<br />
(let ((a 6)<br />
(b 4))<br />
(+ a b)) ; returns 10<br />
</source><br />
<br />
==Data types==<br />
Common Lisp has many data types.<br />
<br />
===Scalar types===<br />
''Number'' types include [[integer]]s, [[ratio]]s, [[Floating point|floating-point number]]s, and [[complex number]]s.<ref name="reddy">{{cite web<br />
| url = http://random-state.net/features-of-common-lisp.html<br />
| title = Features of Common Lisp<br />
| first = Abhishek | last = Reddy<br />
| date = 2008-08-22<br />
}}</ref> Common Lisp uses [[Arbitrary-precision arithmetic|bignum]]s to represent numerical values of arbitrary size and precision. The ratio type represents fractions exactly, a facility not available in many languages. Common Lisp automatically coerces numeric values among these types as appropriate.<br />
<br />
The Common Lisp ''[[character (computing)|character]]'' type is not limited to [[ASCII]] characters. Most modern implementations allow [[Unicode]] characters.<ref>{{cite web<br />
| url = http://www.cliki.net/Unicode%20Support<br />
| title = Unicode support | work = The Common Lisp Wiki | accessdate = 2008-08-21<br />
}}</ref><br />
<br />
The ''[[Symbol (programming)|symbol]]'' type is common to Lisp languages, but largely unknown outside them. A symbol is a unique, named data object with several parts: name, value, function, property list and package. Of these, ''value cell'' and ''function cell'' are the most important. Symbols in Lisp are often used similarly to identifiers in other languages: to hold the value of a variable; however there are many other uses. Normally, when a symbol is evaluated, its value is returned. Some symbols evaluate to themselves, for example all symbols in the keyword package are self-evaluating. Boolean values in Common Lisp are represented by the self-evaluating symbols T and NIL. Common Lisp has namespaces for symbols, called 'packages'.<br />
<br />
A number of functions are available for [[rounding]] scalar numeric values in various ways. The function <code>round</code> rounds the argument to the nearest integer, with halfway cases rounded to the even integer. The functions <code>truncate</code>, <code>floor</code>, and <code>ceiling</code> round towards zero, down, or up respectively. All these functions return the discarded fractional part as a secondary value. For example, <code>(floor -2.5)</code> yields -3, 0.5; <code>(ceiling -2.5)</code> yields -2, -0.5; <code>(round 2.5)</code> yields 2, 0.5; and <code>(round 3.5)</code> yields 4, -0.5.<br />
<br />
===Data structures===<br />
''Sequence'' types in Common Lisp include lists, vectors, bit-vectors, and strings. There are many operations which can work on any sequence type.<br />
<br />
As in almost all other Lisp dialects, ''lists'' in Common Lisp are composed of ''conses'', sometimes called ''cons cells'' or ''pairs''. A cons is a data structure with two slots, called its ''car'' and ''cdr''. A list is a linked chain of conses or the empty list. Each cons's car refers to a member of the list (possibly another list). Each cons's cdr refers to the next cons—except for the last cons in a list, whose cdr refers to the <code>nil</code> value. Conses can also easily be used to implement trees and other complex data structures; though it is usually advised to use structure or class instances instead. It is also possible to create circular data structures with conses.<br />
<br />
Common Lisp supports multidimensional ''arrays'', and can dynamically resize ''adjustable'' arrays if required. Multidimensional arrays can be used for matrix mathematics. A ''vector'' is a one-dimensional array. Arrays can carry any type as members (even mixed types in the same array) or can be specialized to contain a specific type of members, as in a vector of bits. Usually only a few types are supported. Many implementations can optimize array functions when the array used is type-specialized. Two type-specialized array types are standard: a ''string'' is a vector of characters, while a ''bit-vector'' is a vector of [[bit]]s.<br />
<br />
''[[Hash table]]s'' store associations between data objects. Any object may be used as key or value. Hash tables are automatically resized as needed.<br />
<br />
''Packages'' are collections of symbols, used chiefly to separate the parts of a program into [[namespaces]]. A package may ''export'' some symbols, marking them as part of a public interface. Packages can use other packages.<br />
<br />
''Structures'', similar in use to [[C (programming language)|C]] structs and [[Pascal (programming language)|Pascal]] records, represent arbitrary complex data structures with any number and type of fields (called ''slots''). Structures allow single-inheritance.<br />
<br />
''Classes'' are similar to structures, but offer more dynamic features and multiple-inheritance. (See [[Common Lisp Object System|CLOS]]). Classes have been added late to Common Lisp and there is some conceptual overlap with structures. Objects created of classes are called ''Instances''. A special case are Generic Functions. Generic Functions are both functions and instances.<br />
<br />
===Functions===<br />
Common Lisp supports [[first-class function]]s. For instance, it is possible to write functions that take other functions as arguments or return functions as well. This makes it possible to describe very general operations.<br />
<br />
The Common Lisp library relies heavily on such higher-order functions. For example, the <code>sort</code> function takes a [[relational operator]] as an argument and key function as an optional keyword argument. This can be used not only to sort any type of data, but also to sort data structures according to a key.<br />
<br />
<source lang="lisp"><br />
;; Sorts the list using the > and < function as the relational operator.<br />
(sort (list 5 2 6 3 1 4) #'>) ; Returns (6 5 4 3 2 1)<br />
(sort (list 5 2 6 3 1 4) #'<) ; Returns (1 2 3 4 5 6)<br />
</source><br />
<source lang="lisp"><br />
;; Sorts the list according to the first element of each sub-list.<br />
(sort (list '(9 A) '(3 B) '(4 C)) #'< :key #'first) ; Returns ((3 B) (4 C) (9 A))<br />
</source><br />
<br />
The evaluation model for functions is very simple. When the evaluator encounters a form <code>(f a1 a2...)</code> then it presumes that the symbol named f is one of the following:<br />
<br />
# A special operator (easily checked against a fixed list)<br />
# A macro operator (must have been defined previously)<br />
# The name of a function (default), which may either be a symbol, or a sub-form beginning with the symbol <code>lambda</code>.<br />
<br />
If f is the name of a function, then the arguments a1, a2, ..., an are evaluated in left-to-right order, and the function is found and invoked with those values supplied as parameters.<br />
<br />
====Defining functions====<br />
The [[Defun|macro <code>defun</code>]] defines functions where a function definition gives the name of the function, the names of any arguments, and a function body:<br />
<br />
<source lang="lisp"><br />
(defun square (x)<br />
(* x x))<br />
</source><br />
<br />
Function definitions may include compiler [[Directive (programming)|directives]], known as ''declarations'', which provide hints to the compiler about optimization settings or the data types of arguments. They may also include ''documentation strings'' (docstrings), which the Lisp system may use to provide interactive documentation:<br />
<br />
<source lang="lisp"><br />
(defun square (x)<br />
"Calculates the square of the single-float x."<br />
(declare (single-float x) (optimize (speed 3) (debug 0) (safety 1)))<br />
(the single-float (* x x)))<br />
</source><br />
<br />
Anonymous functions ([[function literal]]s) are defined using <code>lambda</code> expressions, e.g. <code>(lambda&nbsp;(x)&nbsp;(*&nbsp;x&nbsp;x))</code> for a function that squares its argument. Lisp programming style frequently uses higher-order functions for which it is useful to provide anonymous functions as arguments.<br />
<br />
Local functions can be defined with <code>flet</code> and <code>labels</code>.<br />
<br />
<source lang="lisp"><br />
(flet ((square (x)<br />
(* x x)))<br />
(square 3))<br />
</source><br />
<br />
There are a number of other operators related to the definition and manipulation of functions. For instance, a function may be compiled with the <code>compile</code> operator. (Some Lisp systems run functions using an interpreter by default unless instructed to compile; others compile every function).<br />
<br />
====Defining generic functions and methods====<br />
The macro <code>defgeneric</code> defines generic functions.<br />
The macro <code>defmethod</code> defines methods. Generic functions are a collection of methods.<br />
<br />
Methods can specialize their parameters over CLOS ''standard classes'', ''system classes'', ''structure classes'' or objects. For many types there are corresponding ''system classes''.<br />
<br />
When a generic function is called, multiple-dispatch will determine the effective method to use.<br />
<br />
<source lang="lisp"><br />
(defgeneric add (a b))<br />
</source><br />
<br />
<source lang="lisp"><br />
(defmethod add ((a number) (b number))<br />
(+ a b))<br />
</source><br />
<br />
<source lang="lisp"><br />
(defmethod add ((a vector) (b number))<br />
(map 'vector (lambda (n) (+ n b)) a))<br />
</source><br />
<br />
<source lang="lisp"><br />
(defmethod add ((a vector) (b vector))<br />
(map 'vector #'+ a b))<br />
</source><br />
<source lang="lisp"><br />
(defmethod add ((a string)(b string))<br />
(concatenate 'string a b) )<br />
</source><br />
<source lang="lisp"><br />
(add 2 3) ; returns 5<br />
(add #(1 2 3 4) 7) ; returns #(8 9 10 11)<br />
(add #(1 2 3 4) #(4 3 2 1)) ; returns #(5 5 5 5)<br />
(add "COMMON " "LISP") ; returns "COMMON LISP"<br />
</source><br />
<br />
Generic Functions are also a first class data type. There are many more features to Generic Functions and Methods than described above.<br />
<br />
====The function namespace====<br />
<!-- This section name is linked from several places; if you change it, update the links. --><br />
<br />
The namespace for function names is separate from the namespace for data variables. This is a key difference between Common Lisp and [[Scheme (programming language)|Scheme]]. For Common Lisp, operators that define names in the function namespace include <code>defun</code>, <code>flet</code>, <code>labels</code>, <code>defmethod</code> and <code>defgeneric</code>.<br />
<br />
To pass a function by name as an argument to another function, one must use the <code>function</code> special operator, commonly abbreviated as <code>#'</code>. The first <code>sort</code> example above refers to the function named by the symbol <code>&gt;</code> in the function namespace, with the code <code>#'&gt;</code>. Conversely, to call a function passed in such a way, one would use the <code>funcall</code> operator on the argument.<br />
<br />
[[Scheme (programming language)|Scheme's]] evaluation model is simpler: there is only one namespace, and all positions in the form are evaluated (in any order) -- not just the arguments. Code written in one dialect is therefore sometimes confusing to programmers more experienced in the other. For instance, many Common Lisp programmers like to use descriptive variable names such as ''list'' or ''string'' which could cause problems in Scheme, as they would locally shadow function names.<br />
<br />
Whether a separate namespace for functions is an advantage is a source of contention in the Lisp community. It is usually referred to as the ''Lisp-1 vs. Lisp-2 debate''. Lisp-1 refers to Scheme's model and Lisp-2 refers to Common Lisp's model. These names were coined in a 1988 paper by [[Richard P. Gabriel]] and [[Kent Pitman]], which extensively compares the two approaches.<ref>{{cite journal |title=Technical Issues of Separation in Function Cells and Value Cells |url=http://www.nhplace.com/kent/Papers/Technical-Issues.html |authors=Richard P. Gabriel, Kent M. Pitman |journal=Lisp and Symbolic Computation |date = June 1988|volume=1 |issue=1 |pages=81–101 |doi=10.1007/bf01806178}}</ref><br />
<br />
===Other types===<br />
Other data types in Common Lisp include:<br />
<br />
*''Pathnames'' represent files and directories in the [[filesystem]]. The Common Lisp pathname facility is more general than most operating systems' file naming conventions, making Lisp programs' access to files broadly portable across diverse systems.<br />
*Input and output ''streams'' represent sources and sinks of binary or textual data, such as the terminal or open files.<br />
*Common Lisp has a built-in [[pseudo-random number generator]] (PRNG). ''Random state'' objects represent reusable sources of pseudo-random numbers, allowing the user to seed the PRNG or cause it to replay a sequence.<br />
*''Conditions'' are a type used to represent errors, exceptions, and other "interesting" events to which a program may respond.<br />
*''Classes'' are [[first-class object]]s, and are themselves instances of classes called [[metaclasses|metaobject classes]] ([[metaclasses]] for short).<br />
*''Readtables'' are a type of object which control how Common Lisp's reader parses the text of source code. By controlling which readtable is in use when code is read in, the programmer can change or extend the language's syntax.<br />
<br />
==Scope==<br />
<br />
Like programs in many other programming languages, Common Lisp programs make use of names to refer to variables, functions, and many other kinds of entities. Named references are subject to scope.<br />
<br />
The association between a name and the entity which the name refers to is called a binding.<br />
<br />
Scope refers to the set of circumstances in which a name is determined to have a particular binding.<br />
<br />
===Determiners of scope===<br />
<br />
The circumstances which determine scope in Common Lisp include:<br />
<br />
* the location of a reference within an expression. If it's the leftmost position of a compound, it refers to a special operator or a macro or function binding, otherwise to a variable binding or something else.<br />
* the kind of expression in which the reference takes place. For instance, <code>(go x)</code> means transfer control to label <code>x</code>, whereas <code>(print x)</code> refers to the variable <code>x</code>. Both scopes of <code>x</code> can be active in the same region of program text, since tagbody labels are in a separate namespace from variable names. A special form or macro form has complete control over the meanings of all symbols in its syntax. For instance in <code>(defclass x (a b) ())</code>, a class definition, the <code>(a b)</code> is a list of base classes, so these names are looked up in the space of class names, and <code>x</code> isn't a reference to an existing binding, but the name of a new class being derived from <code>a</code> and <code>b</code>. These facts emerge purely from the semantics of <code>defclass</code>. The only generic fact about this expression is that <code>defclass</code> refers to a macro binding; everything else is up to <code>defclass</code>.<br />
* the location of the reference within the program text. For instance, if a reference to variable <code>x</code> is enclosed in a binding construct such as a <code>let</code> which defines a binding for <code>x</code>, then the reference is in the scope created by that binding.<br />
* for a variable reference, whether or not a variable symbol has been, locally or globally, declared special. This determines whether the reference is resolved within a lexical environment, or within a dynamic environment.<br />
* the specific instance of the environment in which the reference is resolved. An environment is a run-time dictionary which maps symbols to bindings. Each kind of reference uses its own kind of environment. References to lexical variables are resolved in a lexical environment, et cetera. More than one environment can be associated with the same reference. For instance, thanks to recursion or the use of multiple threads, multiple activations of the same function can exist at the same time. These activations share the same program text, but each has its own lexical environment instance.<br />
<br />
To understand what a symbol refers to, the Common Lisp programmer must know what kind of reference is being expressed, what kind of scope it uses if it is a variable reference (dynamic versus lexical scope), and also the run-time situation: in what environment is the reference resolved, where was the binding introduced into the environment, et cetera.<br />
<br />
===Kinds of environment===<br />
<br />
====Global====<br />
<br />
Some environments in Lisp are globally pervasive. For instance, if a new type is defined, it is known everywhere thereafter. References to that type look it up in this global environment.<br />
<br />
====Dynamic====<br />
<br />
One type of environment in Common Lisp is the dynamic environment. Bindings established in this environment have dynamic extent, which means that a binding is established at the start of the execution of some construct, such as a <code>let</code> block, and disappears when that construct finishes executing: its lifetime is tied to the dynamic activation and deactivation of a block. However, a dynamic binding is not just visible within that block; it is also visible to all functions invoked from that block. This type of visibility is known as indefinite scope. Bindings which exhibit dynamic extent (lifetime tied to the activation and deactivation of a block) and indefinite scope (visible to all functions which are called from that block) are said to have dynamic scope.<br />
<br />
Common Lisp has support for dynamically scoped variables, which are also called special variables. Certain other kinds of bindings are necessarily dynamically scoped also, such as restarts and catch tags. Function bindings cannot be dynamically scoped using <code>flet</code> (which only provides lexically scoped function bindings), but function objects (a first-level object in Common Lisp) can be assigned to dynamically scoped variables, bound using <code>let</code> in dynamic scope, then called using <code>funcall</code> or <code>APPLY</code>.<br />
<br />
Dynamic scope is extremely useful because it adds referential clarity and discipline to [[global variable]]s. Global variables are frowned upon in computer science as potential sources of error, because they can give rise to ad-hoc, covert channels of communication among modules that lead to unwanted, surprising interactions.<br />
<br />
In Common Lisp, a special variable which has only a top-level binding behaves just like a global variable in other programming languages. A new value can be stored into it, and that value simply replaces what is in the top-level binding. Careless replacement of the value of a global variable is at the heart of bugs caused by use of global variables. However, another way to work with a special variable is to give it a new, local binding within an expression. This is sometimes referred to as "rebinding" the variable. Binding a dynamically scoped variable temporarily creates a new memory location for that variable, and associates the name with that location. While that binding is in effect, all references to that variable refer to the new binding; the previous binding is hidden. When execution of the binding expression terminates, the temporary memory location is gone, and the old binding is revealed, with the original value intact. Of course, multiple dynamic bindings for the same variable can be nested.<br />
<br />
In Common Lisp implementations which support multithreading, dynamic scopes are specific to each thread of execution. Thus special variables serve as an abstraction for thread local storage. If one thread rebinds a special variable, this rebinding has no effect on that variable in other threads. The value stored in a binding can only be retrieved by the thread which created that binding. If each thread binds some special variable <code>*x*</code>, then <code>*x*</code> behaves like thread-local storage. Among threads which do not rebind <code>*x*</code>, it behaves like an ordinary global: all of these threads refer to the same top-level binding of <code>*x*</code>.<br />
<br />
Dynamic variables can be used to extend the execution context with additional context information which is implicitly passed from function to function without having to appear as an extra function parameter. This is especially useful when the control transfer has to pass through layers of unrelated code, which simply cannot be extended with extra parameters to pass the additional data. A situation like this usually calls for a global variable. That global variable must be saved and restored, so that the scheme doesn't break under recursion: dynamic variable rebinding takes care of this. And that variable must be made thread-local (or else a big mutex must be used) so the scheme doesn't break under threads: dynamic scope implementations can take care of this also.<br />
<br />
In the Common Lisp library, there are many standard special variables. For instance, all standard I/O streams are stored in the top-level bindings of well-known special variables. The standard output stream is stored in *standard-output*.<br />
<br />
Suppose a function foo writes to standard output:<br />
<br />
<source lang="lisp"><br />
(defun foo ()<br />
(format t "Hello, world"))<br />
</source><br />
<br />
To capture its output in a character string, *standard-output* can be bound to a string stream and called:<br />
<br />
<source lang="lisp"><br />
(with-output-to-string (*standard-output*)<br />
(foo))<br />
</source><br />
<br />
-> "Hello, world" ; gathered output returned as a string<br />
<br />
====Lexical====<br />
<br />
Common Lisp supports lexical environments. Formally, the bindings in a lexical environment have [[lexical scope]] and may have either indefinite extent or dynamic extent, depending on the type of namespace. [[Lexical scope]] means that visibility is physically restricted to the block in which the binding is established. References which are not textually (i.e. lexically) embedded in that block simply do not see that binding.<br />
<br />
The tags in a TAGBODY have lexical scope. The expression (GO X) is erroneous if it is not actually embedded in a TAGBODY which contains a label X. However, the label bindings disappear when the TAGBODY terminates its execution, because they have dynamic extent. If that block of code is re-entered by the invocation of a lexical closure, it is invalid for the body of that closure to try to transfer control to a tag via GO:<br />
<br />
<source lang="lisp"><br />
(defvar *stashed*) ;; will hold a function<br />
<br />
(tagbody<br />
(setf *stashed* (lambda () (go some-label)))<br />
(go end-label) ;; skip the (print "Hello")<br />
some-label<br />
(print "Hello")<br />
end-label)<br />
-> NIL<br />
</source><br />
<br />
When the TAGBODY is executed, it first evaluates the setf form which stores a function in the special variable *stashed*. Then the (go end-label) transfers control to end-label, skipping the code (print "Hello"). Since end-label is at the end of the tagbody, the tagbody terminates, yielding NIL. Suppose that the previously remembered function is now called:<br />
<br />
<source lang="lisp"><br />
(funcall *stashed*) ;; Error!<br />
</source><br />
<br />
This situation is erroneous. One implementation's response is an error condition containing the message, "GO: tagbody for tag SOME-LABEL has already been left". The function tried to evaluate (go some-label), which is lexically embedded in the tagbody, and resolves to the label. However, the tagbody isn't executing (its extent has ended), and so the control transfer cannot take place.<br />
<br />
Local function bindings in Lisp have [[lexical scope]], and variable bindings also have lexical scope by default. By contrast with GO labels, both of these have indefinite extent. When a lexical function or variable binding is established, that binding continues to exist for as long as references to it are possible, even after the construct which established that binding has terminated. References to lexical variables and functions after the termination of their establishing construct are possible thanks to [[lexical closure]]s.<br />
<br />
Lexical binding is the default binding mode for Common Lisp variables. For an individual symbol, it can be switched to dynamic scope, either by a local declaration, by a global declaration. The latter may occur implicitly through the use of a construct like DEFVAR or DEFPARAMETER. It is an important convention in Common Lisp programming that special (i.e. dynamically scoped) variables have names which begin and end with an asterisk [[Sigil (computer programming)|sigil]] <code>*</code> in what is called the “[[earmuff]] convention”.<ref>[http://letoverlambda.com/index.cl/guest/chap2.html Chapter 2] of [[Let Over Lambda]]</ref> If adhered to, this convention effectively creates a separate namespace for special variables, so that variables intended to be lexical are not accidentally made special.<br />
<br />
[[Lexical scope]] is useful for several reasons.<br />
<br />
Firstly, references to variables and functions can be compiled to efficient machine code, because the run-time environment structure is relatively simple. In many cases it can be optimized to stack storage, so opening and closing lexical scopes has minimal overhead. Even in cases where full closures must be generated, access to the closure's environment is still efficient; typically each variable becomes an offset into a vector of bindings, and so a variable reference becomes a simple load or store instruction with a base-plus-offset [[addressing mode]].<br />
<br />
Secondly, lexical scope (combined with indefinite extent) gives rise to the [[lexical closure]], which in turn creates a whole paradigm of programming centered around the use of functions being first-class objects, which is at the root of functional programming.<br />
<br />
Thirdly, perhaps most importantly, even if lexical closures are not exploited, the use of lexical scope isolates program modules from unwanted interactions. Due to their restricted visibility, lexical variables are private. If one module A binds a lexical variable X, and calls another module B, references to X in B will not accidentally resolve to the X bound in A. B simply has no access to X. For situations in which disciplined interactions through a variable are desirable, Common Lisp provides special variables. Special variables allow for a module A to set up a binding for a variable X which is visible to another module B, called from A. Being able to do this is an advantage, and being able to prevent it from happening is also an advantage; consequently, Common Lisp supports both lexical and [[dynamic scope]].<br />
<br />
==Macros==<br />
A ''[[Macro (computer science)|macro]]'' in Lisp superficially resembles a function in usage. However, rather than representing an expression which is evaluated, it represents a transformation of the program source code. The macro gets the source it surrounds as arguments, binds them to its parameters and computes a new source form. This new form can also use a macro. The macro expansion is repeated until the new source form does not use a macro. The final computed form is the source code executed at runtime.<br />
<br />
Typical uses of macros in Lisp:<br />
<br />
* new control structures (example: looping constructs, branching constructs)<br />
* scoping and binding constructs<br />
* simplified syntax for complex and repeated source code<br />
* top-level defining forms with compile-time side-effects<br />
* data-driven programming<br />
* embedded domain specific languages (examples: SQL, HTML, Prolog)<br />
* implicit finalization forms<br />
<br />
Various standard Common Lisp features also need to be implemented as macros, such as:<br />
<br />
* the standard <code>setf</code> abstraction, to allow custom compile-time expansions of assignment/access operators<br />
* <code>with-accessors</code>, <code>with-slots</code>, <code>with-open-file</code> and other similar <code>WITH</code> macros<br />
* Depending on implementation, <code>if</code> or <code>cond</code> is a macro built on the other, the special operator; <code>when</code> and <code>unless</code> consist of macros<br />
* The powerful <code>loop</code> domain-specific language<br />
<br />
Macros are defined by the ''defmacro'' macro. The special operator ''macrolet'' allows the definition of local (lexically scoped) macros. It is also possible to define macros for symbols using ''define-symbol-macro'' and ''symbol-macrolet''.<br />
<br />
[[Paul Graham (computer programmer)|Paul Graham]]'s book [[On Lisp]] describes the use of macros in Common Lisp in detail. [[Doug Hoyte]]'s book [[Let Over Lambda]] extends the discussion on macros, claiming "Macros are the single greatest advantage that lisp has as a programming language and the single greatest advantage of any programming language." Hoyte provides several examples of iterative development of macros.<br />
<br />
===Example using a macro to define a new control structure===<br />
Macros allow Lisp programmers to create new syntactic forms in the language. One typical use is to create new control structures. The example macro provides an <code>until</code> looping construct. The syntax is:<br />
<br />
<source lang="text"><br />
(until test form*)<br />
</source><br />
<br />
The macro definition for ''until'':<br />
<source lang="lisp"><br />
(defmacro until (test &body body)<br />
(let ((start-tag (gensym "START"))<br />
(end-tag (gensym "END")))<br />
`(tagbody ,start-tag<br />
(when ,test (go ,end-tag))<br />
(progn ,@body)<br />
(go ,start-tag)<br />
,end-tag)))<br />
</source><br />
<br />
''tagbody'' is a primitive Common Lisp special operator which provides the ability to name tags and use the ''go'' form to jump to those tags. The backquote ''`'' provides a notation that provides code templates, where the value of forms preceded with a comma are filled in. Forms preceded with comma and at-sign are ''spliced'' in. The tagbody form tests the end condition. If the condition is true, it jumps to the end tag. Otherwise the provided body code is executed and then it jumps to the start tag.<br />
<br />
An example form using above ''until'' macro:<br />
<source lang="lisp"><br />
(until (= (random 10) 0)<br />
(write-line "Hello"))<br />
</source><br />
<br />
The code can be expanded using the function ''macroexpand-1''. The expansion for above example looks like this:<br />
<source lang="lisp"><br />
(TAGBODY<br />
#:START1136<br />
(WHEN (ZEROP (RANDOM 10))<br />
(GO #:END1137))<br />
(PROGN (WRITE-LINE "hello"))<br />
(GO #:START1136)<br />
#:END1137)<br />
</source><br />
<br />
During macro expansion the value of the variable ''test'' is ''(= (random 10) 0)'' and the value of the variable ''body'' is ''((write-line "Hello"))''. The body is a list of forms.<br />
<br />
Symbols are usually automatically upcased. The expansion uses the TAGBODY with two labels. The symbols for these labels are computed by GENSYM and are not interned in any package. Two ''go'' forms use these tags to jump to. Since ''tagbody'' is a primitive operator in Common Lisp (and not a macro), it will not be expanded into something else. The expanded form uses the ''when'' macro, which also will be expanded. Fully expanding a source form is called ''code walking''.<br />
<br />
In the fully expanded (''walked'') form, the ''when'' form is replaced by the primitive ''if'':<br />
<source lang="lisp"><br />
(TAGBODY<br />
#:START1136<br />
(IF (ZEROP (RANDOM 10))<br />
(PROGN (GO #:END1137))<br />
NIL)<br />
(PROGN (WRITE-LINE "hello"))<br />
(GO #:START1136))<br />
#:END1137)<br />
</source><br />
<br />
All macros must be expanded before the source code containing them can be evaluated or compiled normally. Macros can be considered functions that accept and return [[abstract syntax tree]]s (Lisp S-expressions). These functions<br />
are invoked before the evaluator or compiler to produce the final source code.<br />
Macros are written in normal Common Lisp, and may use any Common Lisp (or third-party) operator available.<br />
<br />
===Variable capture and shadowing===<br />
Common Lisp macros are capable of what is commonly called ''variable capture'', where symbols in the macro-expansion body coincide with those in the calling context, allowing the programmer to create macros wherein various symbols have special meaning. The term ''variable capture'' is somewhat misleading, because all namespaces are vulnerable to unwanted capture, including the operator and function namespace, the tagbody label namespace, catch tag, condition handler and restart namespaces.<br />
<br />
''Variable capture'' can introduce software defects. This happens in one of the following two ways:<br />
<br />
* In the first way, a macro expansion can inadvertently make a symbolic reference which the macro writer assumed will resolve in a global namespace, but the code where the macro is expanded happens to provide a local, shadowing definition which steals that reference. Let this be referred to as type 1 capture.<br />
<br />
* The second way, type 2 capture, is just the opposite: some of the arguments of the macro are pieces of code supplied by the macro caller, and those pieces of code are written such that they make references to surrounding bindings. However, the macro inserts these pieces of code into an expansion which defines its own bindings that accidentally captures some of these references.<br />
<br />
The Scheme dialect of Lisp provides a macro-writing system which provides the referential transparency that eliminates both types of capture problem. This type of macro system is sometimes called "hygienic", in particular by its proponents (who regard macro systems which do not automatically solve this problem as unhygienic). {{Citation needed|date=May 2011}}<br />
<br />
In Common Lisp, macro hygiene is ensured one of two different ways.<br />
<br />
One approach is to use [[gensym]]s: guaranteed-unique symbols which can be used in a macro-expansion without threat of capture. The use of gensyms in a macro definition is a manual chore, but macros can be written which simplify the instantiation and use of gensyms. Gensyms solve type 2 capture easily, but they are not applicable to type 1 capture in the same way, because the macro expansion cannot rename the interfering symbols in the surrounding code which capture its references. Gensyms could be used to provide stable aliases for the global symbols which the macro expansion needs. The macro expansion would use these secret aliases rather than the well-known names, so redefinition of the well-known names would have no ill effect on the macro.<br />
<br />
Another approach is to use packages. A macro defined in its own package can simply use internal symbols in that package in its expansion. The use of packages deals with type 1 and type 2 capture.<br />
<br />
However, packages don't solve the type 1 capture of references to standard Common Lisp functions and operators. The reason is that the use of packages to solve capture problems revolves around the use of private symbols (symbols in one package, which are not imported into, or otherwise made visible in other packages). Whereas the Common Lisp library symbols are external, and frequently imported into or made visible in user-defined packages.<br />
<br />
The following is an example of unwanted capture in the operator namespace, occurring in the expansion of a macro:<br />
<br />
<source lang="lisp"><br />
;; expansion of UNTIL makes liberal use of DO<br />
(defmacro until (expression &body body)<br />
`(do () (,expression) ,@body))<br />
<br />
;; macrolet establishes lexical operator binding for DO<br />
(macrolet ((do (...) ... something else ...))<br />
(until (= (random 10) 0) (write-line "Hello")))<br />
</source><br />
<br />
The <code>until</code> macro will expand into a form which calls <code>do</code> which is intended to refer to the standard Common Lisp macro <code>do</code>. However, in this context, <code>do</code> may have a completely different meaning, so <code>until</code> may not work properly.<br />
<br />
Common Lisp solves the problem of the shadowing of standard operators and functions by forbidding their redefinition. Because it redefines the standard operator <code>do</code>, the preceding is actually a fragment of non-conforming Common Lisp, which allows implementations to diagnose and reject it.<br />
<br />
==Condition system==<br />
The ''condition system'' is responsible for [[exception handling]] in Common Lisp.<ref name="Seibel2005">{{cite book|author=Peter Seibel|title=Practical Common Lisp|url=http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html|date=7 April 2005|publisher=Apress|isbn=978-1-59059-239-7}}</ref> It provides ''conditions'', ''handler''s and ''restart''s. ''Condition''s are objects describing an exceptional situation (for example an error). If a ''condition'' is signaled, the Common Lisp system searches for a ''handler'' for this condition type and calls the handler. The ''handler'' can now search for restarts and use one of these restarts to repair the current problem. As part of a user interface (for example of a debugger), these restarts can also be presented to the user, so that the user can select and invoke one of the available restarts. Since the condition handler is called in the context of the error (without unwinding the stack), full error recovery is possible in many cases, where other exception handling systems would have already terminated the current routine. The debugger itself can also be customized or replaced using the <code>*debugger-hook*</code> dynamic variable.<br />
<br />
In the following example (using [[Symbolics Genera]]) the user tries to open a file in a Lisp function ''test'' called from the Read-Eval-Print-LOOP ([[REPL]]), when the file does not exist. The Lisp system presents four restarts. The user selects the ''Retry OPEN using a different pathname'' restart and enters a different pathname (lispm-init.lisp instead of lispm-int.lisp). The user code does not contain any error handling code. The whole error handling and restart code is provided by the Lisp system, which can handle and repair the error without terminating the user code.<br />
<br />
<source lang="text"><br />
Command: (test ">zippy>lispm-int.lisp")<br />
<br />
Error: The file was not found.<br />
For lispm:>zippy>lispm-int.lisp.newest<br />
<br />
LMFS:OPEN-LOCAL-LMFS-1<br />
Arg 0: #P"lispm:>zippy>lispm-int.lisp.newest"<br />
<br />
s-A, <Resume>: Retry OPEN of lispm:>zippy>lispm-int.lisp.newest<br />
s-B: Retry OPEN using a different pathname<br />
s-C, <Abort>: Return to Lisp Top Level in a TELNET server<br />
s-D: Restart process TELNET terminal<br />
<br />
-> Retry OPEN using a different pathname<br />
Use what pathname instead [default lispm:>zippy>lispm-int.lisp.newest]:<br />
lispm:>zippy>lispm-init.lisp.newest<br />
<br />
...the program continues<br />
</source><br />
<br />
==Common Lisp Object System (CLOS)==<br />
<br />
{{Main|Common Lisp Object System}}<br />
<br />
Common Lisp includes a toolkit for [[object-oriented programming]], the Common Lisp Object System or [[Common Lisp Object System|CLOS]], which is one of the most powerful object systems available in any language. For example, [[Peter Norvig]] explains how many [[Design pattern (computer science)|Design Patterns]] are simpler to implement in a dynamic language with the features of CLOS (Multiple Inheritance, Mixins, Multimethods, Metaclasses, Method combinations, etc.).<ref>[http://norvig.com/design-patterns/ppframe.htm Peter Norvig, Design Patterns in Dynamic Programming]</ref><br />
Several extensions to Common Lisp for object-oriented programming have been proposed to be included into the ANSI Common Lisp standard, but eventually CLOS was adopted as the standard object-system for Common Lisp. CLOS is a [[dynamic programming language|dynamic]] object system with [[multiple dispatch]] and [[multiple inheritance]], and differs radically from the OOP facilities found in static languages such as [[C++]] or [[Java (programming language)|Java]]. As a dynamic object system, CLOS allows changes at runtime to generic functions and classes. Methods can be added and removed, classes can be added and redefined, objects can be updated for class changes and the class of objects can be changed.<br />
<br />
CLOS has been integrated into ANSI Common Lisp. Generic Functions can be used like normal functions and are a first-class data type. Every CLOS class is integrated into the Common Lisp type system. Many Common Lisp types have a corresponding class. There is more potential use of CLOS for Common Lisp. The specification does not say whether conditions are implemented with CLOS. Pathnames and streams could be implemented with CLOS. These further usage possibilities of CLOS for ANSI Common Lisp are not part of the standard. Actual Common Lisp implementations are using CLOS for pathnames, streams, input/output, conditions, the implementation of CLOS itself and more.<br />
<br />
==Compiler and interpreter==<br />
Several implementations of earlier Lisp dialects provided both an interpreter and a compiler. Unfortunately often the semantics were different. These earlier Lisps implemented lexical scoping in the compiler and dynamic scoping in the interpreter. Common Lisp requires that both the interpreter and compiler use lexical scoping by default. The Common Lisp standard describes both the semantics of the interpreter and a compiler. The compiler can be called using the function ''compile'' for individual functions and using the function ''compile-file'' for files. Common Lisp allows type declarations and provides ways to influence the compiler code generation policy. For the latter various optimization qualities can be given values between 0 (not important) and 3 (most important): ''speed'', ''space'', ''safety'', ''debug'' and ''compilation-speed''.<br />
<br />
There is also a function to evaluate Lisp code: ''eval''. ''eval'' takes code as pre-parsed s-expressions and not, like in some other languages, as text strings. This way code can be constructed with the usual Lisp functions for constructing lists and symbols and then this code can be evaluated with ''eval''. Several Common Lisp implementations (like Clozure CL and SBCL) are implementing ''eval'' using their compiler. This way code is compiled, even though it is evaluated using the function ''eval''.<br />
<br />
The file compiler is invoked using the function ''compile-file''. The generated file with compiled code is called a ''fasl'' (from ''fast load'') file. These ''fasl'' files and also source code files can be loaded with the function ''load'' into a running Common Lisp system. Depending on the implementation, the file compiler generates byte-code (for example for the [[Java Virtual Machine]]), [[C (programming language)|C language]] code (which then is compiled with a C compiler) or, directly, native code.<br />
<br />
Common Lisp implementations can be used interactively, even though the code gets fully compiled. The idea of an [[Interpreted language]] thus does not apply for interactive Common Lisp.<br />
<br />
The language makes distinction between read-time, compile-time, load-time and run-time, and allows user code to also make this distinction to perform the wanted type of processing at the wanted step.<br />
<br />
Some special operators are provided to especially suit interactive development; for instance, <code>defvar</code> will only assign a value to its provided variable if it wasn't already bound, while <code>defparameter</code> will always perform the assignment. This distinction is useful when interactively evaluating, compiling and loading code in a live image.<br />
<br />
Some features are also provided to help writing compilers and interpreters. Symbols consist of first-level objects and are directly manipulable by user code. The <code>progv</code> special operator allows to create lexical bindings programmatically, while packages are also manipulable. The Lisp compiler itself is available at runtime to compile files or individual functions. These make it easy to use Lisp as an intermediate compiler or interpreter for another language.<br />
<br />
==Code examples==<br />
<br />
===Birthday paradox===<br />
The following program calculates the smallest number of people in a room for whom the probability of completely unique birthdays is less than 50% (the [[birthday paradox]], where for 1 person the probability is obviously 100%, for 2 it is 364/365, etc.). The Answer is 23.<br />
<br />
<source lang="lisp"><br />
;; By convention, constants in Common Lisp are enclosed with + characters.<br />
(defconstant +year-size+ 365)<br />
<br />
(defun birthday-paradox (probability number-of-people)<br />
(let ((new-probability (* (/ (- +year-size+ number-of-people)<br />
+year-size+)<br />
probability)))<br />
(if (< new-probability 0.5)<br />
(1+ number-of-people)<br />
(birthday-paradox new-probability (1+ number-of-people)))))<br />
</source><br />
<br />
Calling the example function using the [[REPL]] (Read Eval Print Loop):<br />
<source lang="text"><br />
CL-USER > (birthday-paradox 1.0 1)<br />
23<br />
</source><br />
<br />
===Sorting a list of person objects===<br />
<br />
We define a class <code>person</person> and a method for displaying the name and age of a person.<br />
Next we define a group of persons as a list of PERSON objects.<br />
Then we iterate over the sorted list.<br />
<br />
<source lang="lisp"><br />
(defclass person ()<br />
((name :initarg :name :reader person-name)<br />
(age :initarg :age :reader person-age))<br />
(:documentation "The class PERSON with slots NAME and AGE."))<br />
<br />
(defmethod print-object ((object person) stream)<br />
"Displaying a PERSON object to an output stream."<br />
(print-unreadable-object (object stream :type t)<br />
(format stream "~a (~a)" (person-name object) (person-age object))))<br />
<br />
(defparameter *group*<br />
(list (make-instance 'person :name "Bob" :age 33)<br />
(make-instance 'person :name "Chris" :age 16)<br />
(make-instance 'person :name "Ash" :age 23))<br />
"A list of PERSON objects.")<br />
<br />
(dolist (person (sort (copy-list *group*)<br />
#'><br />
:key #'person-age))<br />
(print person))<br />
</source><br />
<br />
It prints the three names with descending age.<br />
<source lang="text"><br />
#<PERSON Bob (33)> <br />
#<PERSON Ash (23)> <br />
#<PERSON Chris (16)> <br />
</source><br />
<br />
===Exponentiating by squaring===<br />
<br />
Use of the LOOP macro is demonstrated:<br />
<br />
<source lang="lisp"><br />
(defun power (x n)<br />
(loop with result = 1<br />
while (plusp n)<br />
when (oddp n) do (setf result (* result x))<br />
do (setf x (* x x)<br />
n (truncate n 2))<br />
finally (return result)))<br />
</source><br />
<br />
Example use:<br />
<br />
<source lang="text"><br />
CL-USER > (power 2 200)<br />
1606938044258990275541962092341162602522202993782792835301376<br />
</source><br />
<br />
Compare with the built in exponentiation:<br />
<br />
<source lang="text"><br />
CL-USER > (= (expt 2 200) (power 2 200))<br />
T<br />
</source><br />
<br />
===Find the list of available shells===<br />
<br />
WITH-OPEN-FILE is a macro that opens a file and provides a stream. When the form is returning, the file is automatically closed. FUNCALL calls a function object. The LOOP collects all lines that match the predicate.<br />
<br />
<source lang="lisp"><br />
(defun list-matching-lines (file predicate)<br />
"Returns a list of lines in file, for which the predicate applied to<br />
the line returns T."<br />
(with-open-file (stream file)<br />
(loop for line = (read-line stream nil nil)<br />
while line<br />
when (funcall predicate line)<br />
collect it)))<br />
</source><br />
<br />
The function AVAILABLE-SHELLS calls above function LIST-MATCHING-LINES with a pathname and an anonymous function as the predicate. The predicate returns the pathname of a shell or NIL (if the string is not the filename of a shell).<br />
<br />
<source lang="lisp"><br />
(defun available-shells (&optional (file #p"/etc/shells"))<br />
(list-matching-lines<br />
file<br />
(lambda (line)<br />
(and (plusp (length line))<br />
(char= (char line 0) #\/)<br />
(pathname<br />
(string-right-trim '(#\space #\tab) line))))))<br />
</source><br />
<br />
Example results (on Mac OS X 10.6):<br />
<br />
<source lang="lisp"><br />
CL-USER > (available-shells)<br />
(#P"/bin/bash" #P"/bin/csh" #P"/bin/ksh" #P"/bin/sh" #P"/bin/tcsh" #P"/bin/zsh")<br />
</source><br />
<br />
==Comparison with other Lisps==<br />
<!-- needs lots --><br />
Common Lisp is most frequently compared with, and contrasted to, [[Scheme (programming language)|Scheme]]—if only because they are the two most popular Lisp dialects. Scheme predates CL, and comes not only from the same Lisp tradition but from some of the same engineers—[[Guy L. Steele, Jr.|Guy L. Steele]], with whom [[Gerald Jay Sussman]] designed Scheme, chaired the standards committee for Common Lisp.<br />
<br />
Common Lisp is a general-purpose programming language, in contrast to Lisp variants such as [[Emacs Lisp]] and [[AutoLISP]] which are [[extension languages]] embedded in particular products. Unlike many earlier Lisps, Common Lisp (like [[Scheme (programming language)|Scheme]]) uses lexical variable [[scope (programming)|scope]] by default for both interpreted and compiled code.<br />
<br />
Most of the Lisp systems whose designs contributed to Common Lisp—such as [[ZetaLisp]] and Franz Lisp—used dynamically [[scope (programming)|scoped]] variables in their interpreters and lexically scoped variables in their compilers. Scheme introduced the sole use of lexically scoped variables to Lisp; an inspiration from [[ALGOL 68]] which was widely recognized as a good idea. CL supports dynamically scoped variables as well, but they must be explicitly declared as "special". There are no differences in scoping between ANSI CL interpreters and compilers.<br />
<br />
Common Lisp is sometimes termed a ''Lisp-2'' and Scheme a ''Lisp-1'', referring to CL's use of separate namespaces for functions and variables. (In fact, CL has ''many'' namespaces, such as those for go tags, block names, and <code>loop</code> keywords). There is a long-standing controversy between CL and Scheme advocates over the tradeoffs involved in multiple namespaces. In Scheme, it is (broadly) necessary to avoid giving variables names which clash with functions; Scheme functions frequently have arguments named <code>lis</code>, <code>lst</code>, or <code>lyst</code> so as not to conflict with the system function <code>list</code>. However, in CL it is necessary to explicitly refer to the function namespace when passing a function as an argument—which is also a common occurrence, as in the <code>sort</code> example above.<br />
<br />
CL also differs from Scheme in its handling of boolean values. Scheme uses the special values #t and #f to represent truth and falsity. CL follows the older Lisp convention of using the symbols T and NIL, with NIL standing also for the empty list. In CL, ''any'' non-NIL value is treated as true by conditionals, such as <code>if</code>, whereas in Scheme all non-#f values are treated as true. These conventions allow some operators in both languages to serve both as predicates (answering a boolean-valued question) and as returning a useful value for further computation, but in Scheme the value '() which is equivalent to NIL in Common Lisp evaluates to true in a boolean expression.<br />
<br />
Lastly, the Scheme standards documents require [[tail recursion|tail-call optimization]], which the CL standard does not. Most CL implementations do offer tail-call optimization, although often only when the programmer uses an optimization directive. Nonetheless, common CL coding style does not favor the ubiquitous use of recursion that Scheme style prefers—what a Scheme programmer would express with tail recursion, a CL user would usually express with an iterative expression in <code>do</code>, <code>dolist</code>, <code>loop</code>, or (more recently) with the <code>iterate</code> package.<br />
<br />
==Implementations==<br />
<br />
See the Category [[:Category:Common Lisp implementations|Common Lisp implementations]].<br />
<br />
Common Lisp is defined by a specification (like [[Ada (programming language)|Ada]] and [[C (programming language)|C]]) rather than by one implementation (like [[Perl]] before version 6). There are many implementations, and the standard details areas in which they may validly differ.<br />
<br />
In addition, implementations tend to come with library packages, which provide functionality not covered in the standard. [[Free and open source software]] libraries have been created to support such features in a portable way, and are most notably found in the repositories of the [http://common-lisp.net/ Common-Lisp.net] and [http://clocc.sourceforge.net/ Common Lisp Open Code Collection] projects.<br />
<br />
Common Lisp implementations may use any mix of native code compilation, byte code compilation or interpretation. Common Lisp has been designed to support [[incremental compiler]]s, file compilers and block compilers. Standard declarations to optimize compilation (such as function inlining or type specialization) are proposed in the language specification. Most Common Lisp implementations compile source code to native [[machine code]]. Some implementations can create (optimized) stand-alone applications. Others compile to interpreted [[bytecode]], which is less efficient than native code, but eases binary-code portability. There are also compilers that compile Common Lisp code to C code. The misconception that Lisp is a purely interpreted language is most likely because Lisp environments provide an interactive prompt and that code is compiled one-by-one, in an incremental way. With Common Lisp incremental compilation is widely used.<br />
<br />
Some [[Unix]]-based implementations ([[CLISP]], [[SBCL]]) can be used as a [[scripting language]]; that is, invoked by the system transparently in the way that a [[Perl]] or [[Unix shell]] interpreter is.<ref>[http://clisp.cons.org/impnotes/quickstart.html#quickstart-unix CLISP as a scripting language under Unix]</ref><br />
<br />
===List of implementations===<br />
<br />
====Commercial implementations====<br />
<br />
; [[Allegro Common Lisp]]: for Microsoft Windows, FreeBSD, Linux, Apple Mac OS X and various UNIX variants. Allegro CL provides an [[integrated development environment|Integrated Development Environment (IDE)]] (for Windows and Linux) and extensive capabilities for application delivery.<br />
; [[Liquid Common Lisp]]: formerly called [[Lucid Common Lisp]]. Only maintenance, no new releases.<br />
; [[LispWorks]]: for Microsoft Windows, FreeBSD, Linux, Apple Mac OS X and various UNIX variants. LispWorks provides an [[integrated development environment|Integrated Development Environment (IDE)]] (available for all platforms) and extensive capabilities for application delivery.<br />
; [[mocl]]: for iOS, Android and Mac OS X.<br />
; [[Open Genera]]: for DEC Alpha.<br />
; [[Scieneer Common Lisp]]: which is designed for high-performance scientific computing.<br />
<br />
====Freely redistributable implementations====<br />
<br />
; Armed Bear Common Lisp (ABCL) : A CL implementation that runs on the [[Java Virtual Machine]].<ref>{{cite web | url = http://common-lisp.net/project/armedbear/ | title = Armed Bear Common Lisp }}</ref> It includes a compiler to [[Java byte code]], and allows access to Java libraries from CL. It was formerly just a component of the [[Armed Bear J Editor]].<br />
; [[CLISP]]: A bytecode-compiling implementation, portable and runs on a number of Unix and Unix-like systems (including [[Mac OS X]]), as well as Microsoft Windows and several other systems.<br />
; [[Clozure CL]] (CCL) : Originally a [[free and open source software|free and open source]] fork of Macintosh Common Lisp. As that history implies, CCL was written for the Macintosh, but Clozure CL now runs on [[Mac OS X]], [[FreeBSD]], [[Linux]], [[Solaris (operating system)|Solaris]] and [[Microsoft Windows|Windows]]. 32 and 64 bit [[x86]] ports are supported on each platform. Additionally there are Power PC ports for Mac OS and Linux. CCL was previously known as OpenMCL, but that name is no longer used, to avoid confusion with the open source version of Macintosh Common Lisp.<br />
; [[CMUCL]]: Originally from [[Carnegie Mellon University]], now maintained as [[free and open source software]] by a group of volunteers. CMUCL uses a fast native-code compiler. It is available on [[Linux]] and [[Berkeley Software Distribution|BSD]] for Intel x86; [[Linux]] for Alpha; [[Mac OS X]] for Intel x86 and PowerPC; and Solaris, IRIX, and HP-UX on their native platforms.<br />
; [[Corman Common Lisp]]: for Microsoft Windows. In January 2015 Corman Lisp has been published under MIT license.<ref>{{cite web|title=Corman Lisp sources are now available|url=http://lispblog.xach.com/post/107215169193/corman-lisp-sources-are-now-available}}</ref><br />
; [[Embeddable Common Lisp]] (ECL) : ECL includes a bytecode interpreter and compiler. It can also compile Lisp code to machine code via a C compiler. ECL then compiles Lisp code to C, compiles the C code with a C compiler and can then load the resulting machine code. It is also possible to embed ECL in [[C (programming language)|C]] programs, and C code into Common Lisp programs.<br />
; [[GNU Common Lisp]] (GCL) : The [[GNU]] Project's Lisp compiler. Not yet fully ANSI-compliant, GCL is however the implementation of choice for several large projects including the mathematical tools [[Maxima (software)|Maxima]], [[Axiom (computer algebra system)|AXIOM]] and (historically) [[ACL2]]. GCL runs on [[Linux]] under eleven different architectures, and also under Windows, Solaris, and [[FreeBSD]].<br />
; [[Macintosh Common Lisp]] (MCL) : Version 5.2 for Apple Macintosh computers with a PowerPC processor running Mac OS X is open source. RMCL (based on MCL 5.2) runs on Intel-based Apple Macintosh computers using the Rosetta binary translator from Apple.<br />
; [[ManKai Common Lisp]] (MKCL) : A branch of [[Embeddable Common Lisp|ECL]]. MKCL emphasises reliability, stability and overall code quality through a heavily reworked, natively multi-threaded, runtime system. On Linux, MKCL features a fully POSIX compliant runtime system.<br />
; [[Movitz]]: Implements a Lisp environment for [[x86]] computers without relying on any underlying OS.<br />
; [[Poplog]]: Poplog implements a version of CL, with [[POP-11]], and optionally [[Prolog]], and [[Standard ML]] (SML), allowing mixed language programming. For all, the implementation language is POP-11, which is compiled incrementally. It also has an integrated [[Emacs]]-like editor that communicates with the compiler.<br />
; [[Steel Bank Common Lisp]] (SBCL) : A branch from [[CMUCL]]. "Broadly speaking, SBCL is distinguished from CMU CL by a greater emphasis on maintainability."<ref>{{cite web<br />
| url = http://sbcl.sourceforge.net/history.html<br />
| title = History and Copyright | work = Steel Bank Common Lisp<br />
}}</ref> SBCL runs on the platforms CMUCL does, except HP/UX; in addition, it runs on Linux for AMD64, PowerPC, SPARC, MIPS, Windows x86<ref>{{cite web<br />
| url = http://www.sbcl.org/platform-table.html<br />
| title = Platform Table | work = Steel Bank Common Lisp<br />
}}</ref> and has experimental support for running on Windows AMD64. SBCL does not use an interpreter by default; all expressions are compiled to native code unless the user switches the interpreter on. The SBCL compiler generates fast native code.<ref>[http://benchmarksgame.alioth.debian.org/u32q/benchmark.php?test=all&lang=all SBCL ranks above other dynamic language implementations in the 'Computer Language Benchmark Game']</ref><br />
; [[Ufasoft Common Lisp]]: port of CLISP for windows platform with core written in C++.<br />
<br />
====Other implementations====<br />
{{unreferenced section|date=July 2013}}<br />
; Austin Kyoto Common Lisp : an evolution of [[Kyoto Common Lisp]]<br />
; Butterfly Common Lisp : an implementation written in Scheme for the [[BBN Butterfly]] multi-processor computer<br />
; CLICC : a Common Lisp to C compiler<br />
; CLOE : Common Lisp for PCs by [[Symbolics]]<br />
; Codemist Common Lisp : used for the commercial version of the computer algebra system Axiom<br />
; ExperCommon Lisp : an early implementation for the Apple Macintosh by ExperTelligence<br />
; [[Golden Common Lisp]]: an implementation for the PC by GoldHill Inc.<br />
; Ibuki Common Lisp : a commercialized version of Kyoto Common Lisp<br />
; [[Kyoto Common Lisp]]: the first Common Lisp compiler that used C as a target language. GCL, ECL and MKCL originate from this Common Lisp implementation.<br />
; L : a small version of Common Lisp for embedded systems developed by IS Robotics, now iRobot<br />
; [[Lisp Machine]]s (from [[Symbolics]], TI and Xerox): provided implementations of Common Lisp in addition to their native Lisp dialect (Lisp Machine Lisp or Interlisp). CLOS was also available. Symbolics provides a version of Common Lisp that is based on ANSI Common Lisp.<br />
; Procyon Common Lisp : an implementation for Windows and Mac OS, used by Franz for their Windows port of Allegro CL<br />
; Star Sapphire Common LISP : an implementation for the PC<br />
; [[SubL]]: a variant of Common Lisp used for the implementation of the [[Cyc]] knowledge-based system<br />
; Top Level Common Lisp : an early implementation for concurrent execution<br />
; WCL : a shared library implementation<br />
; [[Vax Common Lisp]]: [[Digital Equipment Corporation]]'s implementation that ran on [[VAX]] systems running [[OpenVMS|VMS]] or [[ULTRIX]]<br />
; [[XLISP]] by David Betz<br />
<br />
==Applications==<br />
See the Category [[:Category:Common Lisp software|Common Lisp software]].<br />
<br />
Common Lisp is used to develop research applications (often in Artificial Intelligence), for rapid development of prototypes or for deployed applications.<br />
<br />
Common Lisp is used in many commercial applications, including the [[Yahoo!]] Store web-commerce site, which originally involved [[Paul Graham (computer programmer)|Paul Graham]] and was later rewritten in C++ and Perl.<ref name="doubt-not-corporate-foolishness">"In January 2003, Yahoo released a new version of the editor written in C++ and Perl. It's hard to say whether the program is no longer written in Lisp, though, because to translate this program into C++ they literally had to write a Lisp interpreter: the source files of all the page-generating templates are still, as far as I know, Lisp code." [[Paul Graham (computer programmer)|Paul Graham]], [http://www.paulgraham.com/avg.html Beating the Averages]</ref> Other notable examples include:<br />
<br />
* [[ACT-R]], a cognitive architecture used in a large number of research projects.<br />
* Authorizer's Assistant,<ref>[http://www.aaai.org/Papers/IAAI/1989/IAAI89-031.pdf Authorizer's Assistant]</ref><ref>[http://www.prenhall.com/divisions/bp/app/alter/student/useful/ch9amex.html American Express Authorizer's Assistant]</ref> a large rule-based system used by American Express, analyzing credit requests.<br />
* [[Cyc]], a long running project with the aim to create a knowledge-based system that provides a huge amount of common sense knowledge<br />
* The [[Dynamic Analysis and Replanning Tool]] (DART), which is said to alone have paid back during the years from 1991 to 1995 for all thirty years of [[DARPA]] investments in AI research.<br />
* G2 from Gensym, a real-time business rules engine (BRE)<ref>[http://www.gensym.com/index.php?option=com_content&view=article&id=47&Itemid=54 Real-time Application Development]. Gensym. Retrieved on 2013-07-17.</ref><br />
* [http://www.genworks.com Genworks GDL], based on the open-source [http://github.com/genworks/gendl Gendl] kernel.<br />
* The development environment for the [[Jak and Daxter]] video game series, developed by [[Naughty Dog]].<br />
* [[ITA Software]]'s low fare search engine, used by travel websites such as [[Orbitz]] and [[Kayak.com]] and airlines such as [[American Airlines]], [[Continental Airlines]] and [[US Airways]].<br />
* [[Mirai (software)|Mirai]], a 3d graphics suite. It was used to animate the face of Gollum in the movie Lord of the Rings: The Two Towers.<br />
* [[Prototype Verification System]] (PVS), a mechanized environment for formal specification and verification.<br />
* PWGL is a sophisticated visual programming environment based on Common Lisp, used in [[Computer assisted composition]] and sound synthesis.<ref>[http://www2.siba.fi/PWGL/ PWGL - Home]. . Retrieved on 2013-07-17.</ref> <br />
* SPIKE, a scheduling system for earth or space based observatories and satellites, notably the Hubble Space Telescope.<ref>[http://www.stsci.edu/resources/software_hardware/spike/ Spike Planning and Scheduling System]. Stsci.edu. Retrieved on 2013-07-17.</ref><br />
<br />
There also exist open-source applications written in Common Lisp, such as:<br />
<br />
* [[ACL2]], a full-featured [[automated theorem prover]] for an [[applicative programming language|applicative]] variant of Common Lisp.<br />
* [[Axiom (computer algebra system)|Axiom]], a sophisticated [[computer algebra system]].<br />
* [[Maxima (software)|Maxima]], a sophisticated [[computer algebra system]].<br />
* [[OpenMusic]] is an object-oriented visual programming environment based on Common Lisp, used in [[Computer assisted composition]].<br />
* [[Stumpwm]], a tiling, keyboard driven X11 Window Manager written entirely in Common Lisp.<br />
<br />
==Libraries==<br />
<br />
Since 2011 Zach Beane, with support of the Common Lisp Foundation, maintains the [[Quicklisp]] library manager. It allows easy access to several hundred libraries written in Common Lisp.<br />
<br />
==See also==<br />
{{Portal|Computer Science|Computer programming}}<br />
*''[[Common Lisp the Language]]''<br />
*''[[On Lisp]]''<br />
*''[[Practical Common Lisp]]''<br />
{{Clear}}<br />
<br />
==References==<br />
{{Reflist|2}}<br />
<br />
==Bibliography==<br />
A chronological list of books published (or about to be published) about Common Lisp (the language) or about programming with Common Lisp (especially AI programming).<br />
{{Refbegin|2}}<br />
* [[Guy L. Steele]]: ''Common Lisp the Language, 1st Edition'', Digital Press, 1984, ISBN 0-932376-41-X<br />
* [[Rodney Allen Brooks]]: ''Programming in Common Lisp'', John Wiley and Sons Inc, 1985, ISBN 0-471-81888-7<br />
* [[Richard P. Gabriel]]: ''Performance and Evaluation of Lisp Systems'', The MIT Press, 1985, ISBN 0-262-57193-5, [http://www.dreamsongs.com/Files/Timrep.pdf PDF]<br />
* [[Robert Wilensky]]: ''Common LISPcraft'', W.W. Norton & Co., 1986, ISBN 0-393-95544-3<br />
* [[Eugene Charniak]], [[Christopher K. Riesbeck]], [[Drew V. McDermott]], [[James R. Meehan]]: ''Artificial Intelligence Programming, 2nd Edition'', Lawrence Erlbaum, 1987, ISBN 0-89859-609-2<br />
* [[Wendy L. Milner]]: ''Common Lisp: A Tutorial'', Prentice Hall, 1987, ISBN 0-13-152844-0<br />
* [[Deborah G. Tatar]]: ''A Programmer's Guide to Common Lisp'', Longman Higher Education, 1987, ISBN 0-13-728940-5<br />
* [[Taiichi Yuasa]], [[Masami Hagiya]]: ''Introduction to Common Lisp'', Elsevier Ltd, 1987, ISBN 0-12-774860-1<br />
* [[Christian Queinnec]], [[Jerome Chailloux]]: ''Lisp Evolution and Standardization'', Ios Pr Inc., 1988, ISBN 90-5199-008-1<br />
* [[Taiichi Yuasa]], [[Richard Weyhrauch]], [[Yasuko Kitajima]]: ''Common Lisp Drill'', Academic Press Inc, 1988, ISBN 0-12-774861-X<br />
* [[Wade L. Hennessey]]: ''Common Lisp'', McGraw-Hill Inc., 1989, ISBN 0-07-028177-7<br />
* [[Tony Hasemer]], [[John Dominque]]: ''Common Lisp Programming for Artificial Intelligence'', Addison-Wesley Educational Publishers Inc, 1989, ISBN 0-201-17579-7<br />
* [[Sonya E. Keene]]: ''Object-Oriented Programming in Common Lisp: A Programmer's Guide to CLOS'', Addison-Wesley, 1989, ISBN 0-201-17589-4<br />
* [[David Jay Steele]]: ''Golden Common Lisp: A Hands-On Approach'', Addison Wesley, 1989, ISBN 0-201-41653-0<br />
* [[David S. Touretzky]]: ''Common Lisp: A Gentle Introduction to Symbolic Computation'', Benjamin-Cummings, 1989, ISBN 0-8053-0492-4. [http://www.cs.cmu.edu/~dst/LispBook/ Web/PDF] Dover reprint (2013) ISBN 978-0486498201<br />
* [[Christopher K. Riesbeck]], [[Roger C. Schank]]: ''Inside Case-Based Reasoning'', Lawrence Erlbaum, 1989, ISBN 0-89859-767-6<br />
* [[Patrick Winston]], [[Berthold Horn]]: ''Lisp, 3rd Edition'', Addison-Wesley, 1989, ISBN 0-201-08319-1, [http://people.csail.mit.edu/phw/Books/LISPBACK.HTML Web]<br />
* [[Gerard Gazdar]], [[Chris Mellish]]: ''Natural Language Processing in LISP: An Introduction to Computational Linguistics'', Addison-Wesley Longman Publishing Co., 1990, ISBN 0-201-17825-7<br />
* [[Patrick R. Harrison]]: ''Common Lisp and Artificial Intelligence'', Prentice Hall PTR, 1990, ISBN 0-13-155243-0<br />
* [[Timothy Koschmann]]: ''The Common Lisp Companion'', John Wiley & Sons, 1990, ISBN 0-471-50308-8<br />
* [[Molly M. Miller]], [[Eric Benson]]: ''Lisp Style & Design'', Digital Press, 1990, ISBN 1-55558-044-0<br />
* [[Guy L. Steele]]: ''[[Common Lisp the Language]], 2nd Edition'', Digital Press, 1990, ISBN 1-55558-041-6, [http://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html Web]<br />
* [[Steven L. Tanimoto]]: ''The Elements of Artificial Intelligence Using Common Lisp'', Computer Science Press, 1990, ISBN 0-7167-8230-8<br />
* [[Peter Lee (computer scientist)|Peter Lee]]: ''Topics in Advanced Language Implementation'', The MIT Press, 1991, ISBN 0-262-12151-4<br />
* [[John H. Riley]]: ''A Common Lisp Workbook'', Prentice Hall, 1991, ISBN 0-13-155797-1<br />
* [[Peter Norvig]]: ''Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp'', Morgan Kaufmann, 1991, ISBN 1-55860-191-0, [http://norvig.com/paip.html Web]<br />
* [[Gregor Kiczales]], [[Jim des Rivieres]], [[Daniel G. Bobrow]]: ''The Art of the Metaobject Protocol'', The MIT Press, 1991, ISBN 0-262-61074-4<br />
* [[Jo A. Lawless]], [[Molly M. Miller]]: ''Understanding CLOS: The Common Lisp Object System'', Digital Press, 1991, ISBN 0-13-717232-X<br />
* Mark Watson: ''Common Lisp Modules: Artificial Intelligence in the Era of Neural Networks and Chaos Theory'', Springer Verlag New York Inc., 1991, ISBN 0-387-97614-0<br />
* [[James L. Noyes]]: ''Artificial Intelligence with Common Lisp: Fundamentals of Symbolic and Numeric Processing'', Jones & Bartlett Pub, 1992, ISBN 0-669-19473-5<br />
* [[Stuart C. Shapiro]]: ''COMMON LISP: An Interactive Approach'', Computer Science Press, 1992, ISBN 0-7167-8218-9, [http://www.cse.buffalo.edu/pub/WWW/faculty/shapiro/Commonlisp/ Web/PDF]<br />
* [[Kenneth D. Forbus]], [[Johan de Kleer]]: ''Building Problem Solvers'', The MIT Press, 1993, ISBN 0-262-06157-0<br />
* [[Andreas Paepcke]]: ''Object-Oriented Programming: The CLOS Perspective'', The MIT Press, 1993, ISBN 0-262-16136-2<br />
* [[Paul Graham (computer programmer)|Paul Graham]]: ''[[On Lisp]]'', Prentice Hall, 1993, ISBN 0-13-030552-9, [http://www.paulgraham.com/onlisp.html Web/PDF]<br />
* [[Paul Graham (computer programmer)|Paul Graham]]: ''ANSI Common Lisp'', Prentice Hall, 1995, ISBN 0-13-370875-6<br />
* [[Otto Mayer]]: ''Programmieren in Common Lisp'', German, Spektrum Akademischer Verlag, 1995, ISBN 3-86025-710-2<br />
* [[Stephen Slade]]: ''Object-Oriented Common Lisp'', Prentice Hall, 1997, ISBN 0-13-605940-6<br />
* [[Richard P. Gabriel]]: ''Patterns of Software: Tales from the Software Community'', Oxford University Press, 1998, ISBN 0-19-512123-6, [http://www.dreamsongs.org/Files/PatternsOfSoftware.pdf PDF]<br />
* [[Taiichi Yuasa]], [[Hiroshi G. Okuno]]: ''Advanced Lisp Technology'', CRC, 2002, ISBN 0-415-29819-9<br />
* [[David B. Lamkins]]: ''Successful Lisp: How to Understand and Use Common Lisp'', bookfix.com, 2004. ISBN 3-937526-00-5, [http://www.psg.com/~dlamkins/sl/contents.html Web]<br />
* [[Peter Seibel]]: ''[[Practical Common Lisp]]'', Apress, 2005. ISBN 1-59059-239-5, [http://www.gigamonkeys.com/book/ Web]<br />
* [[Doug Hoyte]]: ''Let Over Lambda'', Lulu.com, 2008, ISBN 1-4357-1275-7, [http://letoverlambda.com/ Web]<br />
* [[George F. Luger]], [[William A. Stubblefield]]: ''AI Algorithms, Data Structures, and Idioms in Prolog, Lisp and Java'', Addison Wesley, 2008, ISBN 0-13-607047-7, [http://wps.aw.com/wps/media/objects/5771/5909832/PDF/Luger_0136070477_1.pdf PDF]<br />
* [[Conrad Barski]]: ''Land of Lisp: Learn to program in Lisp, one game at a time!'', No Starch Press, 2010, ISBN 1-59327-200-6, [http://www.lisperati.com/landoflisp/ Web]<br />
* [[Pavel Penev]]: ''Lisp Web Tales'', Leanpub, 2013, [https://leanpub.com/lispwebtales Web]<br />
{{Refend}}<br />
<br />
==External links==<br />
{{Wikibooks}}<br />
* The [http://www.cliki.net/ CLiki], a Wiki for [[free and open source software|free and open source]] Common Lisp systems running on Unix-like systems.<br />
* [http://www.common-lisp.net/ Common Lisp software repository].<br />
* {{cite web | url = http://www.lispworks.com/documentation/HyperSpec/Body/01_ab.htm | title = History | work = [[Common Lisp HyperSpec]] }}<br />
* [http://www.flownet.com/gat/jpl-lisp.html Lisping at JPL]<br />
* [http://www.defmacro.org/ramblings/lisp.html The Nature of Lisp] Essay that examines Lisp by comparison with XML.<br />
* [http://common-lisp.net/~dlw/LispSurvey.html Common Lisp Implementations: A Survey] Survey of maintained Common Lisp implementations.<br />
* [http://clqr.boundp.org Common Lisp Quick Reference]<br />
* [http://planet.lisp.org Planet Lisp] Articles about Common Lisp.<br />
<br />
{{Common Lisp}}<br />
<br />
[[Category:Common Lisp]]<br />
[[Category:Multi-paradigm programming languages]]<br />
[[Category:Functional languages]]<br />
[[Category:Dynamically typed programming languages]]<br />
[[Category:Dynamic programming languages]]<br />
[[Category:Object-oriented programming languages]]<br />
[[Category:Class-based programming languages]]<br />
[[Category:Procedural programming languages]]<br />
[[Category:Extensible syntax programming languages]]<br />
[[Category:Lisp programming language family]]<br />
[[Category:Lisp (programming language)]]<br />
[[Category:Articles with example Lisp code]]<br />
[[Category:Cross-platform software]]<br />
[[Category:Cross-platform free software]]<br />
[[Category:Programming languages created in 1984]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Common_Lisp&diff=689833267Common Lisp2015-11-09T18:03:15Z<p>PuercoPop: /* Birthday paradox */ Wording</p>
<hr />
<div>{{Infobox programming language<br />
| name = Common Lisp<br />
| family = [[Lisp (programming language)|Lisp]]<br />
| paradigm = [[Multi-paradigm programming language|Multi-paradigm]]: [[procedural programming|procedural]], [[functional programming|functional]], [[object-oriented programming|object-oriented]], [[metaprogramming|meta]], [[reflective programming|reflective]], [[generic programming|generic]]<br />
| generation = [[3GL]]<br />
| released = 1984, 1994 for ANSI Common Lisp<br />
| designer = [[Scott Fahlman]], [[Richard P. Gabriel]], [[Dave Moon]], [[Guy Steele]], [[Dan Weinreb]]<br />
| developer = ANSI [[X3J13]] committee<br />
| standard reference = [[Common Lisp HyperSpec]]<br />
| latest release version =<br />
| latest release date =<br />
| typing = [[Dynamic typing|dynamic]], [[Strongly-typed programming language|strong]]<br />
| scope = lexical, optionally dynamic<br />
| namespace style = Lisp-2<br />
| implementations = [[Allegro Common Lisp|Allegro CL]], [[Armed Bear Common Lisp|ABCL]], [[CLISP]], [[Clozure CL]], [[CMUCL]], [[Embeddable Common Lisp|ECL]], [[GNU Common Lisp|GCL]], [[LispWorks]], [[Scieneer Common Lisp|Scieneer CL]], [[SBCL]], [[Genera (operating system)|Symbolics Common Lisp]]<br />
| dialects = CLtL1, CLtL2, ANSI Common Lisp<br />
| influenced_by = [[Lisp (programming language)|Lisp]], [[Lisp Machine Lisp]], [[Maclisp]], [[Scheme (programming language)|Scheme]], [[Interlisp]]<br />
| influenced = [[Clojure]], [[Dylan (programming language)|Dylan]], [[Emacs Lisp]], [[EuLisp]], [[ISLISP]], [[Julia (programming language)|Julia]], [[Moose (Perl)|Moose]], [[R (programming language)|R]], [[Cadence SKILL|SKILL]], [[SubL]]<br />
| operating_system = [[Cross-platform]]<br />
| license =<br />
| website = {{URL|http://common-lisp.net/}}<br />
| file_ext = .lisp, .lsp, .l, .cl, .fasl<br />
}}<br />
<br />
'''Common Lisp''' ('''CL''') is a dialect of the [[Lisp (programming language)|Lisp]] [[programming language]], published in [[American National Standards Institute|ANSI]] standard document ''ANSI INCITS 226-1994 (R2004)'' (formerly ''X3.226-1994 (R1999)'').<ref>Quoted from cover of cited standard. ANSI INCITS 226-1994 (R2004), for sale on standard's [http://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+INCITS+226-1994+(R2004) document page].</ref> From the ANSI Common Lisp standard the [[Common Lisp HyperSpec]], a hyperlinked HTML version, has been derived.<ref>[http://www.lispworks.com/documentation/HyperSpec/Front/Help.htm#Authorship Authorship of the Common Lisp HyperSpec]</ref><br />
<br />
The Common Lisp language was developed as a standardized and improved successor of [[Maclisp]]. Thus it is not an implementation, but rather a language [[specification]].<ref>[http://www.lispworks.com/documentation/HyperSpec/Body/01_ab.htm Common Lisp HyperSpec 1.1.2 History]</ref> Several [[#Implementations|implementations]] of the Common Lisp standard are available, including [[free and open source software]] and proprietary products.<ref>[http://common-lisp.net/~dlw/LispSurvey.html Common Lisp Implementations: A Survey]</ref><br />
<br />
The first language documentation was published 1984 as [[Common Lisp the Language]], first edition. A second edition, published in 1990, incorporated many changes to the language, made during the ANSI Common Lisp standardization process. The final ANSI Common Lisp standard then was published in 1994. Since then no update to the standard has been published. Various extensions and improvements to Common Lisp (examples are Unicode, Concurrency, CLOS-based IO) have been provided by implementations.<br />
<br />
Common Lisp is a general-purpose, [[multi-paradigm programming language]]. It supports a combination of [[procedural programming|procedural]], [[functional programming|functional]], and [[object-oriented programming]] paradigms. As a [[dynamic programming language]], it facilitates evolutionary and [[Iterative and incremental development|incremental software development]], with iterative [[Compiler|compilation]] into efficient run-time programs. This incremental development is often done interactively without interrupting the running application.<br />
<br />
It also supports optional type annotation and casting, which can be added as necessary at the later profiling and optimization stages, to permit the compiler to generate more efficient code. For instance, <code>fixnum</code> can hold an [[Boxing (computer science)|unboxed]] integer in a range supported by the hardware and implementation, permitting more efficient arithmetic than on big integers or arbitrary precision types. Similarly, the compiler can be told on a per-module or per-function basis which type safety level is wanted, using ''optimize'' declarations.<br />
<br />
Common Lisp includes [[Common Lisp Object System|CLOS]], an [[object system]] that supports [[multimethods]] and method combinations. It is often implemented with a [[Metaobject]] Protocol.<br />
<br />
Common Lisp is extensible through standard features such as Lisp [[Macro (computer science)|macros]] (code transformations) and reader macros (input parsers for characters).<br />
<br />
Common Lisp provides some backwards compatibility to [[Maclisp]] and to John McCarthy's original [[Lisp (programming language)|Lisp]]. This allows older Lisp software to be ported to Common Lisp.<ref>{{cite web<br />
| url = http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/wang.html<br />
| title = Old LISP programs still run in Common Lisp | accessdate = 2015-05-13<br />
}}</ref><br />
<br />
==Syntax==<br />
<br />
Common Lisp is a dialect of Lisp; it uses [[S-expression]]s to denote both code and data structure. Function calls, macro forms and special forms are written as lists, with the name of the function first, as in these examples:<br />
<br />
<source lang="lisp"><br />
(+ 2 2) ; adds 2 and 2, yielding 4. The function's name is '+'. Lisp has no operators as such.<br />
</source><br />
<source lang="lisp"><br />
(defvar *x*) ; Ensures that a variable *x* exists,<br />
; without giving it a value. The asterisks are part of<br />
; the name, by convention denoting a special (global) variable. <br />
; The symbol *x* is also hereby endowed with the property that<br />
; subsequent bindings of it are dynamic, rather than lexical.<br />
(setf *x* 42.1) ; sets the variable *x* to the floating-point value 42.1<br />
</source><br />
<source lang="lisp"><br />
;; Define a function that squares a number:<br />
(defun square (x)<br />
(* x x))<br />
</source><br />
<source lang="lisp"><br />
;; Execute the function:<br />
(square 3) ; Returns 9<br />
</source><br />
<!-- I truncated this a bit; in smaller browsers, it runs off the side--><br />
<source lang="lisp"><br />
;; the 'let' construct creates a scope for local variables. Here<br />
;; the variable 'a' is bound to 6 and the variable 'b' is bound<br />
;; to 4. Inside the 'let' is a 'body', where the last computed value is returned.<br />
;; Here the result of adding a and b is returned from the 'let' expression.<br />
;; The variables a and b have lexical scope, unless the symbols have been<br />
;; marked as special variables (for instance by a prior DEFVAR).<br />
(let ((a 6)<br />
(b 4))<br />
(+ a b)) ; returns 10<br />
</source><br />
<br />
==Data types==<br />
Common Lisp has many data types.<br />
<br />
===Scalar types===<br />
''Number'' types include [[integer]]s, [[ratio]]s, [[Floating point|floating-point number]]s, and [[complex number]]s.<ref name="reddy">{{cite web<br />
| url = http://random-state.net/features-of-common-lisp.html<br />
| title = Features of Common Lisp<br />
| first = Abhishek | last = Reddy<br />
| date = 2008-08-22<br />
}}</ref> Common Lisp uses [[Arbitrary-precision arithmetic|bignum]]s to represent numerical values of arbitrary size and precision. The ratio type represents fractions exactly, a facility not available in many languages. Common Lisp automatically coerces numeric values among these types as appropriate.<br />
<br />
The Common Lisp ''[[character (computing)|character]]'' type is not limited to [[ASCII]] characters. Most modern implementations allow [[Unicode]] characters.<ref>{{cite web<br />
| url = http://www.cliki.net/Unicode%20Support<br />
| title = Unicode support | work = The Common Lisp Wiki | accessdate = 2008-08-21<br />
}}</ref><br />
<br />
The ''[[Symbol (programming)|symbol]]'' type is common to Lisp languages, but largely unknown outside them. A symbol is a unique, named data object with several parts: name, value, function, property list and package. Of these, ''value cell'' and ''function cell'' are the most important. Symbols in Lisp are often used similarly to identifiers in other languages: to hold the value of a variable; however there are many other uses. Normally, when a symbol is evaluated, its value is returned. Some symbols evaluate to themselves, for example all symbols in the keyword package are self-evaluating. Boolean values in Common Lisp are represented by the self-evaluating symbols T and NIL. Common Lisp has namespaces for symbols, called 'packages'.<br />
<br />
A number of functions are available for [[rounding]] scalar numeric values in various ways. The function <code>round</code> rounds the argument to the nearest integer, with halfway cases rounded to the even integer. The functions <code>truncate</code>, <code>floor</code>, and <code>ceiling</code> round towards zero, down, or up respectively. All these functions return the discarded fractional part as a secondary value. For example, <code>(floor -2.5)</code> yields -3, 0.5; <code>(ceiling -2.5)</code> yields -2, -0.5; <code>(round 2.5)</code> yields 2, 0.5; and <code>(round 3.5)</code> yields 4, -0.5.<br />
<br />
===Data structures===<br />
''Sequence'' types in Common Lisp include lists, vectors, bit-vectors, and strings. There are many operations which can work on any sequence type.<br />
<br />
As in almost all other Lisp dialects, ''lists'' in Common Lisp are composed of ''conses'', sometimes called ''cons cells'' or ''pairs''. A cons is a data structure with two slots, called its ''car'' and ''cdr''. A list is a linked chain of conses or the empty list. Each cons's car refers to a member of the list (possibly another list). Each cons's cdr refers to the next cons—except for the last cons in a list, whose cdr refers to the <code>nil</code> value. Conses can also easily be used to implement trees and other complex data structures; though it is usually advised to use structure or class instances instead. It is also possible to create circular data structures with conses.<br />
<br />
Common Lisp supports multidimensional ''arrays'', and can dynamically resize ''adjustable'' arrays if required. Multidimensional arrays can be used for matrix mathematics. A ''vector'' is a one-dimensional array. Arrays can carry any type as members (even mixed types in the same array) or can be specialized to contain a specific type of members, as in a vector of bits. Usually only a few types are supported. Many implementations can optimize array functions when the array used is type-specialized. Two type-specialized array types are standard: a ''string'' is a vector of characters, while a ''bit-vector'' is a vector of [[bit]]s.<br />
<br />
''[[Hash table]]s'' store associations between data objects. Any object may be used as key or value. Hash tables are automatically resized as needed.<br />
<br />
''Packages'' are collections of symbols, used chiefly to separate the parts of a program into [[namespaces]]. A package may ''export'' some symbols, marking them as part of a public interface. Packages can use other packages.<br />
<br />
''Structures'', similar in use to [[C (programming language)|C]] structs and [[Pascal (programming language)|Pascal]] records, represent arbitrary complex data structures with any number and type of fields (called ''slots''). Structures allow single-inheritance.<br />
<br />
''Classes'' are similar to structures, but offer more dynamic features and multiple-inheritance. (See [[Common Lisp Object System|CLOS]]). Classes have been added late to Common Lisp and there is some conceptual overlap with structures. Objects created of classes are called ''Instances''. A special case are Generic Functions. Generic Functions are both functions and instances.<br />
<br />
===Functions===<br />
Common Lisp supports [[first-class function]]s. For instance, it is possible to write functions that take other functions as arguments or return functions as well. This makes it possible to describe very general operations.<br />
<br />
The Common Lisp library relies heavily on such higher-order functions. For example, the <code>sort</code> function takes a [[relational operator]] as an argument and key function as an optional keyword argument. This can be used not only to sort any type of data, but also to sort data structures according to a key.<br />
<br />
<source lang="lisp"><br />
;; Sorts the list using the > and < function as the relational operator.<br />
(sort (list 5 2 6 3 1 4) #'>) ; Returns (6 5 4 3 2 1)<br />
(sort (list 5 2 6 3 1 4) #'<) ; Returns (1 2 3 4 5 6)<br />
</source><br />
<source lang="lisp"><br />
;; Sorts the list according to the first element of each sub-list.<br />
(sort (list '(9 A) '(3 B) '(4 C)) #'< :key #'first) ; Returns ((3 B) (4 C) (9 A))<br />
</source><br />
<br />
The evaluation model for functions is very simple. When the evaluator encounters a form <code>(f a1 a2...)</code> then it presumes that the symbol named f is one of the following:<br />
<br />
# A special operator (easily checked against a fixed list)<br />
# A macro operator (must have been defined previously)<br />
# The name of a function (default), which may either be a symbol, or a sub-form beginning with the symbol <code>lambda</code>.<br />
<br />
If f is the name of a function, then the arguments a1, a2, ..., an are evaluated in left-to-right order, and the function is found and invoked with those values supplied as parameters.<br />
<br />
====Defining functions====<br />
The [[Defun|macro <code>defun</code>]] defines functions where a function definition gives the name of the function, the names of any arguments, and a function body:<br />
<br />
<source lang="lisp"><br />
(defun square (x)<br />
(* x x))<br />
</source><br />
<br />
Function definitions may include compiler [[Directive (programming)|directives]], known as ''declarations'', which provide hints to the compiler about optimization settings or the data types of arguments. They may also include ''documentation strings'' (docstrings), which the Lisp system may use to provide interactive documentation:<br />
<br />
<source lang="lisp"><br />
(defun square (x)<br />
"Calculates the square of the single-float x."<br />
(declare (single-float x) (optimize (speed 3) (debug 0) (safety 1)))<br />
(the single-float (* x x)))<br />
</source><br />
<br />
Anonymous functions ([[function literal]]s) are defined using <code>lambda</code> expressions, e.g. <code>(lambda&nbsp;(x)&nbsp;(*&nbsp;x&nbsp;x))</code> for a function that squares its argument. Lisp programming style frequently uses higher-order functions for which it is useful to provide anonymous functions as arguments.<br />
<br />
Local functions can be defined with <code>flet</code> and <code>labels</code>.<br />
<br />
<source lang="lisp"><br />
(flet ((square (x)<br />
(* x x)))<br />
(square 3))<br />
</source><br />
<br />
There are a number of other operators related to the definition and manipulation of functions. For instance, a function may be compiled with the <code>compile</code> operator. (Some Lisp systems run functions using an interpreter by default unless instructed to compile; others compile every function).<br />
<br />
====Defining generic functions and methods====<br />
The macro <code>defgeneric</code> defines generic functions.<br />
The macro <code>defmethod</code> defines methods. Generic functions are a collection of methods.<br />
<br />
Methods can specialize their parameters over CLOS ''standard classes'', ''system classes'', ''structure classes'' or objects. For many types there are corresponding ''system classes''.<br />
<br />
When a generic function is called, multiple-dispatch will determine the effective method to use.<br />
<br />
<source lang="lisp"><br />
(defgeneric add (a b))<br />
</source><br />
<br />
<source lang="lisp"><br />
(defmethod add ((a number) (b number))<br />
(+ a b))<br />
</source><br />
<br />
<source lang="lisp"><br />
(defmethod add ((a vector) (b number))<br />
(map 'vector (lambda (n) (+ n b)) a))<br />
</source><br />
<br />
<source lang="lisp"><br />
(defmethod add ((a vector) (b vector))<br />
(map 'vector #'+ a b))<br />
</source><br />
<source lang="lisp"><br />
(defmethod add ((a string)(b string))<br />
(concatenate 'string a b) )<br />
</source><br />
<source lang="lisp"><br />
(add 2 3) ; returns 5<br />
(add #(1 2 3 4) 7) ; returns #(8 9 10 11)<br />
(add #(1 2 3 4) #(4 3 2 1)) ; returns #(5 5 5 5)<br />
(add "COMMON " "LISP") ; returns "COMMON LISP"<br />
</source><br />
<br />
Generic Functions are also a first class data type. There are many more features to Generic Functions and Methods than described above.<br />
<br />
====The function namespace====<br />
<!-- This section name is linked from several places; if you change it, update the links. --><br />
<br />
The namespace for function names is separate from the namespace for data variables. This is a key difference between Common Lisp and [[Scheme (programming language)|Scheme]]. For Common Lisp, operators that define names in the function namespace include <code>defun</code>, <code>flet</code>, <code>labels</code>, <code>defmethod</code> and <code>defgeneric</code>.<br />
<br />
To pass a function by name as an argument to another function, one must use the <code>function</code> special operator, commonly abbreviated as <code>#'</code>. The first <code>sort</code> example above refers to the function named by the symbol <code>&gt;</code> in the function namespace, with the code <code>#'&gt;</code>. Conversely, to call a function passed in such a way, one would use the <code>funcall</code> operator on the argument.<br />
<br />
[[Scheme (programming language)|Scheme's]] evaluation model is simpler: there is only one namespace, and all positions in the form are evaluated (in any order) -- not just the arguments. Code written in one dialect is therefore sometimes confusing to programmers more experienced in the other. For instance, many Common Lisp programmers like to use descriptive variable names such as ''list'' or ''string'' which could cause problems in Scheme, as they would locally shadow function names.<br />
<br />
Whether a separate namespace for functions is an advantage is a source of contention in the Lisp community. It is usually referred to as the ''Lisp-1 vs. Lisp-2 debate''. Lisp-1 refers to Scheme's model and Lisp-2 refers to Common Lisp's model. These names were coined in a 1988 paper by [[Richard P. Gabriel]] and [[Kent Pitman]], which extensively compares the two approaches.<ref>{{cite journal |title=Technical Issues of Separation in Function Cells and Value Cells |url=http://www.nhplace.com/kent/Papers/Technical-Issues.html |authors=Richard P. Gabriel, Kent M. Pitman |journal=Lisp and Symbolic Computation |date = June 1988|volume=1 |issue=1 |pages=81–101 |doi=10.1007/bf01806178}}</ref><br />
<br />
===Other types===<br />
Other data types in Common Lisp include:<br />
<br />
*''Pathnames'' represent files and directories in the [[filesystem]]. The Common Lisp pathname facility is more general than most operating systems' file naming conventions, making Lisp programs' access to files broadly portable across diverse systems.<br />
*Input and output ''streams'' represent sources and sinks of binary or textual data, such as the terminal or open files.<br />
*Common Lisp has a built-in [[pseudo-random number generator]] (PRNG). ''Random state'' objects represent reusable sources of pseudo-random numbers, allowing the user to seed the PRNG or cause it to replay a sequence.<br />
*''Conditions'' are a type used to represent errors, exceptions, and other "interesting" events to which a program may respond.<br />
*''Classes'' are [[first-class object]]s, and are themselves instances of classes called [[metaclasses|metaobject classes]] ([[metaclasses]] for short).<br />
*''Readtables'' are a type of object which control how Common Lisp's reader parses the text of source code. By controlling which readtable is in use when code is read in, the programmer can change or extend the language's syntax.<br />
<br />
==Scope==<br />
<br />
Like programs in many other programming languages, Common Lisp programs make use of names to refer to variables, functions, and many other kinds of entities. Named references are subject to scope.<br />
<br />
The association between a name and the entity which the name refers to is called a binding.<br />
<br />
Scope refers to the set of circumstances in which a name is determined to have a particular binding.<br />
<br />
===Determiners of scope===<br />
<br />
The circumstances which determine scope in Common Lisp include:<br />
<br />
* the location of a reference within an expression. If it's the leftmost position of a compound, it refers to a special operator or a macro or function binding, otherwise to a variable binding or something else.<br />
* the kind of expression in which the reference takes place. For instance, <code>(go x)</code> means transfer control to label <code>x</code>, whereas <code>(print x)</code> refers to the variable <code>x</code>. Both scopes of <code>x</code> can be active in the same region of program text, since tagbody labels are in a separate namespace from variable names. A special form or macro form has complete control over the meanings of all symbols in its syntax. For instance in <code>(defclass x (a b) ())</code>, a class definition, the <code>(a b)</code> is a list of base classes, so these names are looked up in the space of class names, and <code>x</code> isn't a reference to an existing binding, but the name of a new class being derived from <code>a</code> and <code>b</code>. These facts emerge purely from the semantics of <code>defclass</code>. The only generic fact about this expression is that <code>defclass</code> refers to a macro binding; everything else is up to <code>defclass</code>.<br />
* the location of the reference within the program text. For instance, if a reference to variable <code>x</code> is enclosed in a binding construct such as a <code>let</code> which defines a binding for <code>x</code>, then the reference is in the scope created by that binding.<br />
* for a variable reference, whether or not a variable symbol has been, locally or globally, declared special. This determines whether the reference is resolved within a lexical environment, or within a dynamic environment.<br />
* the specific instance of the environment in which the reference is resolved. An environment is a run-time dictionary which maps symbols to bindings. Each kind of reference uses its own kind of environment. References to lexical variables are resolved in a lexical environment, et cetera. More than one environment can be associated with the same reference. For instance, thanks to recursion or the use of multiple threads, multiple activations of the same function can exist at the same time. These activations share the same program text, but each has its own lexical environment instance.<br />
<br />
To understand what a symbol refers to, the Common Lisp programmer must know what kind of reference is being expressed, what kind of scope it uses if it is a variable reference (dynamic versus lexical scope), and also the run-time situation: in what environment is the reference resolved, where was the binding introduced into the environment, et cetera.<br />
<br />
===Kinds of environment===<br />
<br />
====Global====<br />
<br />
Some environments in Lisp are globally pervasive. For instance, if a new type is defined, it is known everywhere thereafter. References to that type look it up in this global environment.<br />
<br />
====Dynamic====<br />
<br />
One type of environment in Common Lisp is the dynamic environment. Bindings established in this environment have dynamic extent, which means that a binding is established at the start of the execution of some construct, such as a <code>let</code> block, and disappears when that construct finishes executing: its lifetime is tied to the dynamic activation and deactivation of a block. However, a dynamic binding is not just visible within that block; it is also visible to all functions invoked from that block. This type of visibility is known as indefinite scope. Bindings which exhibit dynamic extent (lifetime tied to the activation and deactivation of a block) and indefinite scope (visible to all functions which are called from that block) are said to have dynamic scope.<br />
<br />
Common Lisp has support for dynamically scoped variables, which are also called special variables. Certain other kinds of bindings are necessarily dynamically scoped also, such as restarts and catch tags. Function bindings cannot be dynamically scoped using <code>flet</code> (which only provides lexically scoped function bindings), but function objects (a first-level object in Common Lisp) can be assigned to dynamically scoped variables, bound using <code>let</code> in dynamic scope, then called using <code>funcall</code> or <code>APPLY</code>.<br />
<br />
Dynamic scope is extremely useful because it adds referential clarity and discipline to [[global variable]]s. Global variables are frowned upon in computer science as potential sources of error, because they can give rise to ad-hoc, covert channels of communication among modules that lead to unwanted, surprising interactions.<br />
<br />
In Common Lisp, a special variable which has only a top-level binding behaves just like a global variable in other programming languages. A new value can be stored into it, and that value simply replaces what is in the top-level binding. Careless replacement of the value of a global variable is at the heart of bugs caused by use of global variables. However, another way to work with a special variable is to give it a new, local binding within an expression. This is sometimes referred to as "rebinding" the variable. Binding a dynamically scoped variable temporarily creates a new memory location for that variable, and associates the name with that location. While that binding is in effect, all references to that variable refer to the new binding; the previous binding is hidden. When execution of the binding expression terminates, the temporary memory location is gone, and the old binding is revealed, with the original value intact. Of course, multiple dynamic bindings for the same variable can be nested.<br />
<br />
In Common Lisp implementations which support multithreading, dynamic scopes are specific to each thread of execution. Thus special variables serve as an abstraction for thread local storage. If one thread rebinds a special variable, this rebinding has no effect on that variable in other threads. The value stored in a binding can only be retrieved by the thread which created that binding. If each thread binds some special variable <code>*x*</code>, then <code>*x*</code> behaves like thread-local storage. Among threads which do not rebind <code>*x*</code>, it behaves like an ordinary global: all of these threads refer to the same top-level binding of <code>*x*</code>.<br />
<br />
Dynamic variables can be used to extend the execution context with additional context information which is implicitly passed from function to function without having to appear as an extra function parameter. This is especially useful when the control transfer has to pass through layers of unrelated code, which simply cannot be extended with extra parameters to pass the additional data. A situation like this usually calls for a global variable. That global variable must be saved and restored, so that the scheme doesn't break under recursion: dynamic variable rebinding takes care of this. And that variable must be made thread-local (or else a big mutex must be used) so the scheme doesn't break under threads: dynamic scope implementations can take care of this also.<br />
<br />
In the Common Lisp library, there are many standard special variables. For instance, all standard I/O streams are stored in the top-level bindings of well-known special variables. The standard output stream is stored in *standard-output*.<br />
<br />
Suppose a function foo writes to standard output:<br />
<br />
<source lang="lisp"><br />
(defun foo ()<br />
(format t "Hello, world"))<br />
</source><br />
<br />
To capture its output in a character string, *standard-output* can be bound to a string stream and called:<br />
<br />
<source lang="lisp"><br />
(with-output-to-string (*standard-output*)<br />
(foo))<br />
</source><br />
<br />
-> "Hello, world" ; gathered output returned as a string<br />
<br />
====Lexical====<br />
<br />
Common Lisp supports lexical environments. Formally, the bindings in a lexical environment have [[lexical scope]] and may have either indefinite extent or dynamic extent, depending on the type of namespace. [[Lexical scope]] means that visibility is physically restricted to the block in which the binding is established. References which are not textually (i.e. lexically) embedded in that block simply do not see that binding.<br />
<br />
The tags in a TAGBODY have lexical scope. The expression (GO X) is erroneous if it is not actually embedded in a TAGBODY which contains a label X. However, the label bindings disappear when the TAGBODY terminates its execution, because they have dynamic extent. If that block of code is re-entered by the invocation of a lexical closure, it is invalid for the body of that closure to try to transfer control to a tag via GO:<br />
<br />
<source lang="lisp"><br />
(defvar *stashed*) ;; will hold a function<br />
<br />
(tagbody<br />
(setf *stashed* (lambda () (go some-label)))<br />
(go end-label) ;; skip the (print "Hello")<br />
some-label<br />
(print "Hello")<br />
end-label)<br />
-> NIL<br />
</source><br />
<br />
When the TAGBODY is executed, it first evaluates the setf form which stores a function in the special variable *stashed*. Then the (go end-label) transfers control to end-label, skipping the code (print "Hello"). Since end-label is at the end of the tagbody, the tagbody terminates, yielding NIL. Suppose that the previously remembered function is now called:<br />
<br />
<source lang="lisp"><br />
(funcall *stashed*) ;; Error!<br />
</source><br />
<br />
This situation is erroneous. One implementation's response is an error condition containing the message, "GO: tagbody for tag SOME-LABEL has already been left". The function tried to evaluate (go some-label), which is lexically embedded in the tagbody, and resolves to the label. However, the tagbody isn't executing (its extent has ended), and so the control transfer cannot take place.<br />
<br />
Local function bindings in Lisp have [[lexical scope]], and variable bindings also have lexical scope by default. By contrast with GO labels, both of these have indefinite extent. When a lexical function or variable binding is established, that binding continues to exist for as long as references to it are possible, even after the construct which established that binding has terminated. References to lexical variables and functions after the termination of their establishing construct are possible thanks to [[lexical closure]]s.<br />
<br />
Lexical binding is the default binding mode for Common Lisp variables. For an individual symbol, it can be switched to dynamic scope, either by a local declaration, by a global declaration. The latter may occur implicitly through the use of a construct like DEFVAR or DEFPARAMETER. It is an important convention in Common Lisp programming that special (i.e. dynamically scoped) variables have names which begin and end with an asterisk [[Sigil (computer programming)|sigil]] <code>*</code> in what is called the “[[earmuff]] convention”.<ref>[http://letoverlambda.com/index.cl/guest/chap2.html Chapter 2] of [[Let Over Lambda]]</ref> If adhered to, this convention effectively creates a separate namespace for special variables, so that variables intended to be lexical are not accidentally made special.<br />
<br />
[[Lexical scope]] is useful for several reasons.<br />
<br />
Firstly, references to variables and functions can be compiled to efficient machine code, because the run-time environment structure is relatively simple. In many cases it can be optimized to stack storage, so opening and closing lexical scopes has minimal overhead. Even in cases where full closures must be generated, access to the closure's environment is still efficient; typically each variable becomes an offset into a vector of bindings, and so a variable reference becomes a simple load or store instruction with a base-plus-offset [[addressing mode]].<br />
<br />
Secondly, lexical scope (combined with indefinite extent) gives rise to the [[lexical closure]], which in turn creates a whole paradigm of programming centered around the use of functions being first-class objects, which is at the root of functional programming.<br />
<br />
Thirdly, perhaps most importantly, even if lexical closures are not exploited, the use of lexical scope isolates program modules from unwanted interactions. Due to their restricted visibility, lexical variables are private. If one module A binds a lexical variable X, and calls another module B, references to X in B will not accidentally resolve to the X bound in A. B simply has no access to X. For situations in which disciplined interactions through a variable are desirable, Common Lisp provides special variables. Special variables allow for a module A to set up a binding for a variable X which is visible to another module B, called from A. Being able to do this is an advantage, and being able to prevent it from happening is also an advantage; consequently, Common Lisp supports both lexical and [[dynamic scope]].<br />
<br />
==Macros==<br />
A ''[[Macro (computer science)|macro]]'' in Lisp superficially resembles a function in usage. However, rather than representing an expression which is evaluated, it represents a transformation of the program source code. The macro gets the source it surrounds as arguments, binds them to its parameters and computes a new source form. This new form can also use a macro. The macro expansion is repeated until the new source form does not use a macro. The final computed form is the source code executed at runtime.<br />
<br />
Typical uses of macros in Lisp:<br />
<br />
* new control structures (example: looping constructs, branching constructs)<br />
* scoping and binding constructs<br />
* simplified syntax for complex and repeated source code<br />
* top-level defining forms with compile-time side-effects<br />
* data-driven programming<br />
* embedded domain specific languages (examples: SQL, HTML, Prolog)<br />
* implicit finalization forms<br />
<br />
Various standard Common Lisp features also need to be implemented as macros, such as:<br />
<br />
* the standard <code>setf</code> abstraction, to allow custom compile-time expansions of assignment/access operators<br />
* <code>with-accessors</code>, <code>with-slots</code>, <code>with-open-file</code> and other similar <code>WITH</code> macros<br />
* Depending on implementation, <code>if</code> or <code>cond</code> is a macro built on the other, the special operator; <code>when</code> and <code>unless</code> consist of macros<br />
* The powerful <code>loop</code> domain-specific language<br />
<br />
Macros are defined by the ''defmacro'' macro. The special operator ''macrolet'' allows the definition of local (lexically scoped) macros. It is also possible to define macros for symbols using ''define-symbol-macro'' and ''symbol-macrolet''.<br />
<br />
[[Paul Graham (computer programmer)|Paul Graham]]'s book [[On Lisp]] describes the use of macros in Common Lisp in detail. [[Doug Hoyte]]'s book [[Let Over Lambda]] extends the discussion on macros, claiming "Macros are the single greatest advantage that lisp has as a programming language and the single greatest advantage of any programming language." Hoyte provides several examples of iterative development of macros.<br />
<br />
===Example using a macro to define a new control structure===<br />
Macros allow Lisp programmers to create new syntactic forms in the language. One typical use is to create new control structures. The example macro provides an <code>until</code> looping construct. The syntax is:<br />
<br />
<source lang="text"><br />
(until test form*)<br />
</source><br />
<br />
The macro definition for ''until'':<br />
<source lang="lisp"><br />
(defmacro until (test &body body)<br />
(let ((start-tag (gensym "START"))<br />
(end-tag (gensym "END")))<br />
`(tagbody ,start-tag<br />
(when ,test (go ,end-tag))<br />
(progn ,@body)<br />
(go ,start-tag)<br />
,end-tag)))<br />
</source><br />
<br />
''tagbody'' is a primitive Common Lisp special operator which provides the ability to name tags and use the ''go'' form to jump to those tags. The backquote ''`'' provides a notation that provides code templates, where the value of forms preceded with a comma are filled in. Forms preceded with comma and at-sign are ''spliced'' in. The tagbody form tests the end condition. If the condition is true, it jumps to the end tag. Otherwise the provided body code is executed and then it jumps to the start tag.<br />
<br />
An example form using above ''until'' macro:<br />
<source lang="lisp"><br />
(until (= (random 10) 0)<br />
(write-line "Hello"))<br />
</source><br />
<br />
The code can be expanded using the function ''macroexpand-1''. The expansion for above example looks like this:<br />
<source lang="lisp"><br />
(TAGBODY<br />
#:START1136<br />
(WHEN (ZEROP (RANDOM 10))<br />
(GO #:END1137))<br />
(PROGN (WRITE-LINE "hello"))<br />
(GO #:START1136)<br />
#:END1137)<br />
</source><br />
<br />
During macro expansion the value of the variable ''test'' is ''(= (random 10) 0)'' and the value of the variable ''body'' is ''((write-line "Hello"))''. The body is a list of forms.<br />
<br />
Symbols are usually automatically upcased. The expansion uses the TAGBODY with two labels. The symbols for these labels are computed by GENSYM and are not interned in any package. Two ''go'' forms use these tags to jump to. Since ''tagbody'' is a primitive operator in Common Lisp (and not a macro), it will not be expanded into something else. The expanded form uses the ''when'' macro, which also will be expanded. Fully expanding a source form is called ''code walking''.<br />
<br />
In the fully expanded (''walked'') form, the ''when'' form is replaced by the primitive ''if'':<br />
<source lang="lisp"><br />
(TAGBODY<br />
#:START1136<br />
(IF (ZEROP (RANDOM 10))<br />
(PROGN (GO #:END1137))<br />
NIL)<br />
(PROGN (WRITE-LINE "hello"))<br />
(GO #:START1136))<br />
#:END1137)<br />
</source><br />
<br />
All macros must be expanded before the source code containing them can be evaluated or compiled normally. Macros can be considered functions that accept and return [[abstract syntax tree]]s (Lisp S-expressions). These functions<br />
are invoked before the evaluator or compiler to produce the final source code.<br />
Macros are written in normal Common Lisp, and may use any Common Lisp (or third-party) operator available.<br />
<br />
===Variable capture and shadowing===<br />
Common Lisp macros are capable of what is commonly called ''variable capture'', where symbols in the macro-expansion body coincide with those in the calling context, allowing the programmer to create macros wherein various symbols have special meaning. The term ''variable capture'' is somewhat misleading, because all namespaces are vulnerable to unwanted capture, including the operator and function namespace, the tagbody label namespace, catch tag, condition handler and restart namespaces.<br />
<br />
''Variable capture'' can introduce software defects. This happens in one of the following two ways:<br />
<br />
* In the first way, a macro expansion can inadvertently make a symbolic reference which the macro writer assumed will resolve in a global namespace, but the code where the macro is expanded happens to provide a local, shadowing definition which steals that reference. Let this be referred to as type 1 capture.<br />
<br />
* The second way, type 2 capture, is just the opposite: some of the arguments of the macro are pieces of code supplied by the macro caller, and those pieces of code are written such that they make references to surrounding bindings. However, the macro inserts these pieces of code into an expansion which defines its own bindings that accidentally captures some of these references.<br />
<br />
The Scheme dialect of Lisp provides a macro-writing system which provides the referential transparency that eliminates both types of capture problem. This type of macro system is sometimes called "hygienic", in particular by its proponents (who regard macro systems which do not automatically solve this problem as unhygienic). {{Citation needed|date=May 2011}}<br />
<br />
In Common Lisp, macro hygiene is ensured one of two different ways.<br />
<br />
One approach is to use [[gensym]]s: guaranteed-unique symbols which can be used in a macro-expansion without threat of capture. The use of gensyms in a macro definition is a manual chore, but macros can be written which simplify the instantiation and use of gensyms. Gensyms solve type 2 capture easily, but they are not applicable to type 1 capture in the same way, because the macro expansion cannot rename the interfering symbols in the surrounding code which capture its references. Gensyms could be used to provide stable aliases for the global symbols which the macro expansion needs. The macro expansion would use these secret aliases rather than the well-known names, so redefinition of the well-known names would have no ill effect on the macro.<br />
<br />
Another approach is to use packages. A macro defined in its own package can simply use internal symbols in that package in its expansion. The use of packages deals with type 1 and type 2 capture.<br />
<br />
However, packages don't solve the type 1 capture of references to standard Common Lisp functions and operators. The reason is that the use of packages to solve capture problems revolves around the use of private symbols (symbols in one package, which are not imported into, or otherwise made visible in other packages). Whereas the Common Lisp library symbols are external, and frequently imported into or made visible in user-defined packages.<br />
<br />
The following is an example of unwanted capture in the operator namespace, occurring in the expansion of a macro:<br />
<br />
<source lang="lisp"><br />
;; expansion of UNTIL makes liberal use of DO<br />
(defmacro until (expression &body body)<br />
`(do () (,expression) ,@body))<br />
<br />
;; macrolet establishes lexical operator binding for DO<br />
(macrolet ((do (...) ... something else ...))<br />
(until (= (random 10) 0) (write-line "Hello")))<br />
</source><br />
<br />
The <code>until</code> macro will expand into a form which calls <code>do</code> which is intended to refer to the standard Common Lisp macro <code>do</code>. However, in this context, <code>do</code> may have a completely different meaning, so <code>until</code> may not work properly.<br />
<br />
Common Lisp solves the problem of the shadowing of standard operators and functions by forbidding their redefinition. Because it redefines the standard operator <code>do</code>, the preceding is actually a fragment of non-conforming Common Lisp, which allows implementations to diagnose and reject it.<br />
<br />
==Condition system==<br />
The ''condition system'' is responsible for [[exception handling]] in Common Lisp.<ref name="Seibel2005">{{cite book|author=Peter Seibel|title=Practical Common Lisp|url=http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html|date=7 April 2005|publisher=Apress|isbn=978-1-59059-239-7}}</ref> It provides ''conditions'', ''handler''s and ''restart''s. ''Condition''s are objects describing an exceptional situation (for example an error). If a ''condition'' is signaled, the Common Lisp system searches for a ''handler'' for this condition type and calls the handler. The ''handler'' can now search for restarts and use one of these restarts to repair the current problem. As part of a user interface (for example of a debugger), these restarts can also be presented to the user, so that the user can select and invoke one of the available restarts. Since the condition handler is called in the context of the error (without unwinding the stack), full error recovery is possible in many cases, where other exception handling systems would have already terminated the current routine. The debugger itself can also be customized or replaced using the <code>*debugger-hook*</code> dynamic variable.<br />
<br />
In the following example (using [[Symbolics Genera]]) the user tries to open a file in a Lisp function ''test'' called from the Read-Eval-Print-LOOP ([[REPL]]), when the file does not exist. The Lisp system presents four restarts. The user selects the ''Retry OPEN using a different pathname'' restart and enters a different pathname (lispm-init.lisp instead of lispm-int.lisp). The user code does not contain any error handling code. The whole error handling and restart code is provided by the Lisp system, which can handle and repair the error without terminating the user code.<br />
<br />
<source lang="text"><br />
Command: (test ">zippy>lispm-int.lisp")<br />
<br />
Error: The file was not found.<br />
For lispm:>zippy>lispm-int.lisp.newest<br />
<br />
LMFS:OPEN-LOCAL-LMFS-1<br />
Arg 0: #P"lispm:>zippy>lispm-int.lisp.newest"<br />
<br />
s-A, <Resume>: Retry OPEN of lispm:>zippy>lispm-int.lisp.newest<br />
s-B: Retry OPEN using a different pathname<br />
s-C, <Abort>: Return to Lisp Top Level in a TELNET server<br />
s-D: Restart process TELNET terminal<br />
<br />
-> Retry OPEN using a different pathname<br />
Use what pathname instead [default lispm:>zippy>lispm-int.lisp.newest]:<br />
lispm:>zippy>lispm-init.lisp.newest<br />
<br />
...the program continues<br />
</source><br />
<br />
==Common Lisp Object System (CLOS)==<br />
<br />
{{Main|Common Lisp Object System}}<br />
<br />
Common Lisp includes a toolkit for [[object-oriented programming]], the Common Lisp Object System or [[Common Lisp Object System|CLOS]], which is one of the most powerful object systems available in any language. For example, [[Peter Norvig]] explains how many [[Design pattern (computer science)|Design Patterns]] are simpler to implement in a dynamic language with the features of CLOS (Multiple Inheritance, Mixins, Multimethods, Metaclasses, Method combinations, etc.).<ref>[http://norvig.com/design-patterns/ppframe.htm Peter Norvig, Design Patterns in Dynamic Programming]</ref><br />
Several extensions to Common Lisp for object-oriented programming have been proposed to be included into the ANSI Common Lisp standard, but eventually CLOS was adopted as the standard object-system for Common Lisp. CLOS is a [[dynamic programming language|dynamic]] object system with [[multiple dispatch]] and [[multiple inheritance]], and differs radically from the OOP facilities found in static languages such as [[C++]] or [[Java (programming language)|Java]]. As a dynamic object system, CLOS allows changes at runtime to generic functions and classes. Methods can be added and removed, classes can be added and redefined, objects can be updated for class changes and the class of objects can be changed.<br />
<br />
CLOS has been integrated into ANSI Common Lisp. Generic Functions can be used like normal functions and are a first-class data type. Every CLOS class is integrated into the Common Lisp type system. Many Common Lisp types have a corresponding class. There is more potential use of CLOS for Common Lisp. The specification does not say whether conditions are implemented with CLOS. Pathnames and streams could be implemented with CLOS. These further usage possibilities of CLOS for ANSI Common Lisp are not part of the standard. Actual Common Lisp implementations are using CLOS for pathnames, streams, input/output, conditions, the implementation of CLOS itself and more.<br />
<br />
==Compiler and interpreter==<br />
Several implementations of earlier Lisp dialects provided both an interpreter and a compiler. Unfortunately often the semantics were different. These earlier Lisps implemented lexical scoping in the compiler and dynamic scoping in the interpreter. Common Lisp requires that both the interpreter and compiler use lexical scoping by default. The Common Lisp standard describes both the semantics of the interpreter and a compiler. The compiler can be called using the function ''compile'' for individual functions and using the function ''compile-file'' for files. Common Lisp allows type declarations and provides ways to influence the compiler code generation policy. For the latter various optimization qualities can be given values between 0 (not important) and 3 (most important): ''speed'', ''space'', ''safety'', ''debug'' and ''compilation-speed''.<br />
<br />
There is also a function to evaluate Lisp code: ''eval''. ''eval'' takes code as pre-parsed s-expressions and not, like in some other languages, as text strings. This way code can be constructed with the usual Lisp functions for constructing lists and symbols and then this code can be evaluated with ''eval''. Several Common Lisp implementations (like Clozure CL and SBCL) are implementing ''eval'' using their compiler. This way code is compiled, even though it is evaluated using the function ''eval''.<br />
<br />
The file compiler is invoked using the function ''compile-file''. The generated file with compiled code is called a ''fasl'' (from ''fast load'') file. These ''fasl'' files and also source code files can be loaded with the function ''load'' into a running Common Lisp system. Depending on the implementation, the file compiler generates byte-code (for example for the [[Java Virtual Machine]]), [[C (programming language)|C language]] code (which then is compiled with a C compiler) or, directly, native code.<br />
<br />
Common Lisp implementations can be used interactively, even though the code gets fully compiled. The idea of an [[Interpreted language]] thus does not apply for interactive Common Lisp.<br />
<br />
The language makes distinction between read-time, compile-time, load-time and run-time, and allows user code to also make this distinction to perform the wanted type of processing at the wanted step.<br />
<br />
Some special operators are provided to especially suit interactive development; for instance, <code>defvar</code> will only assign a value to its provided variable if it wasn't already bound, while <code>defparameter</code> will always perform the assignment. This distinction is useful when interactively evaluating, compiling and loading code in a live image.<br />
<br />
Some features are also provided to help writing compilers and interpreters. Symbols consist of first-level objects and are directly manipulable by user code. The <code>progv</code> special operator allows to create lexical bindings programmatically, while packages are also manipulable. The Lisp compiler itself is available at runtime to compile files or individual functions. These make it easy to use Lisp as an intermediate compiler or interpreter for another language.<br />
<br />
==Code examples==<br />
<br />
===Birthday paradox===<br />
The following program calculates the smallest number of people in a room for whom the probability of completely unique birthdays is less than 50% (the [[birthday paradox]], where for 1 person the probability is obviously 100%, for 2 it is 364/365, etc.). The Answer is 23.<br />
<br />
<source lang="lisp"><br />
;; By convention, constants in Common Lisp are enclosed with + characters.<br />
(defconstant +year-size+ 365)<br />
<br />
(defun birthday-paradox (probability number-of-people)<br />
(let ((new-probability (* (/ (- +year-size+ number-of-people)<br />
+year-size+)<br />
probability)))<br />
(if (< new-probability 0.5)<br />
(1+ number-of-people)<br />
(birthday-paradox new-probability (1+ number-of-people)))))<br />
</source><br />
<br />
Calling the example function using the [[REPL]] (Read Eval Print Loop):<br />
<source lang="text"><br />
CL-USER > (birthday-paradox 1.0 1)<br />
23<br />
</source><br />
<br />
===Sorting a list of person objects===<br />
<br />
We define a class PERSON and a method for displaying the name and age of a person.<br />
Next we define a group of persons as a list of PERSON objects.<br />
Then we iterate over the sorted list.<br />
<br />
<source lang="lisp"><br />
(defclass person ()<br />
((name :initarg :name :accessor person-name)<br />
(age :initarg :age :accessor person-age))<br />
(:documentation "The class PERSON with slots NAME and AGE."))<br />
<br />
(defmethod display ((object person) stream)<br />
"Displaying a PERSON object to an output stream."<br />
(with-slots (name age) object<br />
(format stream "~a (~a)" name age)))<br />
<br />
(defparameter *group*<br />
(list (make-instance 'person :name "Bob" :age 33)<br />
(make-instance 'person :name "Chris" :age 16)<br />
(make-instance 'person :name "Ash" :age 23))<br />
"A list of PERSON objects.")<br />
<br />
(dolist (person (sort (copy-list *group*)<br />
#'><br />
:key #'person-age))<br />
(display person *standard-output*)<br />
(terpri))<br />
</source><br />
<br />
It prints the three names with descending age.<br />
<source lang="text"><br />
Bob (33)<br />
Ash (23)<br />
Chris (16)<br />
</source><br />
<br />
===Exponentiating by squaring===<br />
<br />
Use of the LOOP macro is demonstrated:<br />
<br />
<source lang="lisp"><br />
(defun power (x n)<br />
(loop with result = 1<br />
while (plusp n)<br />
when (oddp n) do (setf result (* result x))<br />
do (setf x (* x x)<br />
n (truncate n 2))<br />
finally (return result)))<br />
</source><br />
<br />
Example use:<br />
<br />
<source lang="text"><br />
CL-USER > (power 2 200)<br />
1606938044258990275541962092341162602522202993782792835301376<br />
</source><br />
<br />
Compare with the built in exponentiation:<br />
<br />
<source lang="text"><br />
CL-USER > (= (expt 2 200) (power 2 200))<br />
T<br />
</source><br />
<br />
===Find the list of available shells===<br />
<br />
WITH-OPEN-FILE is a macro that opens a file and provides a stream. When the form is returning, the file is automatically closed. FUNCALL calls a function object. The LOOP collects all lines that match the predicate.<br />
<br />
<source lang="lisp"><br />
(defun list-matching-lines (file predicate)<br />
"Returns a list of lines in file, for which the predicate applied to<br />
the line returns T."<br />
(with-open-file (stream file)<br />
(loop for line = (read-line stream nil nil)<br />
while line<br />
when (funcall predicate line)<br />
collect it)))<br />
</source><br />
<br />
The function AVAILABLE-SHELLS calls above function LIST-MATCHING-LINES with a pathname and an anonymous function as the predicate. The predicate returns the pathname of a shell or NIL (if the string is not the filename of a shell).<br />
<br />
<source lang="lisp"><br />
(defun available-shells (&optional (file #p"/etc/shells"))<br />
(list-matching-lines<br />
file<br />
(lambda (line)<br />
(and (plusp (length line))<br />
(char= (char line 0) #\/)<br />
(pathname<br />
(string-right-trim '(#\space #\tab) line))))))<br />
</source><br />
<br />
Example results (on Mac OS X 10.6):<br />
<br />
<source lang="lisp"><br />
CL-USER > (available-shells)<br />
(#P"/bin/bash" #P"/bin/csh" #P"/bin/ksh" #P"/bin/sh" #P"/bin/tcsh" #P"/bin/zsh")<br />
</source><br />
<br />
==Comparison with other Lisps==<br />
<!-- needs lots --><br />
Common Lisp is most frequently compared with, and contrasted to, [[Scheme (programming language)|Scheme]]—if only because they are the two most popular Lisp dialects. Scheme predates CL, and comes not only from the same Lisp tradition but from some of the same engineers—[[Guy L. Steele, Jr.|Guy L. Steele]], with whom [[Gerald Jay Sussman]] designed Scheme, chaired the standards committee for Common Lisp.<br />
<br />
Common Lisp is a general-purpose programming language, in contrast to Lisp variants such as [[Emacs Lisp]] and [[AutoLISP]] which are [[extension languages]] embedded in particular products. Unlike many earlier Lisps, Common Lisp (like [[Scheme (programming language)|Scheme]]) uses lexical variable [[scope (programming)|scope]] by default for both interpreted and compiled code.<br />
<br />
Most of the Lisp systems whose designs contributed to Common Lisp—such as [[ZetaLisp]] and Franz Lisp—used dynamically [[scope (programming)|scoped]] variables in their interpreters and lexically scoped variables in their compilers. Scheme introduced the sole use of lexically scoped variables to Lisp; an inspiration from [[ALGOL 68]] which was widely recognized as a good idea. CL supports dynamically scoped variables as well, but they must be explicitly declared as "special". There are no differences in scoping between ANSI CL interpreters and compilers.<br />
<br />
Common Lisp is sometimes termed a ''Lisp-2'' and Scheme a ''Lisp-1'', referring to CL's use of separate namespaces for functions and variables. (In fact, CL has ''many'' namespaces, such as those for go tags, block names, and <code>loop</code> keywords). There is a long-standing controversy between CL and Scheme advocates over the tradeoffs involved in multiple namespaces. In Scheme, it is (broadly) necessary to avoid giving variables names which clash with functions; Scheme functions frequently have arguments named <code>lis</code>, <code>lst</code>, or <code>lyst</code> so as not to conflict with the system function <code>list</code>. However, in CL it is necessary to explicitly refer to the function namespace when passing a function as an argument—which is also a common occurrence, as in the <code>sort</code> example above.<br />
<br />
CL also differs from Scheme in its handling of boolean values. Scheme uses the special values #t and #f to represent truth and falsity. CL follows the older Lisp convention of using the symbols T and NIL, with NIL standing also for the empty list. In CL, ''any'' non-NIL value is treated as true by conditionals, such as <code>if</code>, whereas in Scheme all non-#f values are treated as true. These conventions allow some operators in both languages to serve both as predicates (answering a boolean-valued question) and as returning a useful value for further computation, but in Scheme the value '() which is equivalent to NIL in Common Lisp evaluates to true in a boolean expression.<br />
<br />
Lastly, the Scheme standards documents require [[tail recursion|tail-call optimization]], which the CL standard does not. Most CL implementations do offer tail-call optimization, although often only when the programmer uses an optimization directive. Nonetheless, common CL coding style does not favor the ubiquitous use of recursion that Scheme style prefers—what a Scheme programmer would express with tail recursion, a CL user would usually express with an iterative expression in <code>do</code>, <code>dolist</code>, <code>loop</code>, or (more recently) with the <code>iterate</code> package.<br />
<br />
==Implementations==<br />
<br />
See the Category [[:Category:Common Lisp implementations|Common Lisp implementations]].<br />
<br />
Common Lisp is defined by a specification (like [[Ada (programming language)|Ada]] and [[C (programming language)|C]]) rather than by one implementation (like [[Perl]] before version 6). There are many implementations, and the standard details areas in which they may validly differ.<br />
<br />
In addition, implementations tend to come with library packages, which provide functionality not covered in the standard. [[Free and open source software]] libraries have been created to support such features in a portable way, and are most notably found in the repositories of the [http://common-lisp.net/ Common-Lisp.net] and [http://clocc.sourceforge.net/ Common Lisp Open Code Collection] projects.<br />
<br />
Common Lisp implementations may use any mix of native code compilation, byte code compilation or interpretation. Common Lisp has been designed to support [[incremental compiler]]s, file compilers and block compilers. Standard declarations to optimize compilation (such as function inlining or type specialization) are proposed in the language specification. Most Common Lisp implementations compile source code to native [[machine code]]. Some implementations can create (optimized) stand-alone applications. Others compile to interpreted [[bytecode]], which is less efficient than native code, but eases binary-code portability. There are also compilers that compile Common Lisp code to C code. The misconception that Lisp is a purely interpreted language is most likely because Lisp environments provide an interactive prompt and that code is compiled one-by-one, in an incremental way. With Common Lisp incremental compilation is widely used.<br />
<br />
Some [[Unix]]-based implementations ([[CLISP]], [[SBCL]]) can be used as a [[scripting language]]; that is, invoked by the system transparently in the way that a [[Perl]] or [[Unix shell]] interpreter is.<ref>[http://clisp.cons.org/impnotes/quickstart.html#quickstart-unix CLISP as a scripting language under Unix]</ref><br />
<br />
===List of implementations===<br />
<br />
====Commercial implementations====<br />
<br />
; [[Allegro Common Lisp]]: for Microsoft Windows, FreeBSD, Linux, Apple Mac OS X and various UNIX variants. Allegro CL provides an [[integrated development environment|Integrated Development Environment (IDE)]] (for Windows and Linux) and extensive capabilities for application delivery.<br />
; [[Liquid Common Lisp]]: formerly called [[Lucid Common Lisp]]. Only maintenance, no new releases.<br />
; [[LispWorks]]: for Microsoft Windows, FreeBSD, Linux, Apple Mac OS X and various UNIX variants. LispWorks provides an [[integrated development environment|Integrated Development Environment (IDE)]] (available for all platforms) and extensive capabilities for application delivery.<br />
; [[mocl]]: for iOS, Android and Mac OS X.<br />
; [[Open Genera]]: for DEC Alpha.<br />
; [[Scieneer Common Lisp]]: which is designed for high-performance scientific computing.<br />
<br />
====Freely redistributable implementations====<br />
<br />
; Armed Bear Common Lisp (ABCL) : A CL implementation that runs on the [[Java Virtual Machine]].<ref>{{cite web | url = http://common-lisp.net/project/armedbear/ | title = Armed Bear Common Lisp }}</ref> It includes a compiler to [[Java byte code]], and allows access to Java libraries from CL. It was formerly just a component of the [[Armed Bear J Editor]].<br />
; [[CLISP]]: A bytecode-compiling implementation, portable and runs on a number of Unix and Unix-like systems (including [[Mac OS X]]), as well as Microsoft Windows and several other systems.<br />
; [[Clozure CL]] (CCL) : Originally a [[free and open source software|free and open source]] fork of Macintosh Common Lisp. As that history implies, CCL was written for the Macintosh, but Clozure CL now runs on [[Mac OS X]], [[FreeBSD]], [[Linux]], [[Solaris (operating system)|Solaris]] and [[Microsoft Windows|Windows]]. 32 and 64 bit [[x86]] ports are supported on each platform. Additionally there are Power PC ports for Mac OS and Linux. CCL was previously known as OpenMCL, but that name is no longer used, to avoid confusion with the open source version of Macintosh Common Lisp.<br />
; [[CMUCL]]: Originally from [[Carnegie Mellon University]], now maintained as [[free and open source software]] by a group of volunteers. CMUCL uses a fast native-code compiler. It is available on [[Linux]] and [[Berkeley Software Distribution|BSD]] for Intel x86; [[Linux]] for Alpha; [[Mac OS X]] for Intel x86 and PowerPC; and Solaris, IRIX, and HP-UX on their native platforms.<br />
; [[Corman Common Lisp]]: for Microsoft Windows. In January 2015 Corman Lisp has been published under MIT license.<ref>{{cite web|title=Corman Lisp sources are now available|url=http://lispblog.xach.com/post/107215169193/corman-lisp-sources-are-now-available}}</ref><br />
; [[Embeddable Common Lisp]] (ECL) : ECL includes a bytecode interpreter and compiler. It can also compile Lisp code to machine code via a C compiler. ECL then compiles Lisp code to C, compiles the C code with a C compiler and can then load the resulting machine code. It is also possible to embed ECL in [[C (programming language)|C]] programs, and C code into Common Lisp programs.<br />
; [[GNU Common Lisp]] (GCL) : The [[GNU]] Project's Lisp compiler. Not yet fully ANSI-compliant, GCL is however the implementation of choice for several large projects including the mathematical tools [[Maxima (software)|Maxima]], [[Axiom (computer algebra system)|AXIOM]] and (historically) [[ACL2]]. GCL runs on [[Linux]] under eleven different architectures, and also under Windows, Solaris, and [[FreeBSD]].<br />
; [[Macintosh Common Lisp]] (MCL) : Version 5.2 for Apple Macintosh computers with a PowerPC processor running Mac OS X is open source. RMCL (based on MCL 5.2) runs on Intel-based Apple Macintosh computers using the Rosetta binary translator from Apple.<br />
; [[ManKai Common Lisp]] (MKCL) : A branch of [[Embeddable Common Lisp|ECL]]. MKCL emphasises reliability, stability and overall code quality through a heavily reworked, natively multi-threaded, runtime system. On Linux, MKCL features a fully POSIX compliant runtime system.<br />
; [[Movitz]]: Implements a Lisp environment for [[x86]] computers without relying on any underlying OS.<br />
; [[Poplog]]: Poplog implements a version of CL, with [[POP-11]], and optionally [[Prolog]], and [[Standard ML]] (SML), allowing mixed language programming. For all, the implementation language is POP-11, which is compiled incrementally. It also has an integrated [[Emacs]]-like editor that communicates with the compiler.<br />
; [[Steel Bank Common Lisp]] (SBCL) : A branch from [[CMUCL]]. "Broadly speaking, SBCL is distinguished from CMU CL by a greater emphasis on maintainability."<ref>{{cite web<br />
| url = http://sbcl.sourceforge.net/history.html<br />
| title = History and Copyright | work = Steel Bank Common Lisp<br />
}}</ref> SBCL runs on the platforms CMUCL does, except HP/UX; in addition, it runs on Linux for AMD64, PowerPC, SPARC, MIPS, Windows x86<ref>{{cite web<br />
| url = http://www.sbcl.org/platform-table.html<br />
| title = Platform Table | work = Steel Bank Common Lisp<br />
}}</ref> and has experimental support for running on Windows AMD64. SBCL does not use an interpreter by default; all expressions are compiled to native code unless the user switches the interpreter on. The SBCL compiler generates fast native code.<ref>[http://benchmarksgame.alioth.debian.org/u32q/benchmark.php?test=all&lang=all SBCL ranks above other dynamic language implementations in the 'Computer Language Benchmark Game']</ref><br />
; [[Ufasoft Common Lisp]]: port of CLISP for windows platform with core written in C++.<br />
<br />
====Other implementations====<br />
{{unreferenced section|date=July 2013}}<br />
; Austin Kyoto Common Lisp : an evolution of [[Kyoto Common Lisp]]<br />
; Butterfly Common Lisp : an implementation written in Scheme for the [[BBN Butterfly]] multi-processor computer<br />
; CLICC : a Common Lisp to C compiler<br />
; CLOE : Common Lisp for PCs by [[Symbolics]]<br />
; Codemist Common Lisp : used for the commercial version of the computer algebra system Axiom<br />
; ExperCommon Lisp : an early implementation for the Apple Macintosh by ExperTelligence<br />
; [[Golden Common Lisp]]: an implementation for the PC by GoldHill Inc.<br />
; Ibuki Common Lisp : a commercialized version of Kyoto Common Lisp<br />
; [[Kyoto Common Lisp]]: the first Common Lisp compiler that used C as a target language. GCL, ECL and MKCL originate from this Common Lisp implementation.<br />
; L : a small version of Common Lisp for embedded systems developed by IS Robotics, now iRobot<br />
; [[Lisp Machine]]s (from [[Symbolics]], TI and Xerox): provided implementations of Common Lisp in addition to their native Lisp dialect (Lisp Machine Lisp or Interlisp). CLOS was also available. Symbolics provides a version of Common Lisp that is based on ANSI Common Lisp.<br />
; Procyon Common Lisp : an implementation for Windows and Mac OS, used by Franz for their Windows port of Allegro CL<br />
; Star Sapphire Common LISP : an implementation for the PC<br />
; [[SubL]]: a variant of Common Lisp used for the implementation of the [[Cyc]] knowledge-based system<br />
; Top Level Common Lisp : an early implementation for concurrent execution<br />
; WCL : a shared library implementation<br />
; [[Vax Common Lisp]]: [[Digital Equipment Corporation]]'s implementation that ran on [[VAX]] systems running [[OpenVMS|VMS]] or [[ULTRIX]]<br />
; [[XLISP]] by David Betz<br />
<br />
==Applications==<br />
See the Category [[:Category:Common Lisp software|Common Lisp software]].<br />
<br />
Common Lisp is used to develop research applications (often in Artificial Intelligence), for rapid development of prototypes or for deployed applications.<br />
<br />
Common Lisp is used in many commercial applications, including the [[Yahoo!]] Store web-commerce site, which originally involved [[Paul Graham (computer programmer)|Paul Graham]] and was later rewritten in C++ and Perl.<ref name="doubt-not-corporate-foolishness">"In January 2003, Yahoo released a new version of the editor written in C++ and Perl. It's hard to say whether the program is no longer written in Lisp, though, because to translate this program into C++ they literally had to write a Lisp interpreter: the source files of all the page-generating templates are still, as far as I know, Lisp code." [[Paul Graham (computer programmer)|Paul Graham]], [http://www.paulgraham.com/avg.html Beating the Averages]</ref> Other notable examples include:<br />
<br />
* [[ACT-R]], a cognitive architecture used in a large number of research projects.<br />
* Authorizer's Assistant,<ref>[http://www.aaai.org/Papers/IAAI/1989/IAAI89-031.pdf Authorizer's Assistant]</ref><ref>[http://www.prenhall.com/divisions/bp/app/alter/student/useful/ch9amex.html American Express Authorizer's Assistant]</ref> a large rule-based system used by American Express, analyzing credit requests.<br />
* [[Cyc]], a long running project with the aim to create a knowledge-based system that provides a huge amount of common sense knowledge<br />
* The [[Dynamic Analysis and Replanning Tool]] (DART), which is said to alone have paid back during the years from 1991 to 1995 for all thirty years of [[DARPA]] investments in AI research.<br />
* G2 from Gensym, a real-time business rules engine (BRE)<ref>[http://www.gensym.com/index.php?option=com_content&view=article&id=47&Itemid=54 Real-time Application Development]. Gensym. Retrieved on 2013-07-17.</ref><br />
* [http://www.genworks.com Genworks GDL], based on the open-source [http://github.com/genworks/gendl Gendl] kernel.<br />
* The development environment for the [[Jak and Daxter]] video game series, developed by [[Naughty Dog]].<br />
* [[ITA Software]]'s low fare search engine, used by travel websites such as [[Orbitz]] and [[Kayak.com]] and airlines such as [[American Airlines]], [[Continental Airlines]] and [[US Airways]].<br />
* [[Mirai (software)|Mirai]], a 3d graphics suite. It was used to animate the face of Gollum in the movie Lord of the Rings: The Two Towers.<br />
* [[Prototype Verification System]] (PVS), a mechanized environment for formal specification and verification.<br />
* PWGL is a sophisticated visual programming environment based on Common Lisp, used in [[Computer assisted composition]] and sound synthesis.<ref>[http://www2.siba.fi/PWGL/ PWGL - Home]. . Retrieved on 2013-07-17.</ref> <br />
* SPIKE, a scheduling system for earth or space based observatories and satellites, notably the Hubble Space Telescope.<ref>[http://www.stsci.edu/resources/software_hardware/spike/ Spike Planning and Scheduling System]. Stsci.edu. Retrieved on 2013-07-17.</ref><br />
<br />
There also exist open-source applications written in Common Lisp, such as:<br />
<br />
* [[ACL2]], a full-featured [[automated theorem prover]] for an [[applicative programming language|applicative]] variant of Common Lisp.<br />
* [[Axiom (computer algebra system)|Axiom]], a sophisticated [[computer algebra system]].<br />
* [[Maxima (software)|Maxima]], a sophisticated [[computer algebra system]].<br />
* [[OpenMusic]] is an object-oriented visual programming environment based on Common Lisp, used in [[Computer assisted composition]].<br />
* [[Stumpwm]], a tiling, keyboard driven X11 Window Manager written entirely in Common Lisp.<br />
<br />
==Libraries==<br />
<br />
Since 2011 Zach Beane, with support of the Common Lisp Foundation, maintains the [[Quicklisp]] library manager. It allows easy access to several hundred libraries written in Common Lisp.<br />
<br />
==See also==<br />
{{Portal|Computer Science|Computer programming}}<br />
*''[[Common Lisp the Language]]''<br />
*''[[On Lisp]]''<br />
*''[[Practical Common Lisp]]''<br />
{{Clear}}<br />
<br />
==References==<br />
{{Reflist|2}}<br />
<br />
==Bibliography==<br />
A chronological list of books published (or about to be published) about Common Lisp (the language) or about programming with Common Lisp (especially AI programming).<br />
{{Refbegin|2}}<br />
* [[Guy L. Steele]]: ''Common Lisp the Language, 1st Edition'', Digital Press, 1984, ISBN 0-932376-41-X<br />
* [[Rodney Allen Brooks]]: ''Programming in Common Lisp'', John Wiley and Sons Inc, 1985, ISBN 0-471-81888-7<br />
* [[Richard P. Gabriel]]: ''Performance and Evaluation of Lisp Systems'', The MIT Press, 1985, ISBN 0-262-57193-5, [http://www.dreamsongs.com/Files/Timrep.pdf PDF]<br />
* [[Robert Wilensky]]: ''Common LISPcraft'', W.W. Norton & Co., 1986, ISBN 0-393-95544-3<br />
* [[Eugene Charniak]], [[Christopher K. Riesbeck]], [[Drew V. McDermott]], [[James R. Meehan]]: ''Artificial Intelligence Programming, 2nd Edition'', Lawrence Erlbaum, 1987, ISBN 0-89859-609-2<br />
* [[Wendy L. Milner]]: ''Common Lisp: A Tutorial'', Prentice Hall, 1987, ISBN 0-13-152844-0<br />
* [[Deborah G. Tatar]]: ''A Programmer's Guide to Common Lisp'', Longman Higher Education, 1987, ISBN 0-13-728940-5<br />
* [[Taiichi Yuasa]], [[Masami Hagiya]]: ''Introduction to Common Lisp'', Elsevier Ltd, 1987, ISBN 0-12-774860-1<br />
* [[Christian Queinnec]], [[Jerome Chailloux]]: ''Lisp Evolution and Standardization'', Ios Pr Inc., 1988, ISBN 90-5199-008-1<br />
* [[Taiichi Yuasa]], [[Richard Weyhrauch]], [[Yasuko Kitajima]]: ''Common Lisp Drill'', Academic Press Inc, 1988, ISBN 0-12-774861-X<br />
* [[Wade L. Hennessey]]: ''Common Lisp'', McGraw-Hill Inc., 1989, ISBN 0-07-028177-7<br />
* [[Tony Hasemer]], [[John Dominque]]: ''Common Lisp Programming for Artificial Intelligence'', Addison-Wesley Educational Publishers Inc, 1989, ISBN 0-201-17579-7<br />
* [[Sonya E. Keene]]: ''Object-Oriented Programming in Common Lisp: A Programmer's Guide to CLOS'', Addison-Wesley, 1989, ISBN 0-201-17589-4<br />
* [[David Jay Steele]]: ''Golden Common Lisp: A Hands-On Approach'', Addison Wesley, 1989, ISBN 0-201-41653-0<br />
* [[David S. Touretzky]]: ''Common Lisp: A Gentle Introduction to Symbolic Computation'', Benjamin-Cummings, 1989, ISBN 0-8053-0492-4. [http://www.cs.cmu.edu/~dst/LispBook/ Web/PDF] Dover reprint (2013) ISBN 978-0486498201<br />
* [[Christopher K. Riesbeck]], [[Roger C. Schank]]: ''Inside Case-Based Reasoning'', Lawrence Erlbaum, 1989, ISBN 0-89859-767-6<br />
* [[Patrick Winston]], [[Berthold Horn]]: ''Lisp, 3rd Edition'', Addison-Wesley, 1989, ISBN 0-201-08319-1, [http://people.csail.mit.edu/phw/Books/LISPBACK.HTML Web]<br />
* [[Gerard Gazdar]], [[Chris Mellish]]: ''Natural Language Processing in LISP: An Introduction to Computational Linguistics'', Addison-Wesley Longman Publishing Co., 1990, ISBN 0-201-17825-7<br />
* [[Patrick R. Harrison]]: ''Common Lisp and Artificial Intelligence'', Prentice Hall PTR, 1990, ISBN 0-13-155243-0<br />
* [[Timothy Koschmann]]: ''The Common Lisp Companion'', John Wiley & Sons, 1990, ISBN 0-471-50308-8<br />
* [[Molly M. Miller]], [[Eric Benson]]: ''Lisp Style & Design'', Digital Press, 1990, ISBN 1-55558-044-0<br />
* [[Guy L. Steele]]: ''[[Common Lisp the Language]], 2nd Edition'', Digital Press, 1990, ISBN 1-55558-041-6, [http://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html Web]<br />
* [[Steven L. Tanimoto]]: ''The Elements of Artificial Intelligence Using Common Lisp'', Computer Science Press, 1990, ISBN 0-7167-8230-8<br />
* [[Peter Lee (computer scientist)|Peter Lee]]: ''Topics in Advanced Language Implementation'', The MIT Press, 1991, ISBN 0-262-12151-4<br />
* [[John H. Riley]]: ''A Common Lisp Workbook'', Prentice Hall, 1991, ISBN 0-13-155797-1<br />
* [[Peter Norvig]]: ''Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp'', Morgan Kaufmann, 1991, ISBN 1-55860-191-0, [http://norvig.com/paip.html Web]<br />
* [[Gregor Kiczales]], [[Jim des Rivieres]], [[Daniel G. Bobrow]]: ''The Art of the Metaobject Protocol'', The MIT Press, 1991, ISBN 0-262-61074-4<br />
* [[Jo A. Lawless]], [[Molly M. Miller]]: ''Understanding CLOS: The Common Lisp Object System'', Digital Press, 1991, ISBN 0-13-717232-X<br />
* Mark Watson: ''Common Lisp Modules: Artificial Intelligence in the Era of Neural Networks and Chaos Theory'', Springer Verlag New York Inc., 1991, ISBN 0-387-97614-0<br />
* [[James L. Noyes]]: ''Artificial Intelligence with Common Lisp: Fundamentals of Symbolic and Numeric Processing'', Jones & Bartlett Pub, 1992, ISBN 0-669-19473-5<br />
* [[Stuart C. Shapiro]]: ''COMMON LISP: An Interactive Approach'', Computer Science Press, 1992, ISBN 0-7167-8218-9, [http://www.cse.buffalo.edu/pub/WWW/faculty/shapiro/Commonlisp/ Web/PDF]<br />
* [[Kenneth D. Forbus]], [[Johan de Kleer]]: ''Building Problem Solvers'', The MIT Press, 1993, ISBN 0-262-06157-0<br />
* [[Andreas Paepcke]]: ''Object-Oriented Programming: The CLOS Perspective'', The MIT Press, 1993, ISBN 0-262-16136-2<br />
* [[Paul Graham (computer programmer)|Paul Graham]]: ''[[On Lisp]]'', Prentice Hall, 1993, ISBN 0-13-030552-9, [http://www.paulgraham.com/onlisp.html Web/PDF]<br />
* [[Paul Graham (computer programmer)|Paul Graham]]: ''ANSI Common Lisp'', Prentice Hall, 1995, ISBN 0-13-370875-6<br />
* [[Otto Mayer]]: ''Programmieren in Common Lisp'', German, Spektrum Akademischer Verlag, 1995, ISBN 3-86025-710-2<br />
* [[Stephen Slade]]: ''Object-Oriented Common Lisp'', Prentice Hall, 1997, ISBN 0-13-605940-6<br />
* [[Richard P. Gabriel]]: ''Patterns of Software: Tales from the Software Community'', Oxford University Press, 1998, ISBN 0-19-512123-6, [http://www.dreamsongs.org/Files/PatternsOfSoftware.pdf PDF]<br />
* [[Taiichi Yuasa]], [[Hiroshi G. Okuno]]: ''Advanced Lisp Technology'', CRC, 2002, ISBN 0-415-29819-9<br />
* [[David B. Lamkins]]: ''Successful Lisp: How to Understand and Use Common Lisp'', bookfix.com, 2004. ISBN 3-937526-00-5, [http://www.psg.com/~dlamkins/sl/contents.html Web]<br />
* [[Peter Seibel]]: ''[[Practical Common Lisp]]'', Apress, 2005. ISBN 1-59059-239-5, [http://www.gigamonkeys.com/book/ Web]<br />
* [[Doug Hoyte]]: ''Let Over Lambda'', Lulu.com, 2008, ISBN 1-4357-1275-7, [http://letoverlambda.com/ Web]<br />
* [[George F. Luger]], [[William A. Stubblefield]]: ''AI Algorithms, Data Structures, and Idioms in Prolog, Lisp and Java'', Addison Wesley, 2008, ISBN 0-13-607047-7, [http://wps.aw.com/wps/media/objects/5771/5909832/PDF/Luger_0136070477_1.pdf PDF]<br />
* [[Conrad Barski]]: ''Land of Lisp: Learn to program in Lisp, one game at a time!'', No Starch Press, 2010, ISBN 1-59327-200-6, [http://www.lisperati.com/landoflisp/ Web]<br />
* [[Pavel Penev]]: ''Lisp Web Tales'', Leanpub, 2013, [https://leanpub.com/lispwebtales Web]<br />
{{Refend}}<br />
<br />
==External links==<br />
{{Wikibooks}}<br />
* The [http://www.cliki.net/ CLiki], a Wiki for [[free and open source software|free and open source]] Common Lisp systems running on Unix-like systems.<br />
* [http://www.common-lisp.net/ Common Lisp software repository].<br />
* {{cite web | url = http://www.lispworks.com/documentation/HyperSpec/Body/01_ab.htm | title = History | work = [[Common Lisp HyperSpec]] }}<br />
* [http://www.flownet.com/gat/jpl-lisp.html Lisping at JPL]<br />
* [http://www.defmacro.org/ramblings/lisp.html The Nature of Lisp] Essay that examines Lisp by comparison with XML.<br />
* [http://common-lisp.net/~dlw/LispSurvey.html Common Lisp Implementations: A Survey] Survey of maintained Common Lisp implementations.<br />
* [http://clqr.boundp.org Common Lisp Quick Reference]<br />
* [http://planet.lisp.org Planet Lisp] Articles about Common Lisp.<br />
<br />
{{Common Lisp}}<br />
<br />
[[Category:Common Lisp]]<br />
[[Category:Multi-paradigm programming languages]]<br />
[[Category:Functional languages]]<br />
[[Category:Dynamically typed programming languages]]<br />
[[Category:Dynamic programming languages]]<br />
[[Category:Object-oriented programming languages]]<br />
[[Category:Class-based programming languages]]<br />
[[Category:Procedural programming languages]]<br />
[[Category:Extensible syntax programming languages]]<br />
[[Category:Lisp programming language family]]<br />
[[Category:Lisp (programming language)]]<br />
[[Category:Articles with example Lisp code]]<br />
[[Category:Cross-platform software]]<br />
[[Category:Cross-platform free software]]<br />
[[Category:Programming languages created in 1984]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Common_Lisp&diff=689832526Common Lisp2015-11-09T17:57:46Z<p>PuercoPop: downcase code throughout the article</p>
<hr />
<div>{{Infobox programming language<br />
| name = Common Lisp<br />
| family = [[Lisp (programming language)|Lisp]]<br />
| paradigm = [[Multi-paradigm programming language|Multi-paradigm]]: [[procedural programming|procedural]], [[functional programming|functional]], [[object-oriented programming|object-oriented]], [[metaprogramming|meta]], [[reflective programming|reflective]], [[generic programming|generic]]<br />
| generation = [[3GL]]<br />
| released = 1984, 1994 for ANSI Common Lisp<br />
| designer = [[Scott Fahlman]], [[Richard P. Gabriel]], [[Dave Moon]], [[Guy Steele]], [[Dan Weinreb]]<br />
| developer = ANSI [[X3J13]] committee<br />
| standard reference = [[Common Lisp HyperSpec]]<br />
| latest release version =<br />
| latest release date =<br />
| typing = [[Dynamic typing|dynamic]], [[Strongly-typed programming language|strong]]<br />
| scope = lexical, optionally dynamic<br />
| namespace style = Lisp-2<br />
| implementations = [[Allegro Common Lisp|Allegro CL]], [[Armed Bear Common Lisp|ABCL]], [[CLISP]], [[Clozure CL]], [[CMUCL]], [[Embeddable Common Lisp|ECL]], [[GNU Common Lisp|GCL]], [[LispWorks]], [[Scieneer Common Lisp|Scieneer CL]], [[SBCL]], [[Genera (operating system)|Symbolics Common Lisp]]<br />
| dialects = CLtL1, CLtL2, ANSI Common Lisp<br />
| influenced_by = [[Lisp (programming language)|Lisp]], [[Lisp Machine Lisp]], [[Maclisp]], [[Scheme (programming language)|Scheme]], [[Interlisp]]<br />
| influenced = [[Clojure]], [[Dylan (programming language)|Dylan]], [[Emacs Lisp]], [[EuLisp]], [[ISLISP]], [[Julia (programming language)|Julia]], [[Moose (Perl)|Moose]], [[R (programming language)|R]], [[Cadence SKILL|SKILL]], [[SubL]]<br />
| operating_system = [[Cross-platform]]<br />
| license =<br />
| website = {{URL|http://common-lisp.net/}}<br />
| file_ext = .lisp, .lsp, .l, .cl, .fasl<br />
}}<br />
<br />
'''Common Lisp''' ('''CL''') is a dialect of the [[Lisp (programming language)|Lisp]] [[programming language]], published in [[American National Standards Institute|ANSI]] standard document ''ANSI INCITS 226-1994 (R2004)'' (formerly ''X3.226-1994 (R1999)'').<ref>Quoted from cover of cited standard. ANSI INCITS 226-1994 (R2004), for sale on standard's [http://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+INCITS+226-1994+(R2004) document page].</ref> From the ANSI Common Lisp standard the [[Common Lisp HyperSpec]], a hyperlinked HTML version, has been derived.<ref>[http://www.lispworks.com/documentation/HyperSpec/Front/Help.htm#Authorship Authorship of the Common Lisp HyperSpec]</ref><br />
<br />
The Common Lisp language was developed as a standardized and improved successor of [[Maclisp]]. Thus it is not an implementation, but rather a language [[specification]].<ref>[http://www.lispworks.com/documentation/HyperSpec/Body/01_ab.htm Common Lisp HyperSpec 1.1.2 History]</ref> Several [[#Implementations|implementations]] of the Common Lisp standard are available, including [[free and open source software]] and proprietary products.<ref>[http://common-lisp.net/~dlw/LispSurvey.html Common Lisp Implementations: A Survey]</ref><br />
<br />
The first language documentation was published 1984 as [[Common Lisp the Language]], first edition. A second edition, published in 1990, incorporated many changes to the language, made during the ANSI Common Lisp standardization process. The final ANSI Common Lisp standard then was published in 1994. Since then no update to the standard has been published. Various extensions and improvements to Common Lisp (examples are Unicode, Concurrency, CLOS-based IO) have been provided by implementations.<br />
<br />
Common Lisp is a general-purpose, [[multi-paradigm programming language]]. It supports a combination of [[procedural programming|procedural]], [[functional programming|functional]], and [[object-oriented programming]] paradigms. As a [[dynamic programming language]], it facilitates evolutionary and [[Iterative and incremental development|incremental software development]], with iterative [[Compiler|compilation]] into efficient run-time programs. This incremental development is often done interactively without interrupting the running application.<br />
<br />
It also supports optional type annotation and casting, which can be added as necessary at the later profiling and optimization stages, to permit the compiler to generate more efficient code. For instance, <code>fixnum</code> can hold an [[Boxing (computer science)|unboxed]] integer in a range supported by the hardware and implementation, permitting more efficient arithmetic than on big integers or arbitrary precision types. Similarly, the compiler can be told on a per-module or per-function basis which type safety level is wanted, using ''optimize'' declarations.<br />
<br />
Common Lisp includes [[Common Lisp Object System|CLOS]], an [[object system]] that supports [[multimethods]] and method combinations. It is often implemented with a [[Metaobject]] Protocol.<br />
<br />
Common Lisp is extensible through standard features such as Lisp [[Macro (computer science)|macros]] (code transformations) and reader macros (input parsers for characters).<br />
<br />
Common Lisp provides some backwards compatibility to [[Maclisp]] and to John McCarthy's original [[Lisp (programming language)|Lisp]]. This allows older Lisp software to be ported to Common Lisp.<ref>{{cite web<br />
| url = http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/wang.html<br />
| title = Old LISP programs still run in Common Lisp | accessdate = 2015-05-13<br />
}}</ref><br />
<br />
==Syntax==<br />
<br />
Common Lisp is a dialect of Lisp; it uses [[S-expression]]s to denote both code and data structure. Function calls, macro forms and special forms are written as lists, with the name of the function first, as in these examples:<br />
<br />
<source lang="lisp"><br />
(+ 2 2) ; adds 2 and 2, yielding 4. The function's name is '+'. Lisp has no operators as such.<br />
</source><br />
<source lang="lisp"><br />
(defvar *x*) ; Ensures that a variable *x* exists,<br />
; without giving it a value. The asterisks are part of<br />
; the name, by convention denoting a special (global) variable. <br />
; The symbol *x* is also hereby endowed with the property that<br />
; subsequent bindings of it are dynamic, rather than lexical.<br />
(setf *x* 42.1) ; sets the variable *x* to the floating-point value 42.1<br />
</source><br />
<source lang="lisp"><br />
;; Define a function that squares a number:<br />
(defun square (x)<br />
(* x x))<br />
</source><br />
<source lang="lisp"><br />
;; Execute the function:<br />
(square 3) ; Returns 9<br />
</source><br />
<!-- I truncated this a bit; in smaller browsers, it runs off the side--><br />
<source lang="lisp"><br />
;; the 'let' construct creates a scope for local variables. Here<br />
;; the variable 'a' is bound to 6 and the variable 'b' is bound<br />
;; to 4. Inside the 'let' is a 'body', where the last computed value is returned.<br />
;; Here the result of adding a and b is returned from the 'let' expression.<br />
;; The variables a and b have lexical scope, unless the symbols have been<br />
;; marked as special variables (for instance by a prior DEFVAR).<br />
(let ((a 6)<br />
(b 4))<br />
(+ a b)) ; returns 10<br />
</source><br />
<br />
==Data types==<br />
Common Lisp has many data types.<br />
<br />
===Scalar types===<br />
''Number'' types include [[integer]]s, [[ratio]]s, [[Floating point|floating-point number]]s, and [[complex number]]s.<ref name="reddy">{{cite web<br />
| url = http://random-state.net/features-of-common-lisp.html<br />
| title = Features of Common Lisp<br />
| first = Abhishek | last = Reddy<br />
| date = 2008-08-22<br />
}}</ref> Common Lisp uses [[Arbitrary-precision arithmetic|bignum]]s to represent numerical values of arbitrary size and precision. The ratio type represents fractions exactly, a facility not available in many languages. Common Lisp automatically coerces numeric values among these types as appropriate.<br />
<br />
The Common Lisp ''[[character (computing)|character]]'' type is not limited to [[ASCII]] characters. Most modern implementations allow [[Unicode]] characters.<ref>{{cite web<br />
| url = http://www.cliki.net/Unicode%20Support<br />
| title = Unicode support | work = The Common Lisp Wiki | accessdate = 2008-08-21<br />
}}</ref><br />
<br />
The ''[[Symbol (programming)|symbol]]'' type is common to Lisp languages, but largely unknown outside them. A symbol is a unique, named data object with several parts: name, value, function, property list and package. Of these, ''value cell'' and ''function cell'' are the most important. Symbols in Lisp are often used similarly to identifiers in other languages: to hold the value of a variable; however there are many other uses. Normally, when a symbol is evaluated, its value is returned. Some symbols evaluate to themselves, for example all symbols in the keyword package are self-evaluating. Boolean values in Common Lisp are represented by the self-evaluating symbols T and NIL. Common Lisp has namespaces for symbols, called 'packages'.<br />
<br />
A number of functions are available for [[rounding]] scalar numeric values in various ways. The function <code>round</code> rounds the argument to the nearest integer, with halfway cases rounded to the even integer. The functions <code>truncate</code>, <code>floor</code>, and <code>ceiling</code> round towards zero, down, or up respectively. All these functions return the discarded fractional part as a secondary value. For example, <code>(floor -2.5)</code> yields -3, 0.5; <code>(ceiling -2.5)</code> yields -2, -0.5; <code>(round 2.5)</code> yields 2, 0.5; and <code>(round 3.5)</code> yields 4, -0.5.<br />
<br />
===Data structures===<br />
''Sequence'' types in Common Lisp include lists, vectors, bit-vectors, and strings. There are many operations which can work on any sequence type.<br />
<br />
As in almost all other Lisp dialects, ''lists'' in Common Lisp are composed of ''conses'', sometimes called ''cons cells'' or ''pairs''. A cons is a data structure with two slots, called its ''car'' and ''cdr''. A list is a linked chain of conses or the empty list. Each cons's car refers to a member of the list (possibly another list). Each cons's cdr refers to the next cons—except for the last cons in a list, whose cdr refers to the <code>nil</code> value. Conses can also easily be used to implement trees and other complex data structures; though it is usually advised to use structure or class instances instead. It is also possible to create circular data structures with conses.<br />
<br />
Common Lisp supports multidimensional ''arrays'', and can dynamically resize ''adjustable'' arrays if required. Multidimensional arrays can be used for matrix mathematics. A ''vector'' is a one-dimensional array. Arrays can carry any type as members (even mixed types in the same array) or can be specialized to contain a specific type of members, as in a vector of bits. Usually only a few types are supported. Many implementations can optimize array functions when the array used is type-specialized. Two type-specialized array types are standard: a ''string'' is a vector of characters, while a ''bit-vector'' is a vector of [[bit]]s.<br />
<br />
''[[Hash table]]s'' store associations between data objects. Any object may be used as key or value. Hash tables are automatically resized as needed.<br />
<br />
''Packages'' are collections of symbols, used chiefly to separate the parts of a program into [[namespaces]]. A package may ''export'' some symbols, marking them as part of a public interface. Packages can use other packages.<br />
<br />
''Structures'', similar in use to [[C (programming language)|C]] structs and [[Pascal (programming language)|Pascal]] records, represent arbitrary complex data structures with any number and type of fields (called ''slots''). Structures allow single-inheritance.<br />
<br />
''Classes'' are similar to structures, but offer more dynamic features and multiple-inheritance. (See [[Common Lisp Object System|CLOS]]). Classes have been added late to Common Lisp and there is some conceptual overlap with structures. Objects created of classes are called ''Instances''. A special case are Generic Functions. Generic Functions are both functions and instances.<br />
<br />
===Functions===<br />
Common Lisp supports [[first-class function]]s. For instance, it is possible to write functions that take other functions as arguments or return functions as well. This makes it possible to describe very general operations.<br />
<br />
The Common Lisp library relies heavily on such higher-order functions. For example, the <code>sort</code> function takes a [[relational operator]] as an argument and key function as an optional keyword argument. This can be used not only to sort any type of data, but also to sort data structures according to a key.<br />
<br />
<source lang="lisp"><br />
;; Sorts the list using the > and < function as the relational operator.<br />
(sort (list 5 2 6 3 1 4) #'>) ; Returns (6 5 4 3 2 1)<br />
(sort (list 5 2 6 3 1 4) #'<) ; Returns (1 2 3 4 5 6)<br />
</source><br />
<source lang="lisp"><br />
;; Sorts the list according to the first element of each sub-list.<br />
(sort (list '(9 A) '(3 B) '(4 C)) #'< :key #'first) ; Returns ((3 B) (4 C) (9 A))<br />
</source><br />
<br />
The evaluation model for functions is very simple. When the evaluator encounters a form <code>(f a1 a2...)</code> then it presumes that the symbol named f is one of the following:<br />
<br />
# A special operator (easily checked against a fixed list)<br />
# A macro operator (must have been defined previously)<br />
# The name of a function (default), which may either be a symbol, or a sub-form beginning with the symbol <code>lambda</code>.<br />
<br />
If f is the name of a function, then the arguments a1, a2, ..., an are evaluated in left-to-right order, and the function is found and invoked with those values supplied as parameters.<br />
<br />
====Defining functions====<br />
The [[Defun|macro <code>defun</code>]] defines functions where a function definition gives the name of the function, the names of any arguments, and a function body:<br />
<br />
<source lang="lisp"><br />
(defun square (x)<br />
(* x x))<br />
</source><br />
<br />
Function definitions may include compiler [[Directive (programming)|directives]], known as ''declarations'', which provide hints to the compiler about optimization settings or the data types of arguments. They may also include ''documentation strings'' (docstrings), which the Lisp system may use to provide interactive documentation:<br />
<br />
<source lang="lisp"><br />
(defun square (x)<br />
"Calculates the square of the single-float x."<br />
(declare (single-float x) (optimize (speed 3) (debug 0) (safety 1)))<br />
(the single-float (* x x)))<br />
</source><br />
<br />
Anonymous functions ([[function literal]]s) are defined using <code>lambda</code> expressions, e.g. <code>(lambda&nbsp;(x)&nbsp;(*&nbsp;x&nbsp;x))</code> for a function that squares its argument. Lisp programming style frequently uses higher-order functions for which it is useful to provide anonymous functions as arguments.<br />
<br />
Local functions can be defined with <code>flet</code> and <code>labels</code>.<br />
<br />
<source lang="lisp"><br />
(flet ((square (x)<br />
(* x x)))<br />
(square 3))<br />
</source><br />
<br />
There are a number of other operators related to the definition and manipulation of functions. For instance, a function may be compiled with the <code>compile</code> operator. (Some Lisp systems run functions using an interpreter by default unless instructed to compile; others compile every function).<br />
<br />
====Defining generic functions and methods====<br />
The macro <code>defgeneric</code> defines generic functions.<br />
The macro <code>defmethod</code> defines methods. Generic functions are a collection of methods.<br />
<br />
Methods can specialize their parameters over CLOS ''standard classes'', ''system classes'', ''structure classes'' or objects. For many types there are corresponding ''system classes''.<br />
<br />
When a generic function is called, multiple-dispatch will determine the effective method to use.<br />
<br />
<source lang="lisp"><br />
(defgeneric add (a b))<br />
</source><br />
<br />
<source lang="lisp"><br />
(defmethod add ((a number) (b number))<br />
(+ a b))<br />
</source><br />
<br />
<source lang="lisp"><br />
(defmethod add ((a vector) (b number))<br />
(map 'vector (lambda (n) (+ n b)) a))<br />
</source><br />
<br />
<source lang="lisp"><br />
(defmethod add ((a vector) (b vector))<br />
(map 'vector #'+ a b))<br />
</source><br />
<source lang="lisp"><br />
(defmethod add ((a string)(b string))<br />
(concatenate 'string a b) )<br />
</source><br />
<source lang="lisp"><br />
(add 2 3) ; returns 5<br />
(add #(1 2 3 4) 7) ; returns #(8 9 10 11)<br />
(add #(1 2 3 4) #(4 3 2 1)) ; returns #(5 5 5 5)<br />
(add "COMMON " "LISP") ; returns "COMMON LISP"<br />
</source><br />
<br />
Generic Functions are also a first class data type. There are many more features to Generic Functions and Methods than described above.<br />
<br />
====The function namespace====<br />
<!-- This section name is linked from several places; if you change it, update the links. --><br />
<br />
The namespace for function names is separate from the namespace for data variables. This is a key difference between Common Lisp and [[Scheme (programming language)|Scheme]]. For Common Lisp, operators that define names in the function namespace include <code>defun</code>, <code>flet</code>, <code>labels</code>, <code>defmethod</code> and <code>defgeneric</code>.<br />
<br />
To pass a function by name as an argument to another function, one must use the <code>function</code> special operator, commonly abbreviated as <code>#'</code>. The first <code>sort</code> example above refers to the function named by the symbol <code>&gt;</code> in the function namespace, with the code <code>#'&gt;</code>. Conversely, to call a function passed in such a way, one would use the <code>funcall</code> operator on the argument.<br />
<br />
[[Scheme (programming language)|Scheme's]] evaluation model is simpler: there is only one namespace, and all positions in the form are evaluated (in any order) -- not just the arguments. Code written in one dialect is therefore sometimes confusing to programmers more experienced in the other. For instance, many Common Lisp programmers like to use descriptive variable names such as ''list'' or ''string'' which could cause problems in Scheme, as they would locally shadow function names.<br />
<br />
Whether a separate namespace for functions is an advantage is a source of contention in the Lisp community. It is usually referred to as the ''Lisp-1 vs. Lisp-2 debate''. Lisp-1 refers to Scheme's model and Lisp-2 refers to Common Lisp's model. These names were coined in a 1988 paper by [[Richard P. Gabriel]] and [[Kent Pitman]], which extensively compares the two approaches.<ref>{{cite journal |title=Technical Issues of Separation in Function Cells and Value Cells |url=http://www.nhplace.com/kent/Papers/Technical-Issues.html |authors=Richard P. Gabriel, Kent M. Pitman |journal=Lisp and Symbolic Computation |date = June 1988|volume=1 |issue=1 |pages=81–101 |doi=10.1007/bf01806178}}</ref><br />
<br />
===Other types===<br />
Other data types in Common Lisp include:<br />
<br />
*''Pathnames'' represent files and directories in the [[filesystem]]. The Common Lisp pathname facility is more general than most operating systems' file naming conventions, making Lisp programs' access to files broadly portable across diverse systems.<br />
*Input and output ''streams'' represent sources and sinks of binary or textual data, such as the terminal or open files.<br />
*Common Lisp has a built-in [[pseudo-random number generator]] (PRNG). ''Random state'' objects represent reusable sources of pseudo-random numbers, allowing the user to seed the PRNG or cause it to replay a sequence.<br />
*''Conditions'' are a type used to represent errors, exceptions, and other "interesting" events to which a program may respond.<br />
*''Classes'' are [[first-class object]]s, and are themselves instances of classes called [[metaclasses|metaobject classes]] ([[metaclasses]] for short).<br />
*''Readtables'' are a type of object which control how Common Lisp's reader parses the text of source code. By controlling which readtable is in use when code is read in, the programmer can change or extend the language's syntax.<br />
<br />
==Scope==<br />
<br />
Like programs in many other programming languages, Common Lisp programs make use of names to refer to variables, functions, and many other kinds of entities. Named references are subject to scope.<br />
<br />
The association between a name and the entity which the name refers to is called a binding.<br />
<br />
Scope refers to the set of circumstances in which a name is determined to have a particular binding.<br />
<br />
===Determiners of scope===<br />
<br />
The circumstances which determine scope in Common Lisp include:<br />
<br />
* the location of a reference within an expression. If it's the leftmost position of a compound, it refers to a special operator or a macro or function binding, otherwise to a variable binding or something else.<br />
* the kind of expression in which the reference takes place. For instance, <code>(go x)</code> means transfer control to label <code>x</code>, whereas <code>(print x)</code> refers to the variable <code>x</code>. Both scopes of <code>x</code> can be active in the same region of program text, since tagbody labels are in a separate namespace from variable names. A special form or macro form has complete control over the meanings of all symbols in its syntax. For instance in <code>(defclass x (a b) ())</code>, a class definition, the <code>(a b)</code> is a list of base classes, so these names are looked up in the space of class names, and <code>x</code> isn't a reference to an existing binding, but the name of a new class being derived from <code>a</code> and <code>b</code>. These facts emerge purely from the semantics of <code>defclass</code>. The only generic fact about this expression is that <code>defclass</code> refers to a macro binding; everything else is up to <code>defclass</code>.<br />
* the location of the reference within the program text. For instance, if a reference to variable <code>x</code> is enclosed in a binding construct such as a <code>let</code> which defines a binding for <code>x</code>, then the reference is in the scope created by that binding.<br />
* for a variable reference, whether or not a variable symbol has been, locally or globally, declared special. This determines whether the reference is resolved within a lexical environment, or within a dynamic environment.<br />
* the specific instance of the environment in which the reference is resolved. An environment is a run-time dictionary which maps symbols to bindings. Each kind of reference uses its own kind of environment. References to lexical variables are resolved in a lexical environment, et cetera. More than one environment can be associated with the same reference. For instance, thanks to recursion or the use of multiple threads, multiple activations of the same function can exist at the same time. These activations share the same program text, but each has its own lexical environment instance.<br />
<br />
To understand what a symbol refers to, the Common Lisp programmer must know what kind of reference is being expressed, what kind of scope it uses if it is a variable reference (dynamic versus lexical scope), and also the run-time situation: in what environment is the reference resolved, where was the binding introduced into the environment, et cetera.<br />
<br />
===Kinds of environment===<br />
<br />
====Global====<br />
<br />
Some environments in Lisp are globally pervasive. For instance, if a new type is defined, it is known everywhere thereafter. References to that type look it up in this global environment.<br />
<br />
====Dynamic====<br />
<br />
One type of environment in Common Lisp is the dynamic environment. Bindings established in this environment have dynamic extent, which means that a binding is established at the start of the execution of some construct, such as a <code>let</code> block, and disappears when that construct finishes executing: its lifetime is tied to the dynamic activation and deactivation of a block. However, a dynamic binding is not just visible within that block; it is also visible to all functions invoked from that block. This type of visibility is known as indefinite scope. Bindings which exhibit dynamic extent (lifetime tied to the activation and deactivation of a block) and indefinite scope (visible to all functions which are called from that block) are said to have dynamic scope.<br />
<br />
Common Lisp has support for dynamically scoped variables, which are also called special variables. Certain other kinds of bindings are necessarily dynamically scoped also, such as restarts and catch tags. Function bindings cannot be dynamically scoped using <code>flet</code> (which only provides lexically scoped function bindings), but function objects (a first-level object in Common Lisp) can be assigned to dynamically scoped variables, bound using <code>let</code> in dynamic scope, then called using <code>funcall</code> or <code>APPLY</code>.<br />
<br />
Dynamic scope is extremely useful because it adds referential clarity and discipline to [[global variable]]s. Global variables are frowned upon in computer science as potential sources of error, because they can give rise to ad-hoc, covert channels of communication among modules that lead to unwanted, surprising interactions.<br />
<br />
In Common Lisp, a special variable which has only a top-level binding behaves just like a global variable in other programming languages. A new value can be stored into it, and that value simply replaces what is in the top-level binding. Careless replacement of the value of a global variable is at the heart of bugs caused by use of global variables. However, another way to work with a special variable is to give it a new, local binding within an expression. This is sometimes referred to as "rebinding" the variable. Binding a dynamically scoped variable temporarily creates a new memory location for that variable, and associates the name with that location. While that binding is in effect, all references to that variable refer to the new binding; the previous binding is hidden. When execution of the binding expression terminates, the temporary memory location is gone, and the old binding is revealed, with the original value intact. Of course, multiple dynamic bindings for the same variable can be nested.<br />
<br />
In Common Lisp implementations which support multithreading, dynamic scopes are specific to each thread of execution. Thus special variables serve as an abstraction for thread local storage. If one thread rebinds a special variable, this rebinding has no effect on that variable in other threads. The value stored in a binding can only be retrieved by the thread which created that binding. If each thread binds some special variable <code>*x*</code>, then <code>*x*</code> behaves like thread-local storage. Among threads which do not rebind <code>*x*</code>, it behaves like an ordinary global: all of these threads refer to the same top-level binding of <code>*x*</code>.<br />
<br />
Dynamic variables can be used to extend the execution context with additional context information which is implicitly passed from function to function without having to appear as an extra function parameter. This is especially useful when the control transfer has to pass through layers of unrelated code, which simply cannot be extended with extra parameters to pass the additional data. A situation like this usually calls for a global variable. That global variable must be saved and restored, so that the scheme doesn't break under recursion: dynamic variable rebinding takes care of this. And that variable must be made thread-local (or else a big mutex must be used) so the scheme doesn't break under threads: dynamic scope implementations can take care of this also.<br />
<br />
In the Common Lisp library, there are many standard special variables. For instance, all standard I/O streams are stored in the top-level bindings of well-known special variables. The standard output stream is stored in *standard-output*.<br />
<br />
Suppose a function foo writes to standard output:<br />
<br />
<source lang="lisp"><br />
(defun foo ()<br />
(format t "Hello, world"))<br />
</source><br />
<br />
To capture its output in a character string, *standard-output* can be bound to a string stream and called:<br />
<br />
<source lang="lisp"><br />
(with-output-to-string (*standard-output*)<br />
(foo))<br />
</source><br />
<br />
-> "Hello, world" ; gathered output returned as a string<br />
<br />
====Lexical====<br />
<br />
Common Lisp supports lexical environments. Formally, the bindings in a lexical environment have [[lexical scope]] and may have either indefinite extent or dynamic extent, depending on the type of namespace. [[Lexical scope]] means that visibility is physically restricted to the block in which the binding is established. References which are not textually (i.e. lexically) embedded in that block simply do not see that binding.<br />
<br />
The tags in a TAGBODY have lexical scope. The expression (GO X) is erroneous if it is not actually embedded in a TAGBODY which contains a label X. However, the label bindings disappear when the TAGBODY terminates its execution, because they have dynamic extent. If that block of code is re-entered by the invocation of a lexical closure, it is invalid for the body of that closure to try to transfer control to a tag via GO:<br />
<br />
<source lang="lisp"><br />
(defvar *stashed*) ;; will hold a function<br />
<br />
(tagbody<br />
(setf *stashed* (lambda () (go some-label)))<br />
(go end-label) ;; skip the (print "Hello")<br />
some-label<br />
(print "Hello")<br />
end-label)<br />
-> NIL<br />
</source><br />
<br />
When the TAGBODY is executed, it first evaluates the setf form which stores a function in the special variable *stashed*. Then the (go end-label) transfers control to end-label, skipping the code (print "Hello"). Since end-label is at the end of the tagbody, the tagbody terminates, yielding NIL. Suppose that the previously remembered function is now called:<br />
<br />
<source lang="lisp"><br />
(funcall *stashed*) ;; Error!<br />
</source><br />
<br />
This situation is erroneous. One implementation's response is an error condition containing the message, "GO: tagbody for tag SOME-LABEL has already been left". The function tried to evaluate (go some-label), which is lexically embedded in the tagbody, and resolves to the label. However, the tagbody isn't executing (its extent has ended), and so the control transfer cannot take place.<br />
<br />
Local function bindings in Lisp have [[lexical scope]], and variable bindings also have lexical scope by default. By contrast with GO labels, both of these have indefinite extent. When a lexical function or variable binding is established, that binding continues to exist for as long as references to it are possible, even after the construct which established that binding has terminated. References to lexical variables and functions after the termination of their establishing construct are possible thanks to [[lexical closure]]s.<br />
<br />
Lexical binding is the default binding mode for Common Lisp variables. For an individual symbol, it can be switched to dynamic scope, either by a local declaration, by a global declaration. The latter may occur implicitly through the use of a construct like DEFVAR or DEFPARAMETER. It is an important convention in Common Lisp programming that special (i.e. dynamically scoped) variables have names which begin and end with an asterisk [[Sigil (computer programming)|sigil]] <code>*</code> in what is called the “[[earmuff]] convention”.<ref>[http://letoverlambda.com/index.cl/guest/chap2.html Chapter 2] of [[Let Over Lambda]]</ref> If adhered to, this convention effectively creates a separate namespace for special variables, so that variables intended to be lexical are not accidentally made special.<br />
<br />
[[Lexical scope]] is useful for several reasons.<br />
<br />
Firstly, references to variables and functions can be compiled to efficient machine code, because the run-time environment structure is relatively simple. In many cases it can be optimized to stack storage, so opening and closing lexical scopes has minimal overhead. Even in cases where full closures must be generated, access to the closure's environment is still efficient; typically each variable becomes an offset into a vector of bindings, and so a variable reference becomes a simple load or store instruction with a base-plus-offset [[addressing mode]].<br />
<br />
Secondly, lexical scope (combined with indefinite extent) gives rise to the [[lexical closure]], which in turn creates a whole paradigm of programming centered around the use of functions being first-class objects, which is at the root of functional programming.<br />
<br />
Thirdly, perhaps most importantly, even if lexical closures are not exploited, the use of lexical scope isolates program modules from unwanted interactions. Due to their restricted visibility, lexical variables are private. If one module A binds a lexical variable X, and calls another module B, references to X in B will not accidentally resolve to the X bound in A. B simply has no access to X. For situations in which disciplined interactions through a variable are desirable, Common Lisp provides special variables. Special variables allow for a module A to set up a binding for a variable X which is visible to another module B, called from A. Being able to do this is an advantage, and being able to prevent it from happening is also an advantage; consequently, Common Lisp supports both lexical and [[dynamic scope]].<br />
<br />
==Macros==<br />
A ''[[Macro (computer science)|macro]]'' in Lisp superficially resembles a function in usage. However, rather than representing an expression which is evaluated, it represents a transformation of the program source code. The macro gets the source it surrounds as arguments, binds them to its parameters and computes a new source form. This new form can also use a macro. The macro expansion is repeated until the new source form does not use a macro. The final computed form is the source code executed at runtime.<br />
<br />
Typical uses of macros in Lisp:<br />
<br />
* new control structures (example: looping constructs, branching constructs)<br />
* scoping and binding constructs<br />
* simplified syntax for complex and repeated source code<br />
* top-level defining forms with compile-time side-effects<br />
* data-driven programming<br />
* embedded domain specific languages (examples: SQL, HTML, Prolog)<br />
* implicit finalization forms<br />
<br />
Various standard Common Lisp features also need to be implemented as macros, such as:<br />
<br />
* the standard <code>setf</code> abstraction, to allow custom compile-time expansions of assignment/access operators<br />
* <code>with-accessors</code>, <code>with-slots</code>, <code>with-open-file</code> and other similar <code>WITH</code> macros<br />
* Depending on implementation, <code>if</code> or <code>cond</code> is a macro built on the other, the special operator; <code>when</code> and <code>unless</code> consist of macros<br />
* The powerful <code>loop</code> domain-specific language<br />
<br />
Macros are defined by the ''defmacro'' macro. The special operator ''macrolet'' allows the definition of local (lexically scoped) macros. It is also possible to define macros for symbols using ''define-symbol-macro'' and ''symbol-macrolet''.<br />
<br />
[[Paul Graham (computer programmer)|Paul Graham]]'s book [[On Lisp]] describes the use of macros in Common Lisp in detail. [[Doug Hoyte]]'s book [[Let Over Lambda]] extends the discussion on macros, claiming "Macros are the single greatest advantage that lisp has as a programming language and the single greatest advantage of any programming language." Hoyte provides several examples of iterative development of macros.<br />
<br />
===Example using a macro to define a new control structure===<br />
Macros allow Lisp programmers to create new syntactic forms in the language. One typical use is to create new control structures. The example macro provides an <code>until</code> looping construct. The syntax is:<br />
<br />
<source lang="text"><br />
(until test form*)<br />
</source><br />
<br />
The macro definition for ''until'':<br />
<source lang="lisp"><br />
(defmacro until (test &body body)<br />
(let ((start-tag (gensym "START"))<br />
(end-tag (gensym "END")))<br />
`(tagbody ,start-tag<br />
(when ,test (go ,end-tag))<br />
(progn ,@body)<br />
(go ,start-tag)<br />
,end-tag)))<br />
</source><br />
<br />
''tagbody'' is a primitive Common Lisp special operator which provides the ability to name tags and use the ''go'' form to jump to those tags. The backquote ''`'' provides a notation that provides code templates, where the value of forms preceded with a comma are filled in. Forms preceded with comma and at-sign are ''spliced'' in. The tagbody form tests the end condition. If the condition is true, it jumps to the end tag. Otherwise the provided body code is executed and then it jumps to the start tag.<br />
<br />
An example form using above ''until'' macro:<br />
<source lang="lisp"><br />
(until (= (random 10) 0)<br />
(write-line "Hello"))<br />
</source><br />
<br />
The code can be expanded using the function ''macroexpand-1''. The expansion for above example looks like this:<br />
<source lang="lisp"><br />
(TAGBODY<br />
#:START1136<br />
(WHEN (ZEROP (RANDOM 10))<br />
(GO #:END1137))<br />
(PROGN (WRITE-LINE "hello"))<br />
(GO #:START1136)<br />
#:END1137)<br />
</source><br />
<br />
During macro expansion the value of the variable ''test'' is ''(= (random 10) 0)'' and the value of the variable ''body'' is ''((write-line "Hello"))''. The body is a list of forms.<br />
<br />
Symbols are usually automatically upcased. The expansion uses the TAGBODY with two labels. The symbols for these labels are computed by GENSYM and are not interned in any package. Two ''go'' forms use these tags to jump to. Since ''tagbody'' is a primitive operator in Common Lisp (and not a macro), it will not be expanded into something else. The expanded form uses the ''when'' macro, which also will be expanded. Fully expanding a source form is called ''code walking''.<br />
<br />
In the fully expanded (''walked'') form, the ''when'' form is replaced by the primitive ''if'':<br />
<source lang="lisp"><br />
(TAGBODY<br />
#:START1136<br />
(IF (ZEROP (RANDOM 10))<br />
(PROGN (GO #:END1137))<br />
NIL)<br />
(PROGN (WRITE-LINE "hello"))<br />
(GO #:START1136))<br />
#:END1137)<br />
</source><br />
<br />
All macros must be expanded before the source code containing them can be evaluated or compiled normally. Macros can be considered functions that accept and return [[abstract syntax tree]]s (Lisp S-expressions). These functions<br />
are invoked before the evaluator or compiler to produce the final source code.<br />
Macros are written in normal Common Lisp, and may use any Common Lisp (or third-party) operator available.<br />
<br />
===Variable capture and shadowing===<br />
Common Lisp macros are capable of what is commonly called ''variable capture'', where symbols in the macro-expansion body coincide with those in the calling context, allowing the programmer to create macros wherein various symbols have special meaning. The term ''variable capture'' is somewhat misleading, because all namespaces are vulnerable to unwanted capture, including the operator and function namespace, the tagbody label namespace, catch tag, condition handler and restart namespaces.<br />
<br />
''Variable capture'' can introduce software defects. This happens in one of the following two ways:<br />
<br />
* In the first way, a macro expansion can inadvertently make a symbolic reference which the macro writer assumed will resolve in a global namespace, but the code where the macro is expanded happens to provide a local, shadowing definition which steals that reference. Let this be referred to as type 1 capture.<br />
<br />
* The second way, type 2 capture, is just the opposite: some of the arguments of the macro are pieces of code supplied by the macro caller, and those pieces of code are written such that they make references to surrounding bindings. However, the macro inserts these pieces of code into an expansion which defines its own bindings that accidentally captures some of these references.<br />
<br />
The Scheme dialect of Lisp provides a macro-writing system which provides the referential transparency that eliminates both types of capture problem. This type of macro system is sometimes called "hygienic", in particular by its proponents (who regard macro systems which do not automatically solve this problem as unhygienic). {{Citation needed|date=May 2011}}<br />
<br />
In Common Lisp, macro hygiene is ensured one of two different ways.<br />
<br />
One approach is to use [[gensym]]s: guaranteed-unique symbols which can be used in a macro-expansion without threat of capture. The use of gensyms in a macro definition is a manual chore, but macros can be written which simplify the instantiation and use of gensyms. Gensyms solve type 2 capture easily, but they are not applicable to type 1 capture in the same way, because the macro expansion cannot rename the interfering symbols in the surrounding code which capture its references. Gensyms could be used to provide stable aliases for the global symbols which the macro expansion needs. The macro expansion would use these secret aliases rather than the well-known names, so redefinition of the well-known names would have no ill effect on the macro.<br />
<br />
Another approach is to use packages. A macro defined in its own package can simply use internal symbols in that package in its expansion. The use of packages deals with type 1 and type 2 capture.<br />
<br />
However, packages don't solve the type 1 capture of references to standard Common Lisp functions and operators. The reason is that the use of packages to solve capture problems revolves around the use of private symbols (symbols in one package, which are not imported into, or otherwise made visible in other packages). Whereas the Common Lisp library symbols are external, and frequently imported into or made visible in user-defined packages.<br />
<br />
The following is an example of unwanted capture in the operator namespace, occurring in the expansion of a macro:<br />
<br />
<source lang="lisp"><br />
;; expansion of UNTIL makes liberal use of DO<br />
(defmacro until (expression &body body)<br />
`(do () (,expression) ,@body))<br />
<br />
;; macrolet establishes lexical operator binding for DO<br />
(macrolet ((do (...) ... something else ...))<br />
(until (= (random 10) 0) (write-line "Hello")))<br />
</source><br />
<br />
The <code>until</code> macro will expand into a form which calls <code>do</code> which is intended to refer to the standard Common Lisp macro <code>do</code>. However, in this context, <code>do</code> may have a completely different meaning, so <code>until</code> may not work properly.<br />
<br />
Common Lisp solves the problem of the shadowing of standard operators and functions by forbidding their redefinition. Because it redefines the standard operator <code>do</code>, the preceding is actually a fragment of non-conforming Common Lisp, which allows implementations to diagnose and reject it.<br />
<br />
==Condition system==<br />
The ''condition system'' is responsible for [[exception handling]] in Common Lisp.<ref name="Seibel2005">{{cite book|author=Peter Seibel|title=Practical Common Lisp|url=http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html|date=7 April 2005|publisher=Apress|isbn=978-1-59059-239-7}}</ref> It provides ''conditions'', ''handler''s and ''restart''s. ''Condition''s are objects describing an exceptional situation (for example an error). If a ''condition'' is signaled, the Common Lisp system searches for a ''handler'' for this condition type and calls the handler. The ''handler'' can now search for restarts and use one of these restarts to repair the current problem. As part of a user interface (for example of a debugger), these restarts can also be presented to the user, so that the user can select and invoke one of the available restarts. Since the condition handler is called in the context of the error (without unwinding the stack), full error recovery is possible in many cases, where other exception handling systems would have already terminated the current routine. The debugger itself can also be customized or replaced using the <code>*debugger-hook*</code> dynamic variable.<br />
<br />
In the following example (using [[Symbolics Genera]]) the user tries to open a file in a Lisp function ''test'' called from the Read-Eval-Print-LOOP ([[REPL]]), when the file does not exist. The Lisp system presents four restarts. The user selects the ''Retry OPEN using a different pathname'' restart and enters a different pathname (lispm-init.lisp instead of lispm-int.lisp). The user code does not contain any error handling code. The whole error handling and restart code is provided by the Lisp system, which can handle and repair the error without terminating the user code.<br />
<br />
<source lang="text"><br />
Command: (test ">zippy>lispm-int.lisp")<br />
<br />
Error: The file was not found.<br />
For lispm:>zippy>lispm-int.lisp.newest<br />
<br />
LMFS:OPEN-LOCAL-LMFS-1<br />
Arg 0: #P"lispm:>zippy>lispm-int.lisp.newest"<br />
<br />
s-A, <Resume>: Retry OPEN of lispm:>zippy>lispm-int.lisp.newest<br />
s-B: Retry OPEN using a different pathname<br />
s-C, <Abort>: Return to Lisp Top Level in a TELNET server<br />
s-D: Restart process TELNET terminal<br />
<br />
-> Retry OPEN using a different pathname<br />
Use what pathname instead [default lispm:>zippy>lispm-int.lisp.newest]:<br />
lispm:>zippy>lispm-init.lisp.newest<br />
<br />
...the program continues<br />
</source><br />
<br />
==Common Lisp Object System (CLOS)==<br />
<br />
{{Main|Common Lisp Object System}}<br />
<br />
Common Lisp includes a toolkit for [[object-oriented programming]], the Common Lisp Object System or [[Common Lisp Object System|CLOS]], which is one of the most powerful object systems available in any language. For example, [[Peter Norvig]] explains how many [[Design pattern (computer science)|Design Patterns]] are simpler to implement in a dynamic language with the features of CLOS (Multiple Inheritance, Mixins, Multimethods, Metaclasses, Method combinations, etc.).<ref>[http://norvig.com/design-patterns/ppframe.htm Peter Norvig, Design Patterns in Dynamic Programming]</ref><br />
Several extensions to Common Lisp for object-oriented programming have been proposed to be included into the ANSI Common Lisp standard, but eventually CLOS was adopted as the standard object-system for Common Lisp. CLOS is a [[dynamic programming language|dynamic]] object system with [[multiple dispatch]] and [[multiple inheritance]], and differs radically from the OOP facilities found in static languages such as [[C++]] or [[Java (programming language)|Java]]. As a dynamic object system, CLOS allows changes at runtime to generic functions and classes. Methods can be added and removed, classes can be added and redefined, objects can be updated for class changes and the class of objects can be changed.<br />
<br />
CLOS has been integrated into ANSI Common Lisp. Generic Functions can be used like normal functions and are a first-class data type. Every CLOS class is integrated into the Common Lisp type system. Many Common Lisp types have a corresponding class. There is more potential use of CLOS for Common Lisp. The specification does not say whether conditions are implemented with CLOS. Pathnames and streams could be implemented with CLOS. These further usage possibilities of CLOS for ANSI Common Lisp are not part of the standard. Actual Common Lisp implementations are using CLOS for pathnames, streams, input/output, conditions, the implementation of CLOS itself and more.<br />
<br />
==Compiler and interpreter==<br />
Several implementations of earlier Lisp dialects provided both an interpreter and a compiler. Unfortunately often the semantics were different. These earlier Lisps implemented lexical scoping in the compiler and dynamic scoping in the interpreter. Common Lisp requires that both the interpreter and compiler use lexical scoping by default. The Common Lisp standard describes both the semantics of the interpreter and a compiler. The compiler can be called using the function ''compile'' for individual functions and using the function ''compile-file'' for files. Common Lisp allows type declarations and provides ways to influence the compiler code generation policy. For the latter various optimization qualities can be given values between 0 (not important) and 3 (most important): ''speed'', ''space'', ''safety'', ''debug'' and ''compilation-speed''.<br />
<br />
There is also a function to evaluate Lisp code: ''eval''. ''eval'' takes code as pre-parsed s-expressions and not, like in some other languages, as text strings. This way code can be constructed with the usual Lisp functions for constructing lists and symbols and then this code can be evaluated with ''eval''. Several Common Lisp implementations (like Clozure CL and SBCL) are implementing ''eval'' using their compiler. This way code is compiled, even though it is evaluated using the function ''eval''.<br />
<br />
The file compiler is invoked using the function ''compile-file''. The generated file with compiled code is called a ''fasl'' (from ''fast load'') file. These ''fasl'' files and also source code files can be loaded with the function ''load'' into a running Common Lisp system. Depending on the implementation, the file compiler generates byte-code (for example for the [[Java Virtual Machine]]), [[C (programming language)|C language]] code (which then is compiled with a C compiler) or, directly, native code.<br />
<br />
Common Lisp implementations can be used interactively, even though the code gets fully compiled. The idea of an [[Interpreted language]] thus does not apply for interactive Common Lisp.<br />
<br />
The language makes distinction between read-time, compile-time, load-time and run-time, and allows user code to also make this distinction to perform the wanted type of processing at the wanted step.<br />
<br />
Some special operators are provided to especially suit interactive development; for instance, <code>defvar</code> will only assign a value to its provided variable if it wasn't already bound, while <code>defparameter</code> will always perform the assignment. This distinction is useful when interactively evaluating, compiling and loading code in a live image.<br />
<br />
Some features are also provided to help writing compilers and interpreters. Symbols consist of first-level objects and are directly manipulable by user code. The <code>progv</code> special operator allows to create lexical bindings programmatically, while packages are also manipulable. The Lisp compiler itself is available at runtime to compile files or individual functions. These make it easy to use Lisp as an intermediate compiler or interpreter for another language.<br />
<br />
==Code examples==<br />
<br />
===Birthday paradox===<br />
The following program calculates the smallest number of people in a room for whom the probability of completely unique birthdays is less than 50% (the so-called [[birthday paradox]], where for 1 person the probability is obviously 100%, for 2 it is 364/365, etc.). (Answer = 23.) By convention, constants in Common Lisp are bracketed with <tt>+</tt> characters.<br />
<br />
<source lang="lisp"><br />
(defconstant +year-size+ 365)<br />
<br />
(defun birthday-paradox (probability number-of-people)<br />
(let ((new-probability (* (/ (- +year-size+ number-of-people)<br />
+year-size+)<br />
probability)))<br />
(if (< new-probability 0.5)<br />
(1+ number-of-people)<br />
(birthday-paradox new-probability (1+ number-of-people)))))<br />
</source><br />
<br />
Calling the example function using the [[REPL]] (Read Eval Print Loop):<br />
<source lang="text"><br />
CL-USER > (birthday-paradox 1.0 1)<br />
23<br />
</source><br />
<br />
===Sorting a list of person objects===<br />
<br />
We define a class PERSON and a method for displaying the name and age of a person.<br />
Next we define a group of persons as a list of PERSON objects.<br />
Then we iterate over the sorted list.<br />
<br />
<source lang="lisp"><br />
(defclass person ()<br />
((name :initarg :name :accessor person-name)<br />
(age :initarg :age :accessor person-age))<br />
(:documentation "The class PERSON with slots NAME and AGE."))<br />
<br />
(defmethod display ((object person) stream)<br />
"Displaying a PERSON object to an output stream."<br />
(with-slots (name age) object<br />
(format stream "~a (~a)" name age)))<br />
<br />
(defparameter *group*<br />
(list (make-instance 'person :name "Bob" :age 33)<br />
(make-instance 'person :name "Chris" :age 16)<br />
(make-instance 'person :name "Ash" :age 23))<br />
"A list of PERSON objects.")<br />
<br />
(dolist (person (sort (copy-list *group*)<br />
#'><br />
:key #'person-age))<br />
(display person *standard-output*)<br />
(terpri))<br />
</source><br />
<br />
It prints the three names with descending age.<br />
<source lang="text"><br />
Bob (33)<br />
Ash (23)<br />
Chris (16)<br />
</source><br />
<br />
===Exponentiating by squaring===<br />
<br />
Use of the LOOP macro is demonstrated:<br />
<br />
<source lang="lisp"><br />
(defun power (x n)<br />
(loop with result = 1<br />
while (plusp n)<br />
when (oddp n) do (setf result (* result x))<br />
do (setf x (* x x)<br />
n (truncate n 2))<br />
finally (return result)))<br />
</source><br />
<br />
Example use:<br />
<br />
<source lang="text"><br />
CL-USER > (power 2 200)<br />
1606938044258990275541962092341162602522202993782792835301376<br />
</source><br />
<br />
Compare with the built in exponentiation:<br />
<br />
<source lang="text"><br />
CL-USER > (= (expt 2 200) (power 2 200))<br />
T<br />
</source><br />
<br />
===Find the list of available shells===<br />
<br />
WITH-OPEN-FILE is a macro that opens a file and provides a stream. When the form is returning, the file is automatically closed. FUNCALL calls a function object. The LOOP collects all lines that match the predicate.<br />
<br />
<source lang="lisp"><br />
(defun list-matching-lines (file predicate)<br />
"Returns a list of lines in file, for which the predicate applied to<br />
the line returns T."<br />
(with-open-file (stream file)<br />
(loop for line = (read-line stream nil nil)<br />
while line<br />
when (funcall predicate line)<br />
collect it)))<br />
</source><br />
<br />
The function AVAILABLE-SHELLS calls above function LIST-MATCHING-LINES with a pathname and an anonymous function as the predicate. The predicate returns the pathname of a shell or NIL (if the string is not the filename of a shell).<br />
<br />
<source lang="lisp"><br />
(defun available-shells (&optional (file #p"/etc/shells"))<br />
(list-matching-lines<br />
file<br />
(lambda (line)<br />
(and (plusp (length line))<br />
(char= (char line 0) #\/)<br />
(pathname<br />
(string-right-trim '(#\space #\tab) line))))))<br />
</source><br />
<br />
Example results (on Mac OS X 10.6):<br />
<br />
<source lang="lisp"><br />
CL-USER > (available-shells)<br />
(#P"/bin/bash" #P"/bin/csh" #P"/bin/ksh" #P"/bin/sh" #P"/bin/tcsh" #P"/bin/zsh")<br />
</source><br />
<br />
==Comparison with other Lisps==<br />
<!-- needs lots --><br />
Common Lisp is most frequently compared with, and contrasted to, [[Scheme (programming language)|Scheme]]—if only because they are the two most popular Lisp dialects. Scheme predates CL, and comes not only from the same Lisp tradition but from some of the same engineers—[[Guy L. Steele, Jr.|Guy L. Steele]], with whom [[Gerald Jay Sussman]] designed Scheme, chaired the standards committee for Common Lisp.<br />
<br />
Common Lisp is a general-purpose programming language, in contrast to Lisp variants such as [[Emacs Lisp]] and [[AutoLISP]] which are [[extension languages]] embedded in particular products. Unlike many earlier Lisps, Common Lisp (like [[Scheme (programming language)|Scheme]]) uses lexical variable [[scope (programming)|scope]] by default for both interpreted and compiled code.<br />
<br />
Most of the Lisp systems whose designs contributed to Common Lisp—such as [[ZetaLisp]] and Franz Lisp—used dynamically [[scope (programming)|scoped]] variables in their interpreters and lexically scoped variables in their compilers. Scheme introduced the sole use of lexically scoped variables to Lisp; an inspiration from [[ALGOL 68]] which was widely recognized as a good idea. CL supports dynamically scoped variables as well, but they must be explicitly declared as "special". There are no differences in scoping between ANSI CL interpreters and compilers.<br />
<br />
Common Lisp is sometimes termed a ''Lisp-2'' and Scheme a ''Lisp-1'', referring to CL's use of separate namespaces for functions and variables. (In fact, CL has ''many'' namespaces, such as those for go tags, block names, and <code>loop</code> keywords). There is a long-standing controversy between CL and Scheme advocates over the tradeoffs involved in multiple namespaces. In Scheme, it is (broadly) necessary to avoid giving variables names which clash with functions; Scheme functions frequently have arguments named <code>lis</code>, <code>lst</code>, or <code>lyst</code> so as not to conflict with the system function <code>list</code>. However, in CL it is necessary to explicitly refer to the function namespace when passing a function as an argument—which is also a common occurrence, as in the <code>sort</code> example above.<br />
<br />
CL also differs from Scheme in its handling of boolean values. Scheme uses the special values #t and #f to represent truth and falsity. CL follows the older Lisp convention of using the symbols T and NIL, with NIL standing also for the empty list. In CL, ''any'' non-NIL value is treated as true by conditionals, such as <code>if</code>, whereas in Scheme all non-#f values are treated as true. These conventions allow some operators in both languages to serve both as predicates (answering a boolean-valued question) and as returning a useful value for further computation, but in Scheme the value '() which is equivalent to NIL in Common Lisp evaluates to true in a boolean expression.<br />
<br />
Lastly, the Scheme standards documents require [[tail recursion|tail-call optimization]], which the CL standard does not. Most CL implementations do offer tail-call optimization, although often only when the programmer uses an optimization directive. Nonetheless, common CL coding style does not favor the ubiquitous use of recursion that Scheme style prefers—what a Scheme programmer would express with tail recursion, a CL user would usually express with an iterative expression in <code>do</code>, <code>dolist</code>, <code>loop</code>, or (more recently) with the <code>iterate</code> package.<br />
<br />
==Implementations==<br />
<br />
See the Category [[:Category:Common Lisp implementations|Common Lisp implementations]].<br />
<br />
Common Lisp is defined by a specification (like [[Ada (programming language)|Ada]] and [[C (programming language)|C]]) rather than by one implementation (like [[Perl]] before version 6). There are many implementations, and the standard details areas in which they may validly differ.<br />
<br />
In addition, implementations tend to come with library packages, which provide functionality not covered in the standard. [[Free and open source software]] libraries have been created to support such features in a portable way, and are most notably found in the repositories of the [http://common-lisp.net/ Common-Lisp.net] and [http://clocc.sourceforge.net/ Common Lisp Open Code Collection] projects.<br />
<br />
Common Lisp implementations may use any mix of native code compilation, byte code compilation or interpretation. Common Lisp has been designed to support [[incremental compiler]]s, file compilers and block compilers. Standard declarations to optimize compilation (such as function inlining or type specialization) are proposed in the language specification. Most Common Lisp implementations compile source code to native [[machine code]]. Some implementations can create (optimized) stand-alone applications. Others compile to interpreted [[bytecode]], which is less efficient than native code, but eases binary-code portability. There are also compilers that compile Common Lisp code to C code. The misconception that Lisp is a purely interpreted language is most likely because Lisp environments provide an interactive prompt and that code is compiled one-by-one, in an incremental way. With Common Lisp incremental compilation is widely used.<br />
<br />
Some [[Unix]]-based implementations ([[CLISP]], [[SBCL]]) can be used as a [[scripting language]]; that is, invoked by the system transparently in the way that a [[Perl]] or [[Unix shell]] interpreter is.<ref>[http://clisp.cons.org/impnotes/quickstart.html#quickstart-unix CLISP as a scripting language under Unix]</ref><br />
<br />
===List of implementations===<br />
<br />
====Commercial implementations====<br />
<br />
; [[Allegro Common Lisp]]: for Microsoft Windows, FreeBSD, Linux, Apple Mac OS X and various UNIX variants. Allegro CL provides an [[integrated development environment|Integrated Development Environment (IDE)]] (for Windows and Linux) and extensive capabilities for application delivery.<br />
; [[Liquid Common Lisp]]: formerly called [[Lucid Common Lisp]]. Only maintenance, no new releases.<br />
; [[LispWorks]]: for Microsoft Windows, FreeBSD, Linux, Apple Mac OS X and various UNIX variants. LispWorks provides an [[integrated development environment|Integrated Development Environment (IDE)]] (available for all platforms) and extensive capabilities for application delivery.<br />
; [[mocl]]: for iOS, Android and Mac OS X.<br />
; [[Open Genera]]: for DEC Alpha.<br />
; [[Scieneer Common Lisp]]: which is designed for high-performance scientific computing.<br />
<br />
====Freely redistributable implementations====<br />
<br />
; Armed Bear Common Lisp (ABCL) : A CL implementation that runs on the [[Java Virtual Machine]].<ref>{{cite web | url = http://common-lisp.net/project/armedbear/ | title = Armed Bear Common Lisp }}</ref> It includes a compiler to [[Java byte code]], and allows access to Java libraries from CL. It was formerly just a component of the [[Armed Bear J Editor]].<br />
; [[CLISP]]: A bytecode-compiling implementation, portable and runs on a number of Unix and Unix-like systems (including [[Mac OS X]]), as well as Microsoft Windows and several other systems.<br />
; [[Clozure CL]] (CCL) : Originally a [[free and open source software|free and open source]] fork of Macintosh Common Lisp. As that history implies, CCL was written for the Macintosh, but Clozure CL now runs on [[Mac OS X]], [[FreeBSD]], [[Linux]], [[Solaris (operating system)|Solaris]] and [[Microsoft Windows|Windows]]. 32 and 64 bit [[x86]] ports are supported on each platform. Additionally there are Power PC ports for Mac OS and Linux. CCL was previously known as OpenMCL, but that name is no longer used, to avoid confusion with the open source version of Macintosh Common Lisp.<br />
; [[CMUCL]]: Originally from [[Carnegie Mellon University]], now maintained as [[free and open source software]] by a group of volunteers. CMUCL uses a fast native-code compiler. It is available on [[Linux]] and [[Berkeley Software Distribution|BSD]] for Intel x86; [[Linux]] for Alpha; [[Mac OS X]] for Intel x86 and PowerPC; and Solaris, IRIX, and HP-UX on their native platforms.<br />
; [[Corman Common Lisp]]: for Microsoft Windows. In January 2015 Corman Lisp has been published under MIT license.<ref>{{cite web|title=Corman Lisp sources are now available|url=http://lispblog.xach.com/post/107215169193/corman-lisp-sources-are-now-available}}</ref><br />
; [[Embeddable Common Lisp]] (ECL) : ECL includes a bytecode interpreter and compiler. It can also compile Lisp code to machine code via a C compiler. ECL then compiles Lisp code to C, compiles the C code with a C compiler and can then load the resulting machine code. It is also possible to embed ECL in [[C (programming language)|C]] programs, and C code into Common Lisp programs.<br />
; [[GNU Common Lisp]] (GCL) : The [[GNU]] Project's Lisp compiler. Not yet fully ANSI-compliant, GCL is however the implementation of choice for several large projects including the mathematical tools [[Maxima (software)|Maxima]], [[Axiom (computer algebra system)|AXIOM]] and (historically) [[ACL2]]. GCL runs on [[Linux]] under eleven different architectures, and also under Windows, Solaris, and [[FreeBSD]].<br />
; [[Macintosh Common Lisp]] (MCL) : Version 5.2 for Apple Macintosh computers with a PowerPC processor running Mac OS X is open source. RMCL (based on MCL 5.2) runs on Intel-based Apple Macintosh computers using the Rosetta binary translator from Apple.<br />
; [[ManKai Common Lisp]] (MKCL) : A branch of [[Embeddable Common Lisp|ECL]]. MKCL emphasises reliability, stability and overall code quality through a heavily reworked, natively multi-threaded, runtime system. On Linux, MKCL features a fully POSIX compliant runtime system.<br />
; [[Movitz]]: Implements a Lisp environment for [[x86]] computers without relying on any underlying OS.<br />
; [[Poplog]]: Poplog implements a version of CL, with [[POP-11]], and optionally [[Prolog]], and [[Standard ML]] (SML), allowing mixed language programming. For all, the implementation language is POP-11, which is compiled incrementally. It also has an integrated [[Emacs]]-like editor that communicates with the compiler.<br />
; [[Steel Bank Common Lisp]] (SBCL) : A branch from [[CMUCL]]. "Broadly speaking, SBCL is distinguished from CMU CL by a greater emphasis on maintainability."<ref>{{cite web<br />
| url = http://sbcl.sourceforge.net/history.html<br />
| title = History and Copyright | work = Steel Bank Common Lisp<br />
}}</ref> SBCL runs on the platforms CMUCL does, except HP/UX; in addition, it runs on Linux for AMD64, PowerPC, SPARC, MIPS, Windows x86<ref>{{cite web<br />
| url = http://www.sbcl.org/platform-table.html<br />
| title = Platform Table | work = Steel Bank Common Lisp<br />
}}</ref> and has experimental support for running on Windows AMD64. SBCL does not use an interpreter by default; all expressions are compiled to native code unless the user switches the interpreter on. The SBCL compiler generates fast native code.<ref>[http://benchmarksgame.alioth.debian.org/u32q/benchmark.php?test=all&lang=all SBCL ranks above other dynamic language implementations in the 'Computer Language Benchmark Game']</ref><br />
; [[Ufasoft Common Lisp]]: port of CLISP for windows platform with core written in C++.<br />
<br />
====Other implementations====<br />
{{unreferenced section|date=July 2013}}<br />
; Austin Kyoto Common Lisp : an evolution of [[Kyoto Common Lisp]]<br />
; Butterfly Common Lisp : an implementation written in Scheme for the [[BBN Butterfly]] multi-processor computer<br />
; CLICC : a Common Lisp to C compiler<br />
; CLOE : Common Lisp for PCs by [[Symbolics]]<br />
; Codemist Common Lisp : used for the commercial version of the computer algebra system Axiom<br />
; ExperCommon Lisp : an early implementation for the Apple Macintosh by ExperTelligence<br />
; [[Golden Common Lisp]]: an implementation for the PC by GoldHill Inc.<br />
; Ibuki Common Lisp : a commercialized version of Kyoto Common Lisp<br />
; [[Kyoto Common Lisp]]: the first Common Lisp compiler that used C as a target language. GCL, ECL and MKCL originate from this Common Lisp implementation.<br />
; L : a small version of Common Lisp for embedded systems developed by IS Robotics, now iRobot<br />
; [[Lisp Machine]]s (from [[Symbolics]], TI and Xerox): provided implementations of Common Lisp in addition to their native Lisp dialect (Lisp Machine Lisp or Interlisp). CLOS was also available. Symbolics provides a version of Common Lisp that is based on ANSI Common Lisp.<br />
; Procyon Common Lisp : an implementation for Windows and Mac OS, used by Franz for their Windows port of Allegro CL<br />
; Star Sapphire Common LISP : an implementation for the PC<br />
; [[SubL]]: a variant of Common Lisp used for the implementation of the [[Cyc]] knowledge-based system<br />
; Top Level Common Lisp : an early implementation for concurrent execution<br />
; WCL : a shared library implementation<br />
; [[Vax Common Lisp]]: [[Digital Equipment Corporation]]'s implementation that ran on [[VAX]] systems running [[OpenVMS|VMS]] or [[ULTRIX]]<br />
; [[XLISP]] by David Betz<br />
<br />
==Applications==<br />
See the Category [[:Category:Common Lisp software|Common Lisp software]].<br />
<br />
Common Lisp is used to develop research applications (often in Artificial Intelligence), for rapid development of prototypes or for deployed applications.<br />
<br />
Common Lisp is used in many commercial applications, including the [[Yahoo!]] Store web-commerce site, which originally involved [[Paul Graham (computer programmer)|Paul Graham]] and was later rewritten in C++ and Perl.<ref name="doubt-not-corporate-foolishness">"In January 2003, Yahoo released a new version of the editor written in C++ and Perl. It's hard to say whether the program is no longer written in Lisp, though, because to translate this program into C++ they literally had to write a Lisp interpreter: the source files of all the page-generating templates are still, as far as I know, Lisp code." [[Paul Graham (computer programmer)|Paul Graham]], [http://www.paulgraham.com/avg.html Beating the Averages]</ref> Other notable examples include:<br />
<br />
* [[ACT-R]], a cognitive architecture used in a large number of research projects.<br />
* Authorizer's Assistant,<ref>[http://www.aaai.org/Papers/IAAI/1989/IAAI89-031.pdf Authorizer's Assistant]</ref><ref>[http://www.prenhall.com/divisions/bp/app/alter/student/useful/ch9amex.html American Express Authorizer's Assistant]</ref> a large rule-based system used by American Express, analyzing credit requests.<br />
* [[Cyc]], a long running project with the aim to create a knowledge-based system that provides a huge amount of common sense knowledge<br />
* The [[Dynamic Analysis and Replanning Tool]] (DART), which is said to alone have paid back during the years from 1991 to 1995 for all thirty years of [[DARPA]] investments in AI research.<br />
* G2 from Gensym, a real-time business rules engine (BRE)<ref>[http://www.gensym.com/index.php?option=com_content&view=article&id=47&Itemid=54 Real-time Application Development]. Gensym. Retrieved on 2013-07-17.</ref><br />
* [http://www.genworks.com Genworks GDL], based on the open-source [http://github.com/genworks/gendl Gendl] kernel.<br />
* The development environment for the [[Jak and Daxter]] video game series, developed by [[Naughty Dog]].<br />
* [[ITA Software]]'s low fare search engine, used by travel websites such as [[Orbitz]] and [[Kayak.com]] and airlines such as [[American Airlines]], [[Continental Airlines]] and [[US Airways]].<br />
* [[Mirai (software)|Mirai]], a 3d graphics suite. It was used to animate the face of Gollum in the movie Lord of the Rings: The Two Towers.<br />
* [[Prototype Verification System]] (PVS), a mechanized environment for formal specification and verification.<br />
* PWGL is a sophisticated visual programming environment based on Common Lisp, used in [[Computer assisted composition]] and sound synthesis.<ref>[http://www2.siba.fi/PWGL/ PWGL - Home]. . Retrieved on 2013-07-17.</ref> <br />
* SPIKE, a scheduling system for earth or space based observatories and satellites, notably the Hubble Space Telescope.<ref>[http://www.stsci.edu/resources/software_hardware/spike/ Spike Planning and Scheduling System]. Stsci.edu. Retrieved on 2013-07-17.</ref><br />
<br />
There also exist open-source applications written in Common Lisp, such as:<br />
<br />
* [[ACL2]], a full-featured [[automated theorem prover]] for an [[applicative programming language|applicative]] variant of Common Lisp.<br />
* [[Axiom (computer algebra system)|Axiom]], a sophisticated [[computer algebra system]].<br />
* [[Maxima (software)|Maxima]], a sophisticated [[computer algebra system]].<br />
* [[OpenMusic]] is an object-oriented visual programming environment based on Common Lisp, used in [[Computer assisted composition]].<br />
* [[Stumpwm]], a tiling, keyboard driven X11 Window Manager written entirely in Common Lisp.<br />
<br />
==Libraries==<br />
<br />
Since 2011 Zach Beane, with support of the Common Lisp Foundation, maintains the [[Quicklisp]] library manager. It allows easy access to several hundred libraries written in Common Lisp.<br />
<br />
==See also==<br />
{{Portal|Computer Science|Computer programming}}<br />
*''[[Common Lisp the Language]]''<br />
*''[[On Lisp]]''<br />
*''[[Practical Common Lisp]]''<br />
{{Clear}}<br />
<br />
==References==<br />
{{Reflist|2}}<br />
<br />
==Bibliography==<br />
A chronological list of books published (or about to be published) about Common Lisp (the language) or about programming with Common Lisp (especially AI programming).<br />
{{Refbegin|2}}<br />
* [[Guy L. Steele]]: ''Common Lisp the Language, 1st Edition'', Digital Press, 1984, ISBN 0-932376-41-X<br />
* [[Rodney Allen Brooks]]: ''Programming in Common Lisp'', John Wiley and Sons Inc, 1985, ISBN 0-471-81888-7<br />
* [[Richard P. Gabriel]]: ''Performance and Evaluation of Lisp Systems'', The MIT Press, 1985, ISBN 0-262-57193-5, [http://www.dreamsongs.com/Files/Timrep.pdf PDF]<br />
* [[Robert Wilensky]]: ''Common LISPcraft'', W.W. Norton & Co., 1986, ISBN 0-393-95544-3<br />
* [[Eugene Charniak]], [[Christopher K. Riesbeck]], [[Drew V. McDermott]], [[James R. Meehan]]: ''Artificial Intelligence Programming, 2nd Edition'', Lawrence Erlbaum, 1987, ISBN 0-89859-609-2<br />
* [[Wendy L. Milner]]: ''Common Lisp: A Tutorial'', Prentice Hall, 1987, ISBN 0-13-152844-0<br />
* [[Deborah G. Tatar]]: ''A Programmer's Guide to Common Lisp'', Longman Higher Education, 1987, ISBN 0-13-728940-5<br />
* [[Taiichi Yuasa]], [[Masami Hagiya]]: ''Introduction to Common Lisp'', Elsevier Ltd, 1987, ISBN 0-12-774860-1<br />
* [[Christian Queinnec]], [[Jerome Chailloux]]: ''Lisp Evolution and Standardization'', Ios Pr Inc., 1988, ISBN 90-5199-008-1<br />
* [[Taiichi Yuasa]], [[Richard Weyhrauch]], [[Yasuko Kitajima]]: ''Common Lisp Drill'', Academic Press Inc, 1988, ISBN 0-12-774861-X<br />
* [[Wade L. Hennessey]]: ''Common Lisp'', McGraw-Hill Inc., 1989, ISBN 0-07-028177-7<br />
* [[Tony Hasemer]], [[John Dominque]]: ''Common Lisp Programming for Artificial Intelligence'', Addison-Wesley Educational Publishers Inc, 1989, ISBN 0-201-17579-7<br />
* [[Sonya E. Keene]]: ''Object-Oriented Programming in Common Lisp: A Programmer's Guide to CLOS'', Addison-Wesley, 1989, ISBN 0-201-17589-4<br />
* [[David Jay Steele]]: ''Golden Common Lisp: A Hands-On Approach'', Addison Wesley, 1989, ISBN 0-201-41653-0<br />
* [[David S. Touretzky]]: ''Common Lisp: A Gentle Introduction to Symbolic Computation'', Benjamin-Cummings, 1989, ISBN 0-8053-0492-4. [http://www.cs.cmu.edu/~dst/LispBook/ Web/PDF] Dover reprint (2013) ISBN 978-0486498201<br />
* [[Christopher K. Riesbeck]], [[Roger C. Schank]]: ''Inside Case-Based Reasoning'', Lawrence Erlbaum, 1989, ISBN 0-89859-767-6<br />
* [[Patrick Winston]], [[Berthold Horn]]: ''Lisp, 3rd Edition'', Addison-Wesley, 1989, ISBN 0-201-08319-1, [http://people.csail.mit.edu/phw/Books/LISPBACK.HTML Web]<br />
* [[Gerard Gazdar]], [[Chris Mellish]]: ''Natural Language Processing in LISP: An Introduction to Computational Linguistics'', Addison-Wesley Longman Publishing Co., 1990, ISBN 0-201-17825-7<br />
* [[Patrick R. Harrison]]: ''Common Lisp and Artificial Intelligence'', Prentice Hall PTR, 1990, ISBN 0-13-155243-0<br />
* [[Timothy Koschmann]]: ''The Common Lisp Companion'', John Wiley & Sons, 1990, ISBN 0-471-50308-8<br />
* [[Molly M. Miller]], [[Eric Benson]]: ''Lisp Style & Design'', Digital Press, 1990, ISBN 1-55558-044-0<br />
* [[Guy L. Steele]]: ''[[Common Lisp the Language]], 2nd Edition'', Digital Press, 1990, ISBN 1-55558-041-6, [http://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html Web]<br />
* [[Steven L. Tanimoto]]: ''The Elements of Artificial Intelligence Using Common Lisp'', Computer Science Press, 1990, ISBN 0-7167-8230-8<br />
* [[Peter Lee (computer scientist)|Peter Lee]]: ''Topics in Advanced Language Implementation'', The MIT Press, 1991, ISBN 0-262-12151-4<br />
* [[John H. Riley]]: ''A Common Lisp Workbook'', Prentice Hall, 1991, ISBN 0-13-155797-1<br />
* [[Peter Norvig]]: ''Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp'', Morgan Kaufmann, 1991, ISBN 1-55860-191-0, [http://norvig.com/paip.html Web]<br />
* [[Gregor Kiczales]], [[Jim des Rivieres]], [[Daniel G. Bobrow]]: ''The Art of the Metaobject Protocol'', The MIT Press, 1991, ISBN 0-262-61074-4<br />
* [[Jo A. Lawless]], [[Molly M. Miller]]: ''Understanding CLOS: The Common Lisp Object System'', Digital Press, 1991, ISBN 0-13-717232-X<br />
* Mark Watson: ''Common Lisp Modules: Artificial Intelligence in the Era of Neural Networks and Chaos Theory'', Springer Verlag New York Inc., 1991, ISBN 0-387-97614-0<br />
* [[James L. Noyes]]: ''Artificial Intelligence with Common Lisp: Fundamentals of Symbolic and Numeric Processing'', Jones & Bartlett Pub, 1992, ISBN 0-669-19473-5<br />
* [[Stuart C. Shapiro]]: ''COMMON LISP: An Interactive Approach'', Computer Science Press, 1992, ISBN 0-7167-8218-9, [http://www.cse.buffalo.edu/pub/WWW/faculty/shapiro/Commonlisp/ Web/PDF]<br />
* [[Kenneth D. Forbus]], [[Johan de Kleer]]: ''Building Problem Solvers'', The MIT Press, 1993, ISBN 0-262-06157-0<br />
* [[Andreas Paepcke]]: ''Object-Oriented Programming: The CLOS Perspective'', The MIT Press, 1993, ISBN 0-262-16136-2<br />
* [[Paul Graham (computer programmer)|Paul Graham]]: ''[[On Lisp]]'', Prentice Hall, 1993, ISBN 0-13-030552-9, [http://www.paulgraham.com/onlisp.html Web/PDF]<br />
* [[Paul Graham (computer programmer)|Paul Graham]]: ''ANSI Common Lisp'', Prentice Hall, 1995, ISBN 0-13-370875-6<br />
* [[Otto Mayer]]: ''Programmieren in Common Lisp'', German, Spektrum Akademischer Verlag, 1995, ISBN 3-86025-710-2<br />
* [[Stephen Slade]]: ''Object-Oriented Common Lisp'', Prentice Hall, 1997, ISBN 0-13-605940-6<br />
* [[Richard P. Gabriel]]: ''Patterns of Software: Tales from the Software Community'', Oxford University Press, 1998, ISBN 0-19-512123-6, [http://www.dreamsongs.org/Files/PatternsOfSoftware.pdf PDF]<br />
* [[Taiichi Yuasa]], [[Hiroshi G. Okuno]]: ''Advanced Lisp Technology'', CRC, 2002, ISBN 0-415-29819-9<br />
* [[David B. Lamkins]]: ''Successful Lisp: How to Understand and Use Common Lisp'', bookfix.com, 2004. ISBN 3-937526-00-5, [http://www.psg.com/~dlamkins/sl/contents.html Web]<br />
* [[Peter Seibel]]: ''[[Practical Common Lisp]]'', Apress, 2005. ISBN 1-59059-239-5, [http://www.gigamonkeys.com/book/ Web]<br />
* [[Doug Hoyte]]: ''Let Over Lambda'', Lulu.com, 2008, ISBN 1-4357-1275-7, [http://letoverlambda.com/ Web]<br />
* [[George F. Luger]], [[William A. Stubblefield]]: ''AI Algorithms, Data Structures, and Idioms in Prolog, Lisp and Java'', Addison Wesley, 2008, ISBN 0-13-607047-7, [http://wps.aw.com/wps/media/objects/5771/5909832/PDF/Luger_0136070477_1.pdf PDF]<br />
* [[Conrad Barski]]: ''Land of Lisp: Learn to program in Lisp, one game at a time!'', No Starch Press, 2010, ISBN 1-59327-200-6, [http://www.lisperati.com/landoflisp/ Web]<br />
* [[Pavel Penev]]: ''Lisp Web Tales'', Leanpub, 2013, [https://leanpub.com/lispwebtales Web]<br />
{{Refend}}<br />
<br />
==External links==<br />
{{Wikibooks}}<br />
* The [http://www.cliki.net/ CLiki], a Wiki for [[free and open source software|free and open source]] Common Lisp systems running on Unix-like systems.<br />
* [http://www.common-lisp.net/ Common Lisp software repository].<br />
* {{cite web | url = http://www.lispworks.com/documentation/HyperSpec/Body/01_ab.htm | title = History | work = [[Common Lisp HyperSpec]] }}<br />
* [http://www.flownet.com/gat/jpl-lisp.html Lisping at JPL]<br />
* [http://www.defmacro.org/ramblings/lisp.html The Nature of Lisp] Essay that examines Lisp by comparison with XML.<br />
* [http://common-lisp.net/~dlw/LispSurvey.html Common Lisp Implementations: A Survey] Survey of maintained Common Lisp implementations.<br />
* [http://clqr.boundp.org Common Lisp Quick Reference]<br />
* [http://planet.lisp.org Planet Lisp] Articles about Common Lisp.<br />
<br />
{{Common Lisp}}<br />
<br />
[[Category:Common Lisp]]<br />
[[Category:Multi-paradigm programming languages]]<br />
[[Category:Functional languages]]<br />
[[Category:Dynamically typed programming languages]]<br />
[[Category:Dynamic programming languages]]<br />
[[Category:Object-oriented programming languages]]<br />
[[Category:Class-based programming languages]]<br />
[[Category:Procedural programming languages]]<br />
[[Category:Extensible syntax programming languages]]<br />
[[Category:Lisp programming language family]]<br />
[[Category:Lisp (programming language)]]<br />
[[Category:Articles with example Lisp code]]<br />
[[Category:Cross-platform software]]<br />
[[Category:Cross-platform free software]]<br />
[[Category:Programming languages created in 1984]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=GNU_Libtool&diff=689821065GNU Libtool2015-11-09T16:39:57Z<p>PuercoPop: Fix double definition of libtool manual reference</p>
<hr />
<div>{{Multiple issues|<br />
{{refimprove|date=November 2010}}<br />
{{lead too short|date=November 2010}}<br />
{{context|date=November 2010}}<br />
}}<br />
<br />
{{ infobox software<br />
| name = GNU Libtool<br />
| logo = [[File:Libtool.jpg|frameless]]<br />
| developer = [[GNU Project]]<ref>{{cite web|url=http://directory.fsf.org/wiki/GNU|title=GNU|accessdate=25 June 2012}}</ref><br />
| released = {{Start date and age|1997|07|09}}<br />
| operating_system = [[Cross-platform]]<br />
| genre = [[Library (computing)|Library]]<br />
| license = [[GNU General Public License|GPLv2]]<br />
| website = [https://www.gnu.org/software/libtool/ gnu.org/s/libtool]<br />
}}<br />
<br />
'''GNU Libtool''' is a [[computer programming]] tool from the [[GNU build system]] used for creating portable compiled [[library (computer science)|libraries]].<br />
<br />
== Rationale ==<br />
<br />
Different [[operating system]]s handle [[shared library|shared libraries]] in different ways, and some platforms do not use shared libraries at all. It can be difficult to make a software program portable: the C compiler differs from system to system; certain library functions are missing on some systems; header files may have different names. One way to handle this is to write conditional code, with code blocks selected by means of preprocessor directives (<code>#ifdef</code>); but because of the wide variety of build environments this approach quickly becomes unmanageable. The GNU build system is designed to address this problem more manageably.<br />
<br />
Libtool helps manage the creation of [[static library|static]] and [[dynamic library|dynamic]] [[library (computing)|libraries]] on various [[Unix-like]] operating systems. Libtool accomplishes this by abstracting the library-creation process, hiding differences between various systems (e.g. [[GNU/Linux]] systems vs. [[Solaris (operating system)|Solaris]]).<br />
<br />
GNU Libtool is designed to simplify the process of compiling a computer program on a new system, by "encapsulating both the platform-specific dependencies, and the user interface, in a single script".<ref name="Libtool manual">[https://www.gnu.org/software/libtool/manual/libtool.html Libtool Manual]</ref> When porting a program to a new system, Libtool is designed so the porter need not read low-level documentation for the shared libraries to be built, rather just run a ''configure'' script (or equivalent).<ref name="Libtool manual"></ref><br />
<br />
== Use ==<br />
<br />
Libtool is typically used with [[Autoconf]] and [[Automake]], two other tools of the GNU build system. However, it is designed so as not to be dependent upon either.<ref name="other-implementations">[https://www.gnu.org/software/libtool/manual/libtool.html#Other-implementations Other-implementations]</ref><br />
<br />
== Clones and derivatives ==<br />
<br />
Since GNU Libtool was released, other open source projects have created drop-in replacements under different [[software license|software licenses]].<ref name="BSD-licensed libtool">[http://BXR.SU/OpenBSD/usr.bin/libtool/ BSD-licensed libtool].</ref><br />
<br />
== See also ==<br />
{{Portal|Free software}}<br />
<br />
* [[GNU Compiler Collection]]<br />
* [[GNU build system]]<br />
<br />
== References ==<br />
<br />
{{reflist}}<br />
<br />
== External links ==<br />
<br />
* {{official website}}<br />
* [http://sources.redhat.com/autobook/ Autobook homepage]<br />
* [http://www.lrde.epita.fr/~adl/autotools.html Autotools Tutorial]<br />
* [http://metastatic.org/text/libtool.html Avoiding libtool minefields when cross-compiling]<br />
* [https://autotools.io/ Autotools Mythbuster]<br />
<br />
{{GNU}}<br />
<br />
[[Category:Compiling tools]]<br />
[[Category:GNU Project software|Libtool]]<br />
[[Category:Free computer libraries]]<br />
[[Category:Cross-platform software]]<br />
<br />
<br />
{{programming-software-stub}}</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Racket_(programming_language)&diff=689243643Racket (programming language)2015-11-05T21:24:01Z<p>PuercoPop: /* Code examples */ Add stylistic newline to separate requires from code</p>
<hr />
<div>{{Infobox programming language<br />
| name = Racket<br />
| logo = [[File:Racket logo.png]]<br />
| paradigm = [[multi-paradigm programming language|Multi-paradigm]]: [[functional programming|functional]], [[procedural programming|procedural]], [[modular programming|modular]], [[object-oriented programming|object-oriented]], [[logic programming|logic]], [[reflection (computer science)|reflective]], [[metaprogramming|meta]]<br />
|screenshot = [[File:Drracket.png|thumb|DrRacket on Ubuntu GNU/Linux]]<br />
| year = 1994<br />
| designer = PLT Inc.<br />
| developer = PLT Inc.<br />
| latest_release_version = 6.2.1<ref name="latestversion">[http://blog.racket-lang.org/2015/08/racket-v621.html Racket blog]</ref><br />
| latest_release_date = {{Start date and age|2015|8|10}}<br />
| frequently updated = yes<br />
| typing = [[dynamic typing|Dynamic]], [[strong typing|strong]], [[static typing|static]]<br />
| implementations =<br />
| dialects = [http://docs.racket-lang.org/ts-guide/ Typed Racket], [http://docs.racket-lang.org/lazy/ Lazy Racket], [http://docs.racket-lang.org/scribble/ Scribble], [http://docs.racket-lang.org/frtime/ FrTime], more<br />
| influenced = [[Scheme (programming language)|Scheme]],<ref name="r6rs">{{cite web |url=http://www.r6rs.org |title=Revised<sup>6</sup> Report on the Algorithmic Language Scheme (R6RS) |last1=Sperber |first1=Michael |last2=Dybvig |first2=R. Kent |last3=Flatt |first3=Matthew |last4=Van Straaten |first4=Anton|date=August 2007 |publisher=Scheme Steering Committee |accessdate=2011-09-13|display-authors=etal}}</ref> [[Rust (programming language)|Rust]],<ref>{{cite web|url=https://mail.mozilla.org/pipermail/rust-dev/2013-May/003947.html|title=Planet2 questions}}</ref> [[Clojure]]<ref name="typed-clojure-thesis">{{cite thesis|last=Bonnaire-Sergeant|first=Ambrose|title=A Practical Optional Type System for Clojure|publisher=The University of Western Australia|year=2012}}</ref><br />
| influenced_by = [[Scheme (programming language)|Scheme]], [[Eiffel (programming language)|Eiffel]]<ref>{{cite web |url=http://www.ccs.neu.edu/racket/pubs/dls10-sf.pdf |title=DLS 2010: Contracts for First-Class Classes |last1=Strickland |first1=T.S. |last2=Fellesisen |first2=Matthias |year=2010}}</ref><br />
| standard = [[R5RS]], [[R6RS]]<br />
| operating_system = [[Cross-platform]]<br />
| platform = [[x86]], [[PowerPC]], [[SPARC]], [[MIPS architecture|MIPS]], [[ARM architecture|ARM]]<br />
| license = [[GNU Lesser General Public License|LGPL]]<br />
| website = {{URL|racket-lang.org}}<br />
| file ext = <code>.rkt</code>, <code>.rktl</code>, <code>.rktd</code>, <code>.scrbl</code>, <code>.plt</code>, <code>.ss</code>, <code>.scm</code><br />
}}<br />
<br />
'''Racket''' (formerly named '''PLT Scheme''') is a [[General-purpose programming language|general purpose]], [[multi-paradigm programming language]] in the [[Lisp (programming language)|Lisp]]/[[Scheme (programming language)|Scheme]] family. One of its design goals is to serve as a platform for language creation, design, and implementation.<ref>{{cite web | title = Welcome to Racket | url = http://docs.racket-lang.org/guide/intro.html | accessdate = 2011-08-15}}</ref><ref>{{cite web | title = Dialects of Racket and Scheme | url = http://docs.racket-lang.org/guide/dialects.html | accessdate = 2011-08-15}}</ref> The language is used in a variety of contexts such as [[script (computing)|scripting]], general-purpose programming, computer science education, and research.<br />
<br />
The platform provides an implementation of the Racket language (including a sophisticated [[run-time system]],<ref name="mred"/> various libraries, [[just-in-time compilation|JIT compiler]], and more) along with a development environment called DrRacket (formerly named DrScheme) written in Racket itself.<ref name="drscheme"/> The IDE and an accompanying programming curriculum is used in the [[ProgramByDesign]] outreach program, an attempt to turn computing and programming into "an indispensable part of the liberal arts curriculum".<ref name="teachscheme">{{cite news| last1=Felleisen | last2=Findler | last3=Flatt | last4=Krishnamurthi | year = 2004 | url = http://www.ccs.neu.edu/scheme/pubs/#cse2003-fffk | title = The TeachScheme! Project: Computing and Programming for Every Student | journal = Journal of Computer Science Education}}</ref><ref>{{cite web|url=http://programbydesign.org/overview |title=Overview |publisher=Program by Design |date= |accessdate=2011-08-17}}</ref> The core language is known for its extensive [[macro (computer science)|macro]] system which enables the creation of embedded and [[domain-specific language]]s, language constructs such as [[class (computer programming)|classes]] or [[modular programming|modules]], and separate dialects of Racket with different [[semantics of programming languages|semantics]].<ref name="macros-matter">{{cite web | title = Macros Matter | url = http://blog.racket-lang.org/2007/05/macros-matter.html | accessdate=2011-08-08 | date=2007-05-03}}</ref><ref name="scheme-with-classes">{{cite conference<br />
| last1 = Flatt | first1 = M.<br />
| last2 = Findler | first2 = R. B.<br />
| last3 = Felleisen | first3 = M.<br />
| title = Scheme with Classes, Mixins, and Traits<br />
| booktitle = Asian Symposium on Programming Languages and Systems<br />
| year = 2006<br />
| url = http://www.ccs.neu.edu/scheme/pubs/asplas06-fff.pdf}}<br />
</ref><ref name="units">{{cite conference<br />
| last1 = Flatt | first1 = M.<br />
| last2 = Felleisen | first2 = M.<br />
| title = Units: Cool Modules for Hot Languages<br />
| booktitle = Programming Language Design and Implementation<br />
| year = 1998<br />
| url = http://www.ccs.neu.edu/scheme/pubs/pldi98-ff.ps.gz}}<br />
</ref><ref name="languages-as-libraries">{{cite conference<br />
| last1 = Tobin-Hochstadt | first1 = S.<br />
| last2 = St-Amour | first2 = V.<br />
| last3 = Culpepper | first3 = R.<br />
| last4 = Flatt | first4 = M.<br />
| last5 = Felleisen | first5 = M.<br />
| title = Languages as Libraries<br />
| booktitle = Programming Language Design and Implementation<br />
| year = 2011<br />
| url = http://www.ccs.neu.edu/scheme/pubs/pldi11-thacff.pdf}}<br />
</ref><br />
<br />
The platform distribution is [[free and open source software]] distributed under the [[LGPL]]<br />
license.<ref name="racket-lgpl-license">{{cite web | title = Racket: Software License | url = http://download.racket-lang.org/license.html | accessdate=2015-10-20}}</ref> Extensions and packages written by the community are uploaded to Racket's centralized [http://pkgs.racket-lang.org/ package catalog].<br />
<br />
== History ==<br />
<br />
=== Development ===<br />
<br />
[[Matthias Felleisen]] founded PLT in the mid 1990s, first as a research group, soon after as a project dedicated to the production of [[pedagogic]] materials for novice programmers (lectures, exercises/projects, software). In January 1995, the group decided to develop a pedagogic programming environment based on [[Scheme (programming language)|Scheme]]. [[Matthew Flatt]] cobbled together MrEd—the original [[virtual machine]] for Racket—from libscheme,<ref name="libscheme">{{cite conference |url=https://www.usenix.org/legacy/publications/library/proceedings/vhll/benson.html |title=libscheme: Scheme as a C Library |last=Benson |first=Brent W. Jr. |date=October 26–28, 1994 |publisher=USENIX Association |publication-place=Berkeley, CA |booktitle=Proceedings of the USENIX Symposium on Very High Level Languages |pages=7–19 |location=Santa Fe, NM |isbn=978-1880446652 |accessdate=July 7, 2013}}</ref> [[wxWidgets]], and a few other free systems.<ref name="gui-rebuild">{{cite web | title = Rebuilding Racket's Graphics Layer | accessdate = 2011-08-23 | date = 2010-12-08 | url = http://blog.racket-lang.org/2010/12/racket-version-5.html}}</ref> In the years that followed, a team including Flatt, [[Robert Bruce Findler|Robby Findler]], [[Shriram Krishnamurthi]], Cormac Flanagan, and many others produced '''DrScheme''', a programming environment for novice Scheme programmers and a research environment for [[type system#Combining static and dynamic type-checking|soft typing]].<ref name="drscheme">{{cite journal|title=DrScheme: A Programming Environment for Scheme|journal=Journal of Functional Programming|last1=Findler|last2=Clements|last3=Flanagan|last4=Flatt|last5=Krishnamurthi|last6=Steckler|last7=Felleisen|url=http://www.ccs.neu.edu/racket/pubs/jfp01-fcffksf.pdf|year=2001}}</ref> The main development language that DrScheme supported was called PLT Scheme.<br />
<br />
In parallel, the team started conducting workshops for high school teachers, training them in program design and functional programming. Field tests with these teachers and their students provided essential clues for the direction of the development.<br />
<br />
Over the following years, PLT added teaching languages, an algebraic stepper,<ref>{{cite conference | last1 = Clements | first1 = J. | last2 = Flatt | first2 = M. | last3 = Felleisen | first3 = M. | title = Modeling an Algebraic Stepper | booktitle = European Symposium on Programming Languages | year = 2001 | url = http://www.ccs.neu.edu/scheme/pubs/esop2001-cff.pdf}}</ref> a transparent [[REPL|read-eval-print loop]], a constructor-based printer, and many other innovations to DrScheme, producing an application-quality pedagogic program development environment. By 2001, the core team (Felleisen, Findler, Flatt, Krishnamurthi) had also written and published their first textbook, ''[[How to Design Programs]]'', based on their teaching philosophy.<br />
<br />
=== Version history ===<br />
<br />
The first generation of PLT Scheme revisions introduced features for [[programming in the large and programming in the small#Programming in the large|programming in the large]] with both [[modular programming|modules]] and [[class (computer programming)|classes]]. Version 42 introduced units — a first-class module system — to complement classes for large scale development.<ref name="release-notes">{{cite web|title=Racket Core Release Notes|url=http://docs.racket-lang.org/release-notes/racket/HISTORY.txt|accessdate=2012-04-15}}</ref> The class system gained features (e.g. [[Java (programming language)|Java]]-style [[protocol (object-oriented programming)|interfaces]]) and also lost several features (e.g. [[multiple inheritance]]) throughout these versions.<ref name="scheme-with-classes" /> The language evolved throughout a number of successive versions, and gaining milestone popularity in Version 53, leading to extensive work and the following Version 100, which would be equivalent to a "1.0" release in current popular version systems.<br />
<br />
The next major revision was named Version 200, which introduced a new default module system that cooperates with macros.<ref name="release-notes" /> In particular, the module system ensures that run-time and [[compile-time]] computation are separated to support a "tower of languages."<ref>{{cite conference | title = Composable and Compilable Macros | last = Flatt | first = M. | booktitle = International Conference on Functional Programming | year = 2002}}</ref> Unlike units, these modules are not [[first-class object]]s.<br />
<br />
Version 300 introduced [[Unicode]] support, [[foreign function interface|foreign library]] support, and refinements to the class system.<ref name="release-notes" /> Later on, the 300 series improved the [[computer performance|performance]] of the language runtime with an addition of a JIT compiler and a switch to a default [[generational garbage collection]].<br />
<br />
By the next major release, the project had switched to a more conventional [[software versioning#Sequence-based identifiers|sequence-based]] version numbering. Version 4.0 introduced the <code>#lang</code> shorthand to specify the language that a module is written in. In addition, the revision introduced [[immutable object|immutable]] pairs and lists, support for fine-grained [[parallel computing|parallelism]], and a [[Static typing|statically-typed]] dialect.<ref name="4.0">{{cite web|url=http://blog.racket-lang.org/2008/06/plt-scheme-version-4.html|title=PLT Scheme version 4.0|date=2008-06-12|accessdate=2012-08-07}}</ref><br />
<br />
=== Racket ===<br />
<br />
On June 7, 2010, PLT Scheme was renamed Racket.<ref>{{cite web|url=http://racket-lang.org/new-name.html |title=From PLT Scheme to Racket |publisher=Racket-lang.org |date= |accessdate=2011-08-17}}</ref> The renaming coincided with the release of Version 5.0. Subsequently, the GUI backend was rewritten in Racket from [[C++]] in Version 5.1 using native [[widget toolkit|UI toolkits]] on all platforms.<ref name="gui-rebuild" /> Version 5.2 included a background [[Static code analysis|syntax checking]] tool, a new plotting library, a database library, and a new extended REPL.<ref name="5.2">{{cite web |url=http://blog.racket-lang.org/2011/11/racket-v52.html |title=Racket 5.2 |publisher=PLT, Inc |date=2011-11-09 |accessdate=2012-06-16}}</ref> Version 5.3 included a new submodule feature for optionally loaded modules,<ref name="submodules">{{cite web|url=http://blog.racket-lang.org/2012/06/submodules.html|title=Submodules|date=2012-06-03|accessdate=2012-08-07}}</ref> new [[Program optimization|optimization]] tools, a [[JSON]] library, and other features.<ref name="5.3">{{cite web |url=http://blog.racket-lang.org/2012/08/racket-v53.html |title=Racket 5.3 |publisher=PLT, Inc |date=2012-08-07 |accessdate=2012-08-07}}</ref> Version 5.3.1 introduced major improvements to DrRacket: the background syntax checker was turned on by default and a new documentation preview tool was added.<ref name="5.3.1">{{cite web |url=http://blog.racket-lang.org/2012/11/racket-v531.html |title=Racket 5.3.1 |publisher=PLT, Inc |date=2012-11-07|accessdate=2012-11-07}}</ref><br />
<br />
== Features ==<br />
{{Main|Racket features}}<br />
<br />
Racket's core language includes [[macro (computer science)#Syntactic macros|macros]], [[modular programming|modules]], [[closure (computer science)|lexical closures]], [[tail call]]s, [[delimited continuation]]s,<ref name=icfp2007/> parameters (fluid variables), [[design by contract|software contracts]],<ref>{{cite web | title = Contracts | url = http://docs.racket-lang.org/guide/contracts.html}}</ref> [[green threads|green]] and OS [[thread (computer science)|threads]],<ref>{{cite web | title = Threads | url = http://docs.racket-lang.org/reference/threads.html}}</ref><ref>{{cite web | title = Futures | url = http://docs.racket-lang.org/reference/futures.html}}</ref><ref>{{cite web | title = Places | url = http://docs.racket-lang.org/reference/places.html}}</ref> and more. The language also comes with primitives, such as eventspaces and custodians, which control resource management and enables the language to act like an [[operating system]] for loading and managing other programs.<ref name="mred"/> Further extensions to the language are created with the powerful macro system, which together with the module system and custom parsers can control all aspects of a language.<ref name="creating-languages">{{Cite news | last = Flatt | first = Matthew | title = Creating Languages in Racket | newspaper = Communications of the ACM | year = 2012 | url = http://cacm.acm.org/magazines/2012/1/144809-creating-languages-in-racket | accessdate = 2012-04-08 | postscript = .}}</ref> Unlike programming languages that lack macro systems, most language constructs in Racket are written on top of the base language using macros. These include a [[mixin]] class system,<ref name="scheme-with-classes"/> a component (or module) system as expressive as [[Opaque ascription|ML]]'s,<ref name="units"/> and [[pattern matching]].<br />
<br />
In addition, the language features the first contract system for a [[higher-order programming|higher-order]] language.<ref>{{cite conference<br />
| last1 = Findler | first1 = R. B.<br />
| last2 = Felleisen | first2 = M.<br />
| title = Contracts for Higher-Order Functions<br />
| booktitle = International Conference on Functional Programming<br />
| year = 2002<br />
| url = http://www.eecs.northwestern.edu/~robby/pubs/papers/ho-contracts-icfp2002.pdf}}</ref><br />
Racket's contract system is inspired by the [[Design by Contract]] work for [[Eiffel (programming language)|Eiffel]] and extends it to work for higher-order values such as [[first-class function]]s, objects, [[Reference (computer science)|reference]] cells, and so on. For example, an object that is checked by a contract can be ensured to make contract checks when its methods are eventually invoked.<br />
<br />
Racket's compiler is a [[bytecode]] compiler that translates to an internal bytecode format that is run by the Racket [[virtual machine]]. On [[x86]] and [[PowerPC]] platforms, the bytecode is further compiled using a [[JIT compiler]] at runtime.<br />
<br />
Since 2004, the language has also shipped with PLaneT, a package manager that is integrated into the module system so that [[third-party software component|third-party libraries]] can be transparently imported and used. Additionally, PLaneT has a built-in [[software versioning|versioning]] policy to prevent [[dependency hell]].<ref name="planet">{{cite conference | title = Component Deployment with PLaneT: You Want it Where? | last = Matthews | first = J. | booktitle = Scheme and Functional Programming Workshop | year = 2006}}</ref><br />
<br />
At the end of 2014, much of Racket's code was moved into a new packaging system separate from the main code base. This new packaging system is serviced by a client program called <tt>raco</tt>. The new package system provides fewer features than PLaneT; a blog post by [[Jay McCarthy]] on the Racket blog explains the rationale for the change and how to duplicate the older system.<ref>{{cite web|url=http://blog.racket-lang.org/2014/12/the-racket-package-system-and-planet.html|title=The Racket package system and Planet}}</ref><br />
<br />
=== Macros and extensibility ===<br />
<br />
{{See also|Racket features#Language Extensions|l1=Racket language extensions}}<br />
<br />
The feature that distinguishes Racket from other languages in the Lisp family is its integrated language [[Extensible programming|extensibility]]. Racket's extensibility features are built into the module system to allow context-sensitive and module-level control over syntax.<ref name='languages-as-libraries'/> For example, the <code>#%app</code> syntactic form can be overridden to change the semantics of [[function application]]. Similarly, the <code>#%module-begin</code> form allows arbitrary static analysis of the entire module.<ref name='languages-as-libraries'/> Since any module can be used as a language, via the <code>#lang</code> notation, this effectively means a programmer can control virtually any aspect of the language.<br />
<br />
The module-level extensibility features are combined with a [[Scheme (programming language)|Scheme]]-like hygienic macro system, which provides more features than [[Lisp (programming language)|Lisp's]] S-expression manipulation system,<ref name='you-want-it-when'>{{cite conference | last = Flatt | first = Matthew | url = http://www.cs.utah.edu/plt/publications/macromod.pdf | title = Composable and Compilable Macros, You Want it When? | booktitle = International Conference on Functional Programming | year = 2002}}</ref><ref>Flatt, Culpepper, Darais, Findler, [http://www.cs.utah.edu/plt/publications/jfp12-draft-fcdf.pdf Macros that Work Together; Compile-Time Bindings, Partial Expansion, and Definition Contexts]</ref> Scheme 84's [[Hygienic macro|hygienic]] extend-syntax macros, or [[R5RS]]'s [[syntax-rules]]. Indeed, it is fair to say that the macro system is a carefully tuned [[application programming interface]] (API) for [[compiler]] extensions. Using this compiler API, programmers can add features and entire [[domain-specific language]]s in a manner that makes them completely indistinguishable from built-in language constructs.<br />
<br />
The macro system in Racket has been used to construct entire language [[dialect (computing)|dialects]]. This includes Typed Racket—a statically typed dialect of Racket that eases the migration from [[dynamically typed|untyped]] to typed code,<ref>{{cite conference | last1 = Tobin-Hochstadt | first1 = S. | last2 = Felleisen | first2 = M. | title = The Design and Implementation of Typed Scheme | booktitle = Principles of Programming Languages | year = 2008}}</ref> and Lazy Racket—a dialect with [[lazy evaluation]].<ref>{{cite conference | last1 = Barzilay | first1 = E. | last2 = Clements | first2 = J. | title = Laziness Without All the Hard Work: Combining Lazy and Strict Languages for Teaching | booktitle = Functional and Declarative Programming in Education | year = 2005}}</ref><br />
Other dialects include FrTime ([[functional reactive programming]]), Scribble (documentation language),<ref>{{cite conference | last1 = Flatt | first1 = M. | last2 = Barzilay | first2 = E. | last3 = Findler | first3 = R. B. | title = Scribble: Closing the Book on Ad Hoc Documentation Tools | booktitle = International Conference on Functional Programming | year = 2009}}</ref> Slideshow ([[slide show|presentation]] language),<ref>{{cite conference | last1 = Findler | first1 = R. B. | last2 = Flatt | first2 = M. | title = Slideshow: Functional Presentations | booktitle = International Conference on Functional Programming | year = 2004}}</ref> and several languages for education.<ref name="functional-io">{{cite conference | last1 = Felleisen | last2 = Findler | last3 = Flatt | last4 = Krishnamurthi | first1 = M. | first2 = R. B. | first3 = M. | first4 = S. | title = A Functional I/O System (or Fun for Freshman Kids) | url = http://www.ccs.neu.edu/scheme/pubs/icfp09-fffk.pdf | booktitle = International Conference on Functional Programming | year = 2009}}</ref><ref>{{cite journal | title = The Structure and Interpretation of the Computer Science Curriculum | last1 = Felleisen | last2 = Findler | last3 = Flatt | last4 = Krishnamurthi | first1 = M. | first2 = R. B. | first3 = M. | first4 = S. | journal = Journal of Functional Programming | url = http://www.ccs.neu.edu/scheme/pubs/fdpe2002-fffk.pdf | year = 2004}}</ref> Racket's core distribution provides libraries to aid the process of constructing new programming languages.<ref name="languages-as-libraries"/><br />
<br />
Such languages are not restricted to S-expression based syntax. In addition to conventional readtable-based syntax extensions, Racket's <code>#lang</code> makes it possible for a language programmer to define any arbitrary parser, for example, using the parser tools library.<ref name="parsers">{{cite web | title = Parser Tools: lex and yacc-style Parsing | url = http://docs.racket-lang.org/parser-tools/ | accessdate = 2011-08-16}}</ref> See [[Racket features#Logic Programming|Racket logic programming]] for an example of such a language.<br />
<br />
== Programming environment ==<br />
<br />
The language platform provides a self-hosted [[integrated development environment|IDE]]<ref name="drscheme"/> named DrRacket, a continuation-based [[web server]],<ref name="web-server"/> a [[graphical user interface]],<ref name="gui-rebuild"/> and other tools. Racket is also a viable scripting tool and can be used for scripting the Unix shell. It can parse [[command line arguments]], execute external tools and includes libraries like all common [[scripting language]]s.<br />
<br />
=== DrRacket IDE ===<br />
<br />
DrRacket (formerly DrScheme) is widely used among introductory Computer Science courses that teach Scheme or Racket and is lauded for its simplicity and appeal to beginner programmers. The IDE was originally built for use with the TeachScheme! project (now [[ProgramByDesign]]), an outreach effort by [[Northeastern University]] and a number of affiliated universities for attracting high school students to computer science courses at the college level.<br />
<br />
The editor provides [[Syntax highlighting|source highlighting]] for syntax and run-time errors, parenthesis matching, a [[debugger]] and an algebraic stepper. Its student-friendly features include support for multiple "language levels" (Beginning Student, Intermediate Student and so on). It also has integrated library support, and sophisticated [[Program analysis|analysis]] tools for advanced programmers. In addition, [[modular programming|module-oriented programming]] is supported with the module browser, a contour view, integrated [[software testing|testing]] and [[Fault coverage|coverage]] measurements, and [[refactoring]] support. It provides integrated, context-sensitive access to an extensive hyper-linked help system named "Help Desk".<br />
<br />
DrRacket is available for [[Microsoft Windows|Windows]] (95 and up), [[Mac OS X]], [[Unix]], and [[Linux]] with the [[X Window System]] and programs behave similarly on all these platforms.<br />
<br />
== Code examples ==<br />
{{See also|Racket features#Examples|l1=Racket examples}}<br />
Here's a trivial "hello world" program:<br />
<source lang="Racket"><br />
#lang racket/base<br />
"Hello, World!"<br />
</source><br />
Running this program produces the output:<br />
:{{samp|"Hello, World!"}}<br />
<br />
Here's a slightly less trivial program:<br />
[[File:Sierpinski Racket example.png|thumb|The result of this program, as shown in DrRacket]]<br />
<source lang="Racket"><br />
#lang racket<br />
(require 2htdp/image)<br />
<br />
(let sierpinski ([n 8])<br />
(if (zero? n)<br />
(triangle 2 'solid 'red)<br />
(let ([t (sierpinski (- n 1))])<br />
(freeze (above t (beside t t))))))<br />
</source><br />
This program, taken from the Racket website, draws a [[Sierpinski triangle]], nested to depth 8.<br />
<br />
Using the <code>#lang</code> directive, a source file can be written in different dialects of Racket. Here is an example of the factorial program in Typed Racket, a [[statically typed]] dialect of Racket:<br />
<source lang="Racket"><br />
#lang typed/racket<br />
<br />
(: fact (Integer -> Integer))<br />
(define (fact n)<br />
(cond [(zero? n) 1]<br />
[else (* n (fact (- n 1)))]))<br />
</source><br />
<br />
== Applications and practical use ==<br />
<br />
Apart from having a basis in [[programming language theory]], Racket was designed to be used as a general-purpose language in production systems. Thus, the Racket distribution features an extensive library that covers systems and network programming, web development,<ref name="web-server">{{cite journal|title=Implementation and Use of the PLT Scheme Web Server|journal=Journal of Higher-Order and Symbolic Programming|last1=Krishnamurthi, Hopkins|last2=McCarthy|last3=Graunke|last4=Pettyjohn|last5=Felleisen|year=2007|url=http://www.ccs.neu.edu/racket/pubs/hosc07-sk-mf.pdf}}</ref> a uniform interface to the underlying operating system, a dynamic [[foreign function interface]],<ref name="ffi">{{cite conference |title=Foreign Interface for PLT Scheme |last1=Barzilay |first1=E. |last2=Orlovsky |first2=D. |booktitle=Scheme and Functional Programming |year=2004 |url=http://www.ccs.neu.edu/racket/pubs/scheme04-bo.pdf}}</ref> several flavours of [[regular expressions]], lexer/parser generators,<ref name="parsers"/> [[logic programming]], and a complete [[GUI]] framework.<br />
<br />
Racket has several features useful for a commercial language, among them an ability to generate standalone executables under Windows, Mac OS X and Unix, a [[profiling (computer programming)|profiler]] and [[debugger]] included in the [[integrated development environment]] (IDE), and a [[unit testing]] framework.<br />
<br />
Racket has been used for commercial projects and web applications. A notable example is the [[Hacker News]] website, which runs on [[Arc (programming language)|Arc]], which is developed in Racket. [[Naughty Dog]] has used it as a scripting language in several of their video games.<ref>{{cite web |url=http://cufp.org/conference/sessions/2011/functional-mzscheme-dsls-game-development |title=Functional mzScheme DSLs in Game Development |accessdate=2012-05-08}}</ref><br />
<br />
Racket is used to teach students algebra through game design in the [[bootstrap curriculum|Bootstrap program]].<ref>{{cite web|url=http://www.bootstrapworld.org/materials/fall2015/index.shtml|website=bootstrapworld.org|accessdate=2015-08-11|title=Bootstrap}}</ref><br />
<br />
== References ==<br />
{{Reflist|30em|refs=<br />
<ref name=icfp2007><br />
{{cite conference | last1 = Flatt | first1 = M. | last2 = Yu | first2 = G. | last3 = Findler | first3 = R. B. | last4 = Felleisen | first4 = M.<br />
| title = Adding Delimited and Composable Control to a Production Programming Environment<br />
| booktitle = International Conference on Functional Programming | year = 2007 | url = http://www.ccs.neu.edu/scheme/pubs/icfp07-fyff.pdf}}</ref><br />
<ref name="mred"><br />
{{cite conference |last1=Flatt|last2=Findler|last3=Krishnamurthi|last4=Felleisen<br />
| conference=International Conference on Functional Programming<br />
| title=Programming Languages as Operating Systems (or, Revenge of the Son of the Lisp Machine)|year=1999}}</ref><br />
}}<br />
<br />
== Further reading ==<br />
<br />
* Felleisen ''et al.'', 2013. [http://realmofracket.com/ ''Realm of Racket'']. No Starch Press.<br />
* Felleisen ''et al.'', 2003. [http://www.htdp.org/ ''How to Design Programs'']. MIT Press.<br />
<br />
==External links==<br />
<br />
=== Tutorials ===<br />
* [http://docs.racket-lang.org/quick/ Quick: An Introduction to Racket with Pictures]<br />
* [http://hashcollision.org/brainfudge/ F*dging up a Racket]—shows how to write a [[Brainfuck]] dialect for Racket<br />
* [http://jarnaldich.me/2011/08/07/raw-strings-in-racket.html Raw strings in Racket]—a reader extension for [[raw string]]s<br />
<br />
=== Style guide ===<br />
* [http://docs.racket-lang.org/style/index.html How to Program Racket]<br />
<br />
=== Website and documentation ===<br />
* {{Official website}}<br />
* [http://blog.racket-lang.org/ Blog]<br />
* [http://git.racket-lang.org/plt/ Code Repository]<br />
* [http://planet.racket-lang.org/ PLaneT]<br />
* [http://docs.racket-lang.org/guide/ The Racket Guide]<br />
* [http://docs.racket-lang.org/reference/ The Racket Reference]<br />
* [http://docs.racket-lang.org/ All Racket Documentation]<br />
<br />
{{DEFAULTSORT:Racket}}<br />
[[Category:Functional languages]]<br />
[[Category:Object-oriented programming languages]]<br />
[[Category:Extensible syntax programming languages]]<br />
[[Category:Lisp programming language family]]<br />
[[Category:Scheme (programming language) implementations]]<br />
[[Category:Scheme (programming language) compilers]]<br />
[[Category:Scheme (programming language) interpreters]]<br />
[[Category:R6RS Scheme]]<br />
[[Category:Academic programming languages]]<br />
[[Category:Educational programming languages]]<br />
[[Category:Pedagogic integrated development environments]]<br />
[[Category:Cross-platform free software]]<br />
[[Category:Free compilers and interpreters]]<br />
[[Category:Programming languages created in 1994]]<br />
[[Category:Articles with example Racket code]]<br />
[[Category:Software using the LGPL license]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Boa_(web_server)&diff=679650652Boa (web server)2015-09-05T22:45:13Z<p>PuercoPop: add request for citation</p>
<hr />
<div>{{multiple issues|<br />
{{Notability|Products|date=February 2011}}<br />
{{primary sources|date=February 2008}}<br />
}}<br />
<br />
{{Infobox software<br />
| logo =<br />
| screenshot =<br />
| author = [[Paul Phillips (poker player)|Paul Phillips]]<br />
| developer = Larry Doolittle and Jon Nelson<br />
| released = circa 1995<br />
| status = Discontinued<br />
| latest release version = 0.94.13<br />
| latest release date = {{start date and age|2002|07|30}}<br />
| latest preview version = 0.94.14rc21<br />
| latest preview date = {{start date and age|2005|02|23}}<br />
| operating_system = [[Cross-platform]]<br />
| genre = [[Web server]]<br />
| language = [[C (programming language)|C]]<br />
| license = [[GPLv2]]<br />
| website = {{URL|http://www.boa.org/}}<br />
}}<br />
<br />
'''Boa''' is an [[open source|open-source]], small-footprint [[web server]] that is suitable for embedded applications. Originally written by [[Paul Phillips (poker player)|Paul Phillips]], it is now maintained by Larry Doolittle and Jon Nelson.<br />
<br />
[[Slashdot]] and [[Fotolog]] use Boa to serve images.{{citation needed}}<br />
<br />
As of January 2006, Boa has the following limitations<br />
* No access control features (HTTP [[Basic access authentication]], etc.)<br />
* No [[chroot]] option (planned)<br />
* No [[Server Side Includes]] (deemed incompatible with server performance goals)<br />
* No SSL support although there are some patches against 0.94.13 that introduce SSL support<br />
<br />
==See also==<br />
{{Portal|Free software}}<br />
* [[Comparison of web servers]]<br />
<br />
==External links==<br />
*{{Official website}}<br />
*[http://www.osnews.com/story/2217/An_Overview_of_the_Boa_Web_Server An Overview of the Boa Web Server]<br />
*[http://www.linuxjournal.com/article/4773 Boa: an Embedded Web Server]<br />
*[http://www.freescale.com/files/32bit/doc/app_note/AN3238.pdf User Interface Design using CGI Programming and Boa Web Server on M5249C3 Board]<br />
*[http://a-voyage-into-the-land-of-boa.blogspot.in/2013/09/the-beginning-boa-log-bloag.html Reviving boa ]<br />
*[http://boa-web-server.999882.n3.nabble.com/ Mailing List]<br />
<br />
{{Web server software}}<br />
<br />
{{DEFAULTSORT:Boa (Web Server)}}<br />
[[Category:Free web server software]]<br />
<br />
<br />
{{network-software-stub}}</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Lisp_(programming_language)&diff=676442676Lisp (programming language)2015-08-17T01:09:48Z<p>PuercoPop: /* Major dialects */ Languages are not compiled nor interpreted, implementations are.</p>
<hr />
<div>{{redirect|LISP|the Internet protocol|Locator/Identifier Separation Protocol}}<br />
{{Infobox programming language<br />
| name = Lisp<br />
| paradigm = [[multi-paradigm programming language|Multi-paradigm]]: [[functional programming|functional]], [[procedural programming|procedural]], [[Reflection (computer science)|reflective]], [[metaprogramming|meta]]<br />
| year = 1958<br />
| designer = [[John McCarthy (computer scientist)|John McCarthy]]<br />
| developer = [[Steve Russell]], Timothy P. Hart, and Mike Levin| latest release version =<br />
| latest release date =<br />
| turing-complete = Yes<br />
| typing = [[Dynamic typing|dynamic]], [[Strongly typed programming language|strong]]<br />
| implementations =<br />
| dialects = [[Arc (programming language)|Arc]], [[AutoLISP]], [[Clojure]], [[Common Lisp]], [[Emacs Lisp]], [[EuLisp]], [[Franz Lisp]], [[Hy]], [[Interlisp]], [[ISLISP]], [[LeLisp]], [[LFE (programming language)|LFE]], [[Maclisp]], [[MDL (programming language)|MDL]], [[Newlisp]], [[NIL (programming language)|NIL]], [[Picolisp]], [[Portable Standard Lisp]], [[Racket (programming language)|Racket]], [[Scheme (programming language)|Scheme]], [[Cadence SKILL|SKILL]], [[Spice Lisp]], [[T (programming language)|T]], [[XLISP]], [[Zetalisp]]<br />
| influenced by = [[Information Processing Language|IPL]]<br />
| influenced = [[CLIPS]], [[CLU (programming language)|CLU]], [[COWSEL]], [[Dylan (programming language)|Dylan]], [[Falcon (programming language)|Falcon]], [[Forth (programming language)|Forth]], [[Haskell (programming language)|Haskell]], [[Io (programming language)|Io]], [[Ioke (programming language)|Ioke]], [[JavaScript]], [[Julia (programming language)|Julia]], [[Logo (programming language)|Logo]], [[Lua (programming language)|Lua]], [[Mathematica]], [[MDL (programming language)|MDL]], [[ML (programming language)|ML]], [[Nu (programming language)|Nu]], [[OPS5]], [[Perl]], [[POP-2]]/[[POP-11|11]], [[Python (programming language)|Python]], [[R (programming language)|R]], [[Rebol]], [[Ruby (programming language)|Ruby]], [[Smalltalk]], [[Tcl]]<br />
}}<br />
<br />
'''Lisp''' (historically, '''LISP''') is a family of [[computer]] [[programming language]]s with a long history and a distinctive, fully parenthesized [[Polish notation|Polish prefix]] notation.<ref><br />
{{cite book<br />
| title = Milestones in computer science and information technology<br />
| author = Edwin D. Reilly<br />
| publisher = Greenwood Publishing Group<br />
| year = 2003<br />
| isbn = 978-1-57356-521-9<br />
| pages = 156–157<br />
| url = http://books.google.com/books?id=JTYPKxug49IC&pg=PA157<br />
}}</ref><br />
Originally specified in 1958, Lisp is the second-oldest [[high-level programming language]] in widespread use today; only [[Fortran]] is older (by one year).<ref>{{cite web|url=http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-5.html|quote=Lisp is a survivor, having been in use for about a quarter of a century. Among the active programming languages only Fortran has had a longer life.|title=SICP: Foreword}}</ref><ref>{{cite web|url=http://www-formal.stanford.edu/jmc/history/lisp/node6.html#SECTION00060000000000000000|title=Conclusions}}</ref> Like Fortran, Lisp has changed a great deal since its early days, and a number of [[Programming language dialect|dialects]] have existed over its history. Today, the most widely known general-purpose Lisp dialects are [[Common Lisp]] and [[Scheme (programming language)|Scheme]].<br />
<br />
Lisp was originally created as a practical mathematical notation for computer programs, influenced by the notation of [[Alonzo Church]]'s [[lambda calculus]]. It quickly became the favored programming language for [[artificial intelligence]] (AI) research. As one of the earliest programming languages, Lisp pioneered many ideas in [[computer science]], including [[tree data structure]]s, [[Garbage collection (computer science)|automatic storage management]], [[dynamic typing]], [[Conditional (computer programming)|conditionals]], [[higher-order function]]s, [[Recursion (computer science)|recursion]], and the [[self-hosting]] [[compiler]].<ref name="GRAHAM">{{cite web| title=Revenge of the Nerds| author=Paul Graham | url=http://www.paulgraham.com/icad.html | accessdate=2013-03-14}}</ref><br />
<br />
The name ''LISP'' derives from "LISt Processing". [[Linked list]]s are one of Lisp language's major [[data structure]]s, and Lisp [[source code]] is itself made up of lists. As a result, Lisp programs can manipulate source code as a data structure, giving rise to the [[Macro (computer science)|macro]] systems that allow programmers to create new syntax or new [[domain-specific language]]s embedded in Lisp.<br />
<br />
The interchangeability of code and data also gives Lisp its instantly recognizable syntax. All program code is written as ''[[s-expression]]s'', or parenthesized lists. A function call or syntactic form is written as a list with the function or operator's name first, and the arguments following; for instance, a function {{Lisp2|f}} that takes three arguments would be called as {{Lisp2|(f arg1 arg2 arg3)}}.<br />
<br />
==History==<br />
{{Multiple image|image1 = John McCarthy Stanford.jpg|footer = John McCarthy (top) and Steve Russell (bottom)|image2 = Steve Russell.jpg|direction = vertical|}}<br />
<br />
Lisp was invented by [[John McCarthy (computer scientist)|John McCarthy]] in 1958 while he was at the [[Massachusetts Institute of Technology]] (MIT). McCarthy published its design in a paper in ''[[Communications of the ACM]]'' in 1960, entitled "Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I"<ref name="MCCARTHY">{{cite web| title=Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I| author=John McCarthy | url=http://www-formal.stanford.edu/jmc/recursive.html | accessdate=2006-10-13}}</ref> ("Part II" was never published). He showed that with a few simple operators and a notation for functions, one can build a [[Turing-complete]] language for algorithms.<br />
<br />
[[Information Processing Language]] was the first AI language, from 1955 or 1956, and already included many of the concepts, such as list-processing and recursion, which came to be used in Lisp.<br />
<br />
McCarthy's original notation used bracketed "[[M-expression]]s" that would be translated into [[S-expression]]s. As an example, the M-expression {{Lisp2|car[cons[A,B]]}} is equivalent to the S-expression {{Lisp2|(car (cons A B))}}. Once Lisp was implemented, programmers rapidly chose to use S-expressions, and M-expressions were abandoned. M-expressions surfaced again with short-lived attempts of [[MLISP]]<ref name="SMITH">{{cite web| title=MLISP Users Manual| author=David Canfield Smith | url=http://www.softwarepreservation.org/projects/LISP/stanford/Smith-MLISP-AIM-84.pdf | accessdate=2006-10-13}}</ref> by [[Horace Enea]] and [[CGOL]] by [[Vaughan Pratt]].<br />
<br />
Lisp was first implemented by [[Steve Russell]] on an [[IBM 704]] computer. Russell had read McCarthy's paper, and realized (to McCarthy's surprise) that the Lisp ''eval'' function could be implemented in [[machine code]].<ref>According to what reported by [[Paul Graham (computer programmer)|Paul Graham]] in ''[[Hackers & Painters]]'', p. 185, McCarthy said: "Steve Russell said, look, why don't I program this ''eval''..., and I said to him, ho, ho, you're confusing theory with practice, this ''eval'' is intended for reading, not for computing. But he went ahead and did it. That is, he compiled the ''eval'' in my paper into [[IBM 704]] machine code, fixing [[Software bug|bug]], and then advertised this as a Lisp interpreter, which it certainly was. So at that point Lisp had essentially the form that it has today..."</ref> The result was a working Lisp interpreter which could be used to run Lisp programs, or more properly, 'evaluate Lisp expressions.'<br />
<br />
Two assembly language macros for the [[IBM 704]] became the primitive operations for decomposing lists: [[Car and cdr|{{Lisp2|car}}]] (Contents of the Address part of Register number) and [[Car and cdr|{{Lisp2|cdr}}]] (Contents of the Decrement part of Register number).<ref name="PREHISTORY">{{cite web| title=LISP prehistory - Summer 1956 through Summer 1958| author=John McCarthy | url=http://www-formal.stanford.edu/jmc/history/lisp/node2.html | accessdate=2010-03-14}}</ref> From the context, it is clear that the term "Register" is used here to mean "Memory Register", nowadays called "Memory Location". Lisp dialects still use {{Lisp2|car}} and {{Lisp2|cdr}} ({{IPAc-en|ˈ|k|ɑr}} and {{IPAc-en|ˈ|k|ʊ|d|ər}}) for the operations that return the first item in a list and the rest of the list respectively.<br />
<br />
The first complete Lisp compiler, written in Lisp, was implemented in 1962 by Tim Hart and Mike Levin at MIT.<ref name="LEVIN">{{cite web| title=AI Memo 39-The new compiler| author=Tim Hart and Mike Levin | url=ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-039.pdf | accessdate=2006-10-13}}</ref> This compiler introduced the Lisp model of incremental compilation, in which compiled and interpreted functions can intermix freely. The language used in Hart and Levin's memo is much closer to modern Lisp style than McCarthy's earlier code.<br />
<br />
Lisp was a difficult system to implement with the compiler techniques and stock hardware of the 1970s. [[Garbage collection (computer science)|Garbage collection]] routines, developed by then-[[MIT]] graduate student [[Daniel Edwards (programmer)|Daniel Edwards]], made it practical to run Lisp on general-purpose computing systems, but efficiency was still a problem.{{citation needed|date=October 2010}} This led to the creation of [[Lisp machine]]s: dedicated hardware for running Lisp environments and programs. Advances in both computer hardware and compiler technology soon made Lisp machines obsolete.{{citation needed|date=May 2011}}<br />
<br />
During the 1980s and 1990s, a great effort was made to unify the work on new Lisp dialects (mostly successors to [[Maclisp]] like [[ZetaLisp]] and NIL (New Implementation of Lisp)) into a single language. The new language, [[Common Lisp]], was somewhat compatible with the dialects it replaced (the book [[Common Lisp the Language]] notes the compatibility of various constructs). In 1994, [[ANSI]] published the Common Lisp standard, "ANSI X3.226-1994 Information Technology Programming Language Common Lisp."<br />
<br />
<timeline><br />
Preset = TimeHorizontal_AutoPlaceBars_UnitYear<br />
ImageSize = width:1024<br />
PlotArea = right:256<br />
<br />
Define $bold = fontsize:L shift:(10,-4)<br />
<br />
Colors =<br />
id:offWhite value:rgb(0.97,0.97,0.97)<br />
id:paleGray value:rgb(0.86,0.86,0.86)<br />
id:darkGray value:gray(0.6)<br />
<br />
BackgroundColors = canvas:offWhite<br />
<br />
Period = from:1958 till:2013<br />
ScaleMajor = unit:year increment:5 start:1958 gridcolor:paleGray<br />
<br />
BarData=<br />
barset:Dialects<br />
<br />
PlotData=<br />
<br />
# set defaults<br />
width:15 fontsize:M textcolor:black align:left anchor:from shift:(0,-2) color:darkGray<br />
barset:Dialects<br />
<br />
from:1958 till:1965 text:"Lisp 1.5"<br />
from:1965 till:1985 text:"[[Maclisp]]"<br />
from:1970 till:1995 text:"[[ZetaLisp]]"<br />
from:1970 till:1980 text:"[[NIL (programming language)|NIL]]"<br />
from:1970 till:1990 text:"[[Interlisp]]"<br />
from:1984 till:2013 text:"[[Common Lisp]]"<br />
from:1975 till:2013 text:"[[Scheme (programming language)|Scheme]]"<br />
from:1986 till:2013 text:"[[ISLISP]]"<br />
from:2007 till:2013 text:"[[Clojure]]"<br />
</timeline><br />
<br />
===Connection to artificial intelligence===<br />
Since its inception, Lisp was closely connected with the [[artificial intelligence]] research community, especially on [[PDP-10]]<ref>The 36-bit word size of the [[PDP-6]]/[[PDP-10]] was influenced by the usefulness of having two Lisp 18-bit pointers in a single word. {{cite newsgroup | quote = The PDP-6 project started in early 1963, as a 24-bit machine. It grew to 36 bits for LISP, a design goal. | url = http://groups.google.com/group/alt.folklore.computers/browse_thread/thread/6e5602ce733d0ec/17597705ae289112 | title = The History of TOPS or Life in the Fast ACs | newsgroup = alt.folklore.computers |message-id= 84950@tut.cis.ohio-state.edu | date = 18 October 1990 | author = Peter J. Hurley}}</ref> systems. Lisp was used as the implementation of the programming language [[Planner programming language|Micro Planner]] which was used in the famous AI system [[SHRDLU]]. In the 1970s, as AI research spawned commercial offshoots, the performance of existing Lisp systems became a growing issue.{{Citation needed|date=March 2010}}<br />
<br />
===Genealogy and variants===<br />
Over its fifty-year history, Lisp has spawned many variations on the core theme of an S-expression language. Moreover, each given dialect may have several implementations—for instance, there are more than a dozen implementations of [[Common Lisp]].<br />
<br />
Differences between dialects may be quite visible—for instance, Common Lisp uses the keyword <code>defun</code> to name a function, but Scheme uses <code>define</code>.<ref>Common Lisp: <code>(defun f (x) x)</code><br/>Scheme: <code>(define f (lambda (x) x))</code> or <code>(define (f x) x)</code></ref> Within a dialect that is standardized, however, conforming implementations support the same core language, but with different extensions and libraries.<br />
<br />
====Historically significant dialects====<br />
[[File:LISP machine.jpg|thumb|right|A Lisp machine in the [[MIT Museum]]]]<br />
[[File:4.3 BSD UWisc VAX Emulation Lisp Manual.png|thumb|[[4.3BSD|4.3 BSD]] from the [[University of Wisconsin]], displaying the [[man page]] for [[Franz Lisp]]]]<br />
<br />
*LISP 1<ref>{{Cite journal<br />
| last = McCarthy | first = J. | author-link = John McCarthy (computer scientist)<br />
| last2 = Brayton | first2 = R. | author2-link = Robert Brayton (computer scientist)<br />
| last3 = Edwards | first3 = D. | author3-link = Daniel Edwards (programmer)<br />
| last4 = Fox | first4 = P. | author4-link = Phyllis Fox<br />
| last5 = Hodes | first5 = L. | author5-link = Louis Hodes<br />
| last6 = Luckham | first6 = D. | author6-link = David Luckham<br />
| last7 = Maling | first7 = K. | author7-link = Klim Maling (programmer)<br />
| last8 = Park | first8 = D. | author8-link = David Park (computer scientist)<br />
| last9 = Russell | first9 = S. | author9-link = Steve Russell <br />
| title = LISP I Programmers Manual<br />
| place = [[Boston]], [[Massachusetts]]<br />
| publisher = Artificial Intelligence Group, [[M.I.T. Computation Center]] and [[Research Laboratory of Electronics at MIT|Research Laboratory]]<br />
| origyear =<br />
|date=March 1960<br />
| volume =<br />
| edition =<br />
| chapter =<br />
| chapterurl =<br />
| page =<br />
| pages =<br />
| url = http://history.siam.org/sup/Fox_1960_LISP.pdf<br />
| archiveurl =<br />
| archivedate =<br />
| doi =<br />
| id =<br />
| isbn =<br />
| postscript = <!--None--> }} Accessed May 11, 2010.</ref> – First implementation.<br />
*LISP 1.5<ref>{{Cite book| url = http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf | title = LISP 1.5 Programmer's Manual | publisher = [[MIT Press]] | first1 = John | last1 = McCarthy | first2 = Paul W. | last2 = Abrahams | first3 = Daniel J. | last3 = Edwards | first4 = Timothy P. | last4 = Hart | first5 = Michael I. | last5 = Levin | isbn = 0-262-13011-4 | origyear = 1962|edition= 2nd|year=1985}}</ref> – First widely distributed version, developed by McCarthy and others at MIT. So named because it contained several improvements on the original "LISP 1" interpreter, but was not a major restructuring as the planned [[LISP 2]] would be.<br />
*[[Stanford LISP]] 1.6<ref>{{Cite book| url = http://www.softwarepreservation.org/projects/LISP/stanford/SAILON-28.6.pdf | format = PDF | title = Stanford LISP 1.6 Manual | first1 = Lynn H. | last1 = Quam | first2 = Whitfield | last2 = Diffle}}</ref> – This was a successor to LISP 1.5 developed at the [[Stanford AI Lab]], and widely distributed to [[PDP-10]] systems running the [[TOPS-10]] operating system. It was rendered obsolete by Maclisp and InterLisp.<br />
*[[Maclisp|MACLISP]]<ref>{{cite web| url = http://zane.brouhaha.com/~healyzh/doc/lisp.doc.txt | title = Maclisp Reference Manual | date = March 3, 1979 | archiveurl = http://web.archive.org/web/20071214064433/http://zane.brouhaha.com/~healyzh/doc/lisp.doc.txt | archivedate = 2007-12-14}}</ref> – developed for MIT's [[Project MAC]] (no relation to Apple's [[Macintosh]], nor to [[John McCarthy (computer scientist)|McCarthy]]), direct descendant of LISP 1.5. It ran on the PDP-10 and [[Multics]] systems. (MACLISP would later come to be called Maclisp, and is often referred to as MacLisp.)<br />
*[[InterLisp]]<ref>{{Cite book| url = http://www.bitsavers.org/pdf/xerox/interlisp/1974_InterlispRefMan.pdf | format = PDF | title = InterLisp Reference Manual | first = Warren | last = Teitelman | year = 1974 }}</ref> – developed at [[BBN Technologies]] for PDP-10 systems running the [[TOPS-20|Tenex]] operating system, later adopted as a "West coast" Lisp for the Xerox Lisp machines as [[InterLisp-D]]. A small version called "InterLISP 65" was published for the [[MOS 6502|6502]]-based [[Atari 8-bit family]] computer line. For quite some time Maclisp and InterLisp were strong competitors.<br />
*[[Franz Lisp]] – originally a [[University of California, Berkeley|Berkeley]] project; later developed by Franz Inc. The name is a humorous deformation of the name "[[Franz Liszt]]", and does not refer to [[Allegro Common Lisp]], the dialect of Common Lisp sold by Franz Inc., in more recent years.<br />
*[[XLISP]], which [[AutoLISP]] was based on.<br />
*[[Standard Lisp]] and [[Portable Standard Lisp]] were widely used and ported, especially with the Computer Algebra System REDUCE.<br />
*[[ZetaLisp]], also known as Lisp Machine Lisp – used on the [[Lisp machine]]s, direct descendant of Maclisp. ZetaLisp had a big influence on Common Lisp.<br />
*[[LeLisp]] is a French Lisp dialect. One of the first [[Interface Builder]]s was written in LeLisp.{{Citation needed|reason=No dispute about Lisp, but LeLisp specifically?|date=November 2014}}<br />
*[[Scheme (programming language)|Scheme]] (1975).<ref>ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-349.pdf</ref><br />
*[[Common Lisp]] (1984), as described by ''[[Common Lisp the Language]]'' – a consolidation of several divergent attempts (ZetaLisp, [[Spice Lisp]], [[NIL (programming language)|NIL]], and [[S-1 Lisp]]) to create successor dialects<ref>{{Cite book| chapterurl = http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node6.html | title = Common Lisp the Language | edition = 2nd | chapter = Purpose | first = Guy L., Jr. | last = Steele| isbn = 0-13-152414-3}}</ref> to Maclisp, with substantive influences from the Scheme dialect as well. This version of Common Lisp was available for wide-ranging platforms and was accepted by many as a [[de facto standard]]<ref>{{cite web| url = http://www.cs.cmu.edu/Groups/AI/html/faqs/lang/lisp/part2/faq-doc-13.html | title = History: Where did Lisp come from? | work = FAQ: Lisp Frequently Asked Questions 2/7 | date = 20 February 1996 | first1 = Mark | last1 = Kantrowitz | first2 = Barry | last2 = Margolin}}</ref> until the publication of ANSI Common Lisp (ANSI X3.226-1994).<br />
*[[Dylan (programming language)|Dylan]] was in its first version a mix of Scheme with the Common Lisp Object System.<br />
*[[EuLisp]] – attempt to develop a new efficient and cleaned-up Lisp.<br />
*[[ISLISP]] – attempt to develop a new efficient and cleaned-up Lisp. Standardized as ISO/IEC 13816:1997<ref>{{cite web|url=http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=22987 |title=ISO/IEC 13816:1997 |publisher=Iso.org |date=2007-10-01 |accessdate=2013-11-15}}</ref> and later revised as ISO/IEC 13816:2007:<ref>{{cite web|url=http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=44338 |title=ISO/IEC 13816:2007 |publisher=Iso.org |date=2013-10-30 |accessdate=2013-11-15}}</ref> ''Information technology – Programming languages, their environments and system software interfaces – Programming language ISLISP''.<br />
*IEEE [[Scheme (programming language)|Scheme]] – IEEE standard, 1178–1990 (R1995)<br />
*ANSI [[Common Lisp]] – an [[American National Standards Institute]] (ANSI) [[Standardization|standard]] for Common Lisp, created by subcommittee [[X3J13]], chartered<ref>{{cite web| url = http://www.nhplace.com/kent/CL/x3j13-86-020.html | title = X3J13 Charter}}</ref> to begin with ''Common Lisp: The Language'' as a base document and to work through a public [[Consensus decision-making|consensus]] process to find solutions to shared issues of [[Portability (software)|portability]] of programs and [[Computer compatibility|compatibility]] of Common Lisp implementations. Although formally an ANSI standard, the implementation, sale, use, and influence of ANSI Common Lisp has been and continues to be seen worldwide.<br />
*[[ACL2]] or "A Computational Logic for Applicative Common Lisp", an applicative (side-effect free) variant of Common LISP. ACL2 is both a programming language in which you can model computer systems and a tool to help proving properties of those models.<br />
*[[Clojure]], a modern dialect of Lisp which compiles to the [[Java virtual machine]] and handles [[Concurrency (computer science)|concurrency]] very well.<br />
<br />
===2000-present===<br />
After having declined somewhat in the 1990s, Lisp has recently experienced a resurgence of interest. Most new activity is focused around implementations of [[Common Lisp]] as well as [[Clojure]], [[Racket (programming language)|Racket]], [[Scheme (programming language)|Scheme]] and [[Emacs Lisp]], and includes the development of new portable libraries and applications.<br />
<br />
Many new Lisp programmers were inspired by writers such as [[Paul Graham (computer programmer)|Paul Graham]] and [[Eric S. Raymond]] to pursue a language others considered antiquated. New Lisp programmers often describe the language as an eye-opening experience and claim to be substantially more productive than in other languages.<ref>{{cite web| title=The Road To Lisp Survey | url=http://wiki.alu.org/The_Road_To_Lisp_Survey | accessdate=2006-10-13}}</ref> This increase in awareness may be contrasted to the "[[AI winter]]" and Lisp's brief gain in the mid-1990s.<ref>{{cite web|url=http://www.faqs.org/docs/artu/ch14s05.html |title=Trends for the Future |publisher=Faqs.org |accessdate=2013-11-15}}</ref><br />
<br />
Dan Weinreb lists in his survey of Common Lisp implementations<ref>{{cite web|last=Weinreb|first=Daniel|title=Common Lisp Implementations: A Survey|url=http://common-lisp.net/~dlw/LispSurvey.html|accessdate=4 April 2012}}</ref> eleven actively maintained Common Lisp implementations. Scieneer Common Lisp is a new commercial implementation forked from CMUCL with a first release in 2002.<br />
<br />
The open source community has created new supporting infrastructure: [[CLiki]] is a wiki that collects Common Lisp related information, the [[Common Lisp directory]] lists resources, #lisp is a popular IRC channel (with support by a Lisp-written Bot), [[lisppaste]] supports the sharing and commenting of code snippets, [[Planet Lisp]] collects the contents of various Lisp-related blogs, on [[LispForum]] users discuss Lisp topics, [[Lispjobs]] is a service for announcing job offers and there is a weekly news service, ''[[Weekly Lisp News]]''. ''Common-lisp.net'' is a hosting site for open source Common Lisp projects. [[Quicklisp]] is a library manager for Common Lisp.<br />
<br />
50 years of Lisp (1958–2008) has been celebrated at LISP50@OOPSLA.<ref>{{cite web|url=http://www.lisp50.org/ |title=LISP50@OOPSLA |publisher=Lisp50.org |accessdate=2013-11-15}}</ref> There are regular local user meetings in Boston, Vancouver, and Hamburg. Other events include the European Common Lisp Meeting, the European Lisp Symposium and an International Lisp Conference.<br />
<br />
The Scheme community actively maintains [[Scheme (programming language)#Implementations|over twenty implementations]]. Several significant new implementations (Chicken, Gambit, Gauche, Ikarus, Larceny, Ypsilon) have been developed in the last few years. The Revised<sup>5</sup> Report on the Algorithmic Language Scheme<ref>[http://www.schemers.org/Documents/Standards/R5RS/ Documents: Standards: R5RS]. schemers.org (2012-01-11). Retrieved on 2013-07-17.</ref> standard of Scheme was widely accepted in the Scheme community. The [[Scheme Requests for Implementation]] process has created a lot of quasi standard libraries and extensions for Scheme. User communities of individual Scheme implementations continue to grow. A new language standardization process was started in 2003 and led to the R<sup>6</sup>RS Scheme standard in 2007. Academic use of Scheme for teaching computer science seems to have declined somewhat. Some universities, such as MIT, are no longer using Scheme in their computer science introductory courses.<ref>{{cite news|url=http://cemerick.com/2009/03/24/why-mit-now-uses-python-instead-of-scheme-for-its-undergraduate-cs-program/|title=Why MIT now uses python instead of scheme for its undergraduate CS program|date=March 24, 2009|work=cemerick.com|accessdate=November 10, 2013}}</ref><ref>{{cite news|url=http://mitadmissions.org/blogs/entry/the_end_of_an_era_1|title=The End of an Era|first=Evan|last=Broder|date=January 8, 2008|work=mitadmissions.org|accessdate=November 10, 2013}}</ref><br />
<br />
There are several new dialects of Lisp: [[Arc (programming language)|Arc]], [[Hy]], [[Nu (programming language)|Nu]], [[Clojure]], [[Liskell]], [[LFE (programming language)|LFE]] (Lisp Flavored Erlang) and [[Racket (programming language)|Racket]].<br />
<br />
==Major dialects==<br />
[[Common Lisp]] and [[Scheme (programming language)|Scheme]] represent two major streams of Lisp development. These languages embody significantly different design choices.<br />
<br />
[[Common Lisp]] is a successor to [[MacLisp]]. The primary influences were [[Lisp Machine Lisp]], [[MacLisp]], [[NIL (programming language)|NIL]], [[S-1 Lisp]], [[Spice Lisp]], and Scheme.<ref>Chapter 1.1.2, History, ANSI CL Standard</ref> It has many of the features of Lisp Machine Lisp (a large Lisp dialect used to program [[Lisp Machine]]s), but was designed to be efficiently implementable on any personal computer or workstation. Common Lisp has a large language standard including many built-in data types, functions, macros and other language elements, as well as an object system ([[Common Lisp Object System]] or shorter CLOS). Common Lisp also borrowed certain features from Scheme such as [[lexical scoping]] and [[lexical closure]]s.<br />
<br />
Scheme (designed earlier) is a more minimalist design, with a much smaller set of standard features but with certain implementation features (such as [[tail-call optimization]] and full [[continuation]]s) not necessarily found in Common Lisp.<br />
<br />
[[Scheme (programming language)|Scheme]] is a statically scoped and properly tail-recursive dialect of the Lisp programming language invented by [[Guy L. Steele, Jr.|Guy Lewis Steele Jr.]] and [[Gerald Jay Sussman]]. It was designed to have exceptionally clear and simple semantics and few different ways to form expressions. A wide variety of programming paradigms, including imperative, functional, and message passing styles, find convenient expression in Scheme. Scheme continues to evolve with a series of standards (Revised<sup>n</sup> Report on the Algorithmic Language Scheme) and a series of [[Scheme Requests for Implementation]].<br />
<br />
[[Clojure]] is a recent dialect of Lisp that principally targets the [[Java Virtual Machine]], as well as the [[Common Language Runtime|CLR]], the [[Python (programming language)|Python VM]], the Ruby VM [[YARV]], and compiling to [[JavaScript]]. It is designed to be a pragmatic general-purpose language. Clojure draws considerable influences from [[Haskell (programming language)|Haskell]] and places a very strong emphasis on immutability.<ref name="clojure-immutability">[http://www.infoq.com/articles/in-depth-look-clojure-collections An In-Depth Look at Clojure Collections], Retrieved 2012-06-24</ref> Every feature supported by Clojure is supported at runtime. Clojure provides access to Java frameworks and libraries, with optional type hints and [[type inference]], so that calls to Java can avoid reflection and enable fast primitive operations.<br />
<br />
In addition, Lisp dialects are used as [[scripting language]]s in a number of applications, with the most well-known being [[Emacs Lisp]] in the [[Emacs]] editor, [[AutoLisp]] and later [[Visual Lisp]] in [[AutoCAD]], Nyquist in [[Audacity (audio editor)|Audacity]], Scheme in [[LilyPond]]. The potential small size of a useful Scheme interpreter makes it particularly popular for embedded scripting. Examples include [[SIOD]] and [[TinyScheme]], both of which have been successfully embedded in the [[GIMP]] image processor under the generic name "Script-fu".<ref name="script-fu">[http://www.gimp.org/docs/script-fu-update.html Script-fu In GIMP 2.4], Retrieved 2009-10-29</ref> LIBREP, a Lisp interpreter by John Harper originally based on the [[Emacs Lisp]] language, has been embedded in the [[Sawfish (window manager)|Sawfish]] [[window manager]].<ref name="librep">[http://sawfish.wikia.com/wiki/Librep librep] at Sawfish Wikia, retrieved 2009-10-29</ref><br />
<br />
==Language innovations==<br />
Lisp was the first language where the structure of program code is represented faithfully and directly in a standard data structure—a quality much later dubbed "[[homoiconicity]]". As a result, Lisp functions can be manipulated, altered or even created within a Lisp program without lower-level manipulations. This is generally considered one of the primary advantages of the language with regard to its expressive power, and makes the language suitable for [[syntactic macros]] and [[metacircular evaluation]].<br />
<br />
A conditional using an ''if-then-else'' syntax was invented by McCarthy in a Fortran context. He proposed its inclusion in [[ALGOL]], but it was not made part of the [[Algol 58]] specification. For Lisp, McCarthy used the more general ''cond''-structure.<ref>{{cite web|url=http://www-formal.stanford.edu/jmc/history/lisp/node2.html|title=LISP prehistory - Summer 1956 through Summer 1958.|quote=I invented conditional expressions in connection with a set of chess legal move routines I wrote in FORTRAN for the IBM 704 at M.I.T. during 1957-58...A paper defining conditional expressions and proposing their use in Algol was sent to the Communications of the ACM but was arbitrarily demoted to a letter to the editor, because it was very short.}}</ref> [[Algol 60]] took up ''if-then-else'' and popularized it.<br />
<br />
Lisp deeply influenced [[Alan Kay]], the leader of the research on [[Smalltalk]], and then in turn Lisp was influenced by Smalltalk, by adopting object-oriented programming features (classes, instances, etc.) in the late 1970s. The Flavours object system (later CLOS) introduced multiple inheritance.<br />
<br />
Lisp introduced the concept of [[Garbage collection (computer science)|automatic garbage collection]], in which the system walks the heap looking for unused memory. Progress in modern sophisticated garbage collection algorithms such as generational garbage collection was stimulated by its use in Lisp.<ref>{{citation |last=Lieberman |first=Henry |last2=Hewitt |first2=Carl |title=A Real-Time Garbage Collector Based on the Lifetimes of Objects |url=http://web.media.mit.edu/~lieber/Lieberary/GC/Realtime/Realtime.html |journal=CACM |volume=26 |issue=6 |date=June 1983 |pages=419–429 |doi=10.1145/358141.358147}}</ref><br />
<br />
[[Edsger W. Dijkstra]] in his 1972 [[Turing Award]] lecture said,<br />
:"With a few very basic principles at its foundation, it [LISP] has shown a remarkable stability. Besides that, LISP has been the carrier for a considerable number of in a sense our most sophisticated computer applications. LISP has jokingly been described as “the most intelligent way to misuse a computer”. I think that description a great compliment because it transmits the full flavour of liberation: it has assisted a number of our most gifted fellow humans in thinking previously impossible thoughts."<ref>{{citation|url=http://www.cs.utexas.edu/~EWD/transcriptions/EWD03xx/EWD340.html|author=Edsger W. Dijkstra|year=1972|title=The Humble Programmer (EWD 340)}} (ACM Turing Award lecture).</ref><br />
<br />
Largely because of its resource requirements with respect to early computing hardware (including early microprocessors), Lisp did not become as popular outside of the [[AI]] community as [[Fortran]] and the [[ALGOL]]-descended [[C (programming language)|C]] language. Because of its suitability to complex and dynamic applications, Lisp is currently enjoying some resurgence of popular interest.<br />
<br />
==Syntax and semantics==<br />
:'''''Note''': This article's examples are written in [[Common Lisp]] (though most are also valid in [[Scheme (programming language)|Scheme]]).''<br />
<br />
===Symbolic expressions (S-expressions)===<br />
Lisp is an [[Expression (computer science)|expression]]-oriented language. Unlike most other languages, no distinction is made between "expressions" and [[Statement (programming)|"statements"]];{{dubious|date=April 2013}}<!-- (progn ...), (setq ...). There is no syntactic distinction, but sequential evaluation is there. --> all code and data are written as expressions. When an expression is ''evaluated'', it produces a value (in Common Lisp, possibly multiple values), which can then be embedded into other expressions. Each value can be any data type.<br />
<br />
McCarthy's 1958 paper introduced two types of syntax: [[S-expression]]s (Symbolic expressions, also called "sexps"), which mirror the internal representation of code and data; and [[M-expression]]s (Meta Expressions), which express functions of S-expressions. M-expressions never found favor, and almost all Lisps today use S-expressions to manipulate both code and data.<br />
<br />
The use of parentheses is Lisp's most immediately obvious difference from other programming language families. As a result, students have long given Lisp nicknames such as ''Lost In Stupid Parentheses'', or ''Lots of Irritating Superfluous Parentheses''.<ref name="LEVIN2">{{cite web| title=The Jargon File - Lisp| url=http://www.catb.org/~esr/jargon/html/L/LISP.html| accessdate=2006-10-13}}</ref><!-- Do not insert more nicknames. People can look in the Jargon File for them. --> However, the S-expression syntax is also responsible for much of Lisp's power: the syntax is extremely regular, which facilitates manipulation by computer. However, the syntax of Lisp is not limited to traditional parentheses notation. It can be extended to include alternative notations. [[XMLisp]], for instance, is a Common Lisp extension that employs the [[Meta-object protocol|metaobject-protocol]] to integrate S-expressions with the [[Xml|Extensible Markup Language (XML)]].<br />
<br />
The reliance on expressions gives the language great flexibility. Because Lisp [[function (programming)|functions]] are themselves written as lists, they can be processed exactly like data. This allows easy writing of programs which manipulate other programs ([[metaprogramming]]). Many Lisp dialects exploit this feature using macro systems, which enables extension of the language almost without limit.<br />
<br />
===Lists===<br />
A Lisp list is written with its elements separated by whitespace, and surrounded by parentheses. For example, {{Lisp2|(1 2 foo)}} is a list whose elements are three ''atoms'' {{Lisp2|1}}, {{Lisp2|2}}, and [[foo|{{Lisp2|foo}}]]. These values are implicitly typed: they are respectively two integers and a Lisp-specific data type called a "symbol", and do not have to be declared as such.<br />
<br />
The empty list {{Lisp2|()}} is also represented as the special atom {{Lisp2|nil}}. This is the only entity in Lisp which is both an atom and a list.<br />
<br />
Expressions are written as lists, using [[Polish notation|prefix notation]]. The first element in the list is the name of a function, the name of a macro, a lambda expression or the name of a "special operator" (see below). The remainder of the list are the arguments. For example, the function {{Lisp2|list}} returns its arguments as a list, so the expression<br />
<syntaxhighlight lang=Lisp><br />
(list 1 2 (quote foo))<br />
</syntaxhighlight><br />
evaluates to the list {{Lisp2|(1 2 foo)}}. The "quote" before the [[foo|{{Lisp2|foo}}]] in the preceding example is a "special operator" which returns its argument without evaluating it. Any unquoted expressions are recursively evaluated before the enclosing expression is evaluated. For example,<br />
<syntaxhighlight lang=Lisp><br />
(list 1 2 (list 3 4))<br />
</syntaxhighlight><br />
evaluates to the list {{Lisp2|(1 2 (3 4))}}. Note that the third argument is a list; lists can be nested.<br />
<br />
===Operators===<br />
Arithmetic operators are treated similarly. The expression<br />
<syntaxhighlight lang=Lisp><br />
(+ 1 2 3 4)<br />
</syntaxhighlight><br />
evaluates to 10. The equivalent under [[infix notation]] would be "{{Lisp2|1 + 2 + 3 + 4}}".<br />
<br />
Lisp has no notion of operators as implemented in Algol-derived languages. Arithmetic operators in Lisp are [[variadic function]]s (or ''[[n-ary]]''), able to take any number of arguments. A C-style '++' increment operator is sometimes implemented under the name <tt>incf</tt> giving syntax <br />
<syntaxhighlight lang=Lisp><br />
(incf x)<br />
</syntaxhighlight><br />
, equivalent to <tt>(setq x (+ x 1))<tt>, returning the new value of <tt>x</tt>.<br />
<br />
"Special operators" (sometimes called "special forms") provide Lisp's control structure. For example, the special operator {{Lisp2|if}} takes three arguments. If the first argument is non-nil, it evaluates to the second argument; otherwise, it evaluates to the third argument. Thus, the expression<br />
<syntaxhighlight lang=Lisp><br />
(if nil<br />
(list 1 2 "foo")<br />
(list 3 4 "bar"))<br />
</syntaxhighlight><br />
evaluates to {{Lisp2|(3 4 "bar")}}. Of course, this would be more useful if a non-trivial expression had been substituted in place of {{Lisp2|nil}}.<br />
<br />
===Lambda expressions and function definition===<br />
Another special operator, {{Lisp2|lambda}}, is used to bind variables to values which are then evaluated within an expression. This operator is also used to create functions: the arguments to {{Lisp2|lambda}} are a list of arguments, and the expression or expressions to which the function evaluates (the returned value is the value of the last expression that is evaluated). The expression<br />
<syntaxhighlight lang=Lisp><br />
(lambda (arg) (+ arg 1))<br />
</syntaxhighlight><br />
evaluates to a function that, when applied, takes one argument, binds it to {{Lisp2|arg}} and returns the number one greater than that argument. Lambda expressions are treated no differently from named functions; they are invoked the same way. Therefore, the expression<br />
<syntaxhighlight lang=Lisp><br />
((lambda (arg) (+ arg 1)) 5)<br />
</syntaxhighlight><br />
evaluates to {{Lisp2|6}}.<br />
<br />
Named functions are created by storing a lambda expression in a symbol using the [[defun]] macro.<br />
<syntaxhighlight lang=Lisp><br />
(defun foo (a b c d) (+ a b c d))<br />
</syntaxhighlight><br />
<br />
{{Lisp2|(defun f (a) b...)}} defines a new function named {{Lisp2|f}} in the global environment. It is a shorthand for the expression:<br />
<br />
<syntaxhighlight lang=Lisp><br />
(place-in-function-definition-slot-of-symbol 'f #'(lambda (a) b...))<br />
</syntaxhighlight><br />
<br />
===Atoms===<br />
In the original '''LISP''' there were two fundamental [[data type]]s: atoms and lists. A list was a finite ordered sequence of elements, where each element is in itself either an atom or a list, and an atom was a [[number]] or a symbol. A symbol was essentially a unique named item, written as an [[alphanumeric]] string in [[source code]], and used either as a variable name or as a data item in [[symbolic processing]]. For example, the list {{Lisp2|(FOO (BAR 1) 2)}} contains three elements: the symbol FOO, the list {{Lisp2|(BAR 1)}}, and the number 2.<br />
<br />
The essential difference between atoms and lists was that atoms were immutable and unique. Two atoms that appeared in different places in source code but were written in exactly the same way represented the same object,{{Citation needed|date=November 2008}} whereas each list was a separate object that could be altered independently of other lists and could be distinguished from other lists by comparison operators.<br />
<br />
As more data types were introduced in later Lisp dialects, and [[programming style]]s evolved, the concept of an atom lost importance.{{Citation needed|date=November 2008}} Many dialects still retained the predicate ''atom'' for [[legacy compatibility]],{{Citation needed|date=November 2008}} defining it true for any object which is not a cons.<br />
<br />
===Conses and lists===<br />
{{Main|Cons}}<br />
[[File:Cons-cells.svg|thumb|right|300px|Box-and-pointer diagram for the list (42 69 613)]]<br />
A Lisp list is [[singly linked list|singly linked]]. Each cell of this list is called a ''cons'' (in Scheme, a ''pair''), and is composed of two [[pointer (computer programming)|pointer]]s, called the ''car'' and ''cdr''. These are respectively equivalent to the {{Lisp2|data}} and {{Lisp2|next}} fields discussed in the article ''[[linked list]]''.<br />
<br />
Of the many data structures that can be built out of cons cells, one of the most basic is called a ''proper list''. A proper list is either the special {{Lisp2|nil}} (empty list) symbol, or a cons in which the {{Lisp2|car}} points to a datum (which may be another cons structure, such as a list), and the {{Lisp2|cdr}} points to another proper list.<br />
<br />
If a given cons is taken to be the head of a linked list, then its car points to the first element of the list, and its cdr points to the rest of the list. For this reason, the {{Lisp2|car}} and {{Lisp2|cdr}} functions are also called {{Lisp2|first}} and {{Lisp2|rest}} when referring to conses which are part of a linked list (rather than, say, a tree).<br />
<br />
Thus, a Lisp list is not an atomic object, as an instance of a container class in C++ or Java would be. A list is nothing more than an aggregate of linked conses. A variable which refers to a given list is simply a pointer to the first cons in the list. Traversal of a list can be done by "cdring down" the list; that is, taking successive cdrs to visit each cons of the list; or by using any of a number of [[higher-order function]]s to map a function over a list.<br />
<br />
Because conses and lists are so universal in Lisp systems, it is a common misconception that they are Lisp's only data structures. In fact, all but the most simplistic Lisps have other data structures – such as vectors ([[Array data type|arrays]]), hash tables, structures, and so forth.<br />
<br />
====S-expressions represent lists====<br />
Parenthesized S-expressions represent linked list structures. There are several ways to represent the same list as an S-expression. A cons can be written in ''dotted-pair notation'' as {{Lisp2|(a . b)}}, where {{Lisp2|a}} is the car and {{Lisp2|b}} the cdr. A longer proper list might be written {{Lisp2|(a . (b . (c . (d . nil))))}} in dotted-pair notation. This is conventionally abbreviated as {{Lisp2|(a b c d)}} in ''list notation''. An improper list<ref>NB: a so-called "dotted list" is only one kind of "improper list". The other kind is the "circular list" where the cons cells form a loop. Typically this is represented using #n=(...) to represent the target cons cell that will have multiple references, and #n# is used to refer to this cons. For instance, (#1=(a b) . #1#) would normally be printed as ((a b) a b) (without circular structure printing enabled), but makes the reuse of the cons cell clear. #1=(a . #1#) cannot normally be printed as it is circular, the CDR of the cons cell defined by #1= is itself.</ref> may be written in a combination of the two – as {{Lisp2|(a b c . d)}} for the list of three conses whose last cdr is {{Lisp2|d}} (i.e., the list {{Lisp2|(a . (b . (c . d)))}} in fully specified form).<br />
<br />
====List-processing procedures====<br />
Lisp provides many built-in procedures for accessing and controlling lists. Lists can be created directly with the {{Lisp2|list}} procedure, which takes any number of arguments, and returns the list of these arguments.<br />
<syntaxhighlight lang=Lisp><br />
(list 1 2 'a 3)<br />
;Output: (1 2 a 3)<br />
</syntaxhighlight><br />
<syntaxhighlight lang=Lisp><br />
(list 1 '(2 3) 4)<br />
;Output: (1 (2 3) 4)<br />
</syntaxhighlight><br />
Because of the way that lists are constructed from [[cons pair]]s, the {{Lisp2|cons}} procedure can be used to add an element to the front of a list. Note that the {{Lisp2|cons}} procedure is asymmetric in how it handles list arguments, because of how lists are constructed.<br />
<syntaxhighlight lang=Lisp><br />
(cons 1 '(2 3))<br />
;Output: (1 2 3)<br />
</syntaxhighlight><br />
<syntaxhighlight lang=Lisp><br />
(cons '(1 2) '(3 4))<br />
;Output: ((1 2) 3 4)<br />
</syntaxhighlight><br />
The {{Lisp2|append}} procedure appends two (or more) lists to one another. Because Lisp lists are linked lists, appending two lists has [[Big O notation|asymptotic time complexity]] <math>O(n)</math><br />
<syntaxhighlight lang=Lisp><br />
(append '(1 2) '(3 4))<br />
;Output: (1 2 3 4)<br />
</syntaxhighlight><br />
<syntaxhighlight lang=Lisp><br />
(append '(1 2 3) '() '(a) '(5 6))<br />
;Output: (1 2 3 a 5 6)<br />
</syntaxhighlight><br />
<br />
====Shared structure====<br />
Lisp lists, being simple linked lists, can share structure with one another. That is to say, two lists can have the same ''tail'', or final sequence of conses. For instance, after the execution of the following Common Lisp code:<br />
<syntaxhighlight lang=Lisp><br />
(setf foo (list 'a 'b 'c))<br />
(setf bar (cons 'x (cdr foo)))<br />
</syntaxhighlight><br />
the lists {{Lisp2|foo}} and {{Lisp2|bar}} are {{Lisp2|(a b c)}} and {{Lisp2|(x b c)}} respectively. However, the tail {{Lisp2|(b c)}} is the same structure in both lists. It is not a copy; the cons cells pointing to {{Lisp2|b}} and {{Lisp2|c}} are in the same memory locations for both lists.<br />
<br />
Sharing structure rather than copying can give a dramatic performance improvement. However, this technique can interact in undesired ways with functions that alter lists passed to them as arguments. Altering one list, such as by replacing the {{Lisp2|c}} with a {{Lisp2|goose}}, will affect the other:<br />
<syntaxhighlight lang=Lisp><br />
(setf (third foo) 'goose)<br />
</syntaxhighlight><br />
This changes {{Lisp2|foo}} to {{Lisp2|(a b goose)}}, but thereby also changes {{Lisp2|bar}} to {{Lisp2|(x b goose)}} – a possibly unexpected result. This can be a source of bugs, and functions which alter their arguments are documented as ''destructive'' for this very reason.<br />
<br />
Aficionados of [[functional programming]] avoid destructive functions. In the Scheme dialect, which favors the functional style, the names of destructive functions are marked with a cautionary exclamation point, or "bang"—such as {{Lisp2|set-car!}} (read ''set car bang''), which replaces the car of a cons. In the Common Lisp dialect, destructive functions are commonplace; the equivalent of {{Lisp2|set-car!}} is named {{Lisp2|rplaca}} for "replace car." This function is rarely seen however as Common Lisp includes a special facility, {{Lisp2|setf}}, to make it easier to define and use destructive functions. A frequent style in Common Lisp is to write code functionally (without destructive calls) when prototyping, then to add destructive calls as an optimization where it is safe to do so.<br />
<br />
===Self-evaluating forms and quoting===<br />
Lisp evaluates expressions which are entered by the user. Symbols and lists evaluate to some other (usually, simpler) expression – for instance, a symbol evaluates to the value of the variable it names; {{Lisp2|(+ 2 3)}} evaluates to {{Lisp2|5}}. However, most other forms evaluate to themselves: if you enter {{Lisp2|5}} into Lisp, it returns {{Lisp2|5}}.<br />
<br />
Any expression can also be marked to prevent it from being evaluated (as is necessary for symbols and lists). This is the role of the {{Lisp2|quote}} special operator, or its abbreviation {{Lisp2|'}} (a single quotation mark). For instance, usually if you enter the symbol {{Lisp2|foo}} you will get back the value of the corresponding variable (or an error, if there is no such variable). If you wish to refer to the literal symbol, you enter {{Lisp2|(quote foo)}} or, usually, {{Lisp2|'foo}}.<br />
<br />
{{anchor|Backquote}}Both Common Lisp and Scheme also support the ''backquote'' operator (known as ''[[quasiquote]]'' in Scheme), entered with the {{Lisp2|`}} character ([[Grave accent#Use in programming|grave accent]]). This is almost the same as the plain quote, except it allows expressions to be evaluated and their values interpolated into a quoted list with the comma {{Lisp2|,}} ''unquote'' and comma-at {{Lisp2|,@}} ''splice'' operators. If the variable {{Lisp2|snue}} has the value {{Lisp2|(bar baz)}} then {{Lisp2|`(foo ,snue)}} evaluates to {{Lisp2|(foo (bar baz))}}, while {{Lisp2|`(foo ,@snue)}} evaluates to {{Lisp2|(foo bar baz)}}. The backquote is most frequently used in defining macro expansions.<ref>{{cite web|url=http://www.cs.washington.edu/education/courses/cse341/04wi/lectures/14-scheme-quote.html |title=CSE 341: Scheme: Quote, Quasiquote, and Metaprogramming |publisher=Cs.washington.edu |date=1999-02-22 |accessdate=2013-11-15}}</ref><ref>[http://repository.readscheme.org/ftp/papers/pepm99/bawden.pdf Quasiquotation in Lisp], Alan Bawden</ref><br />
<br />
Self-evaluating forms and quoted forms are Lisp's equivalent of literals. It may be possible to modify the values of (mutable) literals in program code. For instance, if a function returns a quoted form, and the code that calls the function modifies the form, this may alter the behavior of the function on subsequent iterations.<br />
<br />
<syntaxhighlight lang=lisp><br />
(defun should-be-constant ()<br />
'(one two three))<br />
<br />
(let ((stuff (should-be-constant)))<br />
(setf (third stuff) 'bizarre)) ; bad!<br />
<br />
(should-be-constant) ; returns (one two bizarre)<br />
</syntaxhighlight><br />
<br />
Modifying a quoted form like this is generally considered bad style, and is defined by ANSI Common Lisp as erroneous (resulting in "undefined" behavior in compiled files, because the file-compiler can coalesce similar constants, put them in write-protected memory, etc.).<br />
<br />
Lisp's formalization of quotation has been noted by [[Douglas Hofstadter]] (in ''[[Gödel, Escher, Bach]]'') and others as an example of the [[philosophy|philosophical]] idea of [[self-reference]].<br />
<br />
===Scope and closure===<br />
The Lisp family splits over the use of dynamic or static (a.k.a. lexical) [[scope (programming)|scope]]. Clojure, Common Lisp and Scheme make use of static scoping by default, while [[Newlisp]], [[Picolisp]] and the embedded languages in [[Emacs]] and [[AutoCAD]] use dynamic scoping.<br />
<br />
===List structure of program code; exploitation by macros and compilers===<br />
A fundamental distinction between Lisp and other languages is that in Lisp, the textual representation of a program is simply a human-readable description of the same internal data structures (linked lists, symbols, number, characters, etc.) as would be used by the underlying Lisp system.<br />
<br />
Lisp uses this to implement a very powerful macro system. Like other macro languages such as [[C (programming language)|C]], a macro returns code that can then be compiled. However, unlike C macros, the macros are Lisp functions and so can exploit the full power of Lisp.<br />
<br />
Further, because Lisp code has the same structure as lists, macros can be built with any of the list-processing functions in the language. In short, anything that Lisp can do to a data structure, Lisp macros can do to code. In contrast, in most other languages, the parser's output is purely internal to the language implementation and cannot be manipulated by the programmer.<br />
<br />
This feature makes it easy to develop ''efficient'' languages within languages. For example, the Common Lisp Object System can be implemented cleanly as a language extension using macros. This means that if an application requires a different inheritance mechanism, it can use a different object system. This is in stark contrast to most other languages; for example, Java does not support multiple inheritance and there is no reasonable way to add it.<br />
<br />
In simplistic Lisp implementations, this list structure is directly [[interpreter (computing)|interpreted]] to run the program; a function is literally a piece of list structure which is traversed by the interpreter in executing it. However, most substantial Lisp systems also include a compiler. The compiler translates list structure into machine code or [[bytecode]] for execution. This code can run as fast as code compiled in conventional languages such as C.<br />
<br />
Macros expand before the compilation step, and thus offer some interesting options. If a program needs a precomputed table, then a macro might create the table at compile time, so the compiler need only output the table and need not call code to create the table at run time. Some Lisp implementations even have a mechanism, <code>eval-when</code>, that allows code to be present during compile time (when a macro would need it), but not present in the emitted module.<ref>[https://www.gnu.org/software/emacs/manual/html_node/cl/Time-of-Evaluation.html Time of Evaluation - Common Lisp Extensions]. Gnu.org. Retrieved on 2013-07-17.</ref><br />
<br />
===Evaluation and the read–eval–print loop===<br />
Lisp languages are frequently used with an interactive [[command line]], which may be combined with an [[integrated development environment]]. The user types in expressions at the command line, or directs the IDE to transmit them to the Lisp system. Lisp ''reads'' the entered expressions, ''evaluates'' them, and ''prints'' the result. For this reason, the Lisp command line is called a "[[read–eval–print loop]]", or ''[[REPL]]''.<br />
<br />
The basic operation of the REPL is as follows. This is a simplistic description which omits many elements of a real Lisp, such as quoting and macros.<br />
<br />
The {{Lisp2|read}} function accepts textual S-expressions as input, and parses them into an internal data structure. For instance, if you type the text {{Lisp2|(+ 1 2)}} at the prompt, {{Lisp2|read}} translates this into a linked list with three elements: the symbol {{Lisp2|+}}, the number 1, and the number 2. It so happens that this list is also a valid piece of Lisp code; that is, it can be evaluated. This is because the car of the list names a function—the addition operation.<br />
<br />
Note that a {{Lisp2|foo}} will be read as a single symbol. {{Lisp2|123}} will be read as the number one hundred and twenty-three. {{Lisp2|"123"}} will be read as the string "123".<br />
<br />
The {{Lisp2|eval}} function evaluates the data, returning zero or more other Lisp data as a result. Evaluation does not have to mean interpretation; some Lisp systems compile every expression to native machine code. It is simple, however, to describe evaluation as interpretation: To evaluate a list whose car names a function, {{Lisp2|eval}} first evaluates each of the arguments given in its cdr, then applies the function to the arguments. In this case, the function is addition, and applying it to the argument list {{Lisp2|(1 2)}} yields the answer {{Lisp2|3}}. This is the result of the evaluation.<br />
<br />
The symbol {{Lisp2|foo}} evaluates to the value of the symbol foo. Data like the string "123" evaluates to the same string. The list {{Lisp2|(quote (1 2 3))}} evaluates to the list (1 2 3).<br />
<br />
It is the job of the {{Lisp2|print}} function to represent output to the user. For a simple result such as {{Lisp2|3}} this is trivial. An expression which evaluated to a piece of list structure would require that {{Lisp2|print}} traverse the list and print it out as an S-expression.<br />
<br />
To implement a Lisp REPL, it is necessary only to implement these three functions and an infinite-loop function. (Naturally, the implementation of {{Lisp2|eval}} will be complicated, since it must also implement all special operators like {{Lisp2|if}} or {{Lisp2|lambda}}.) This done, a basic REPL itself is but a single line of code: {{Lisp2|(loop (print (eval (read))))}}.<br />
<br />
The Lisp REPL typically also provides input editing, an input history, error handling and an interface to the debugger.<br />
<br />
Lisp is usually evaluated [[eager evaluation|eagerly]]. In [[Common Lisp]], arguments are evaluated in [[applicative order]] ('leftmost innermost'), while in [[Scheme programming language|Scheme]] order of arguments is undefined, leaving room for optimization by a compiler.<br />
<br />
===Control structures===<br />
Lisp originally had very few control structures, but many more were added during the language's evolution. (Lisp's original conditional operator, {{Lisp2|cond}}, is the precursor to later {{Lisp2|if-then-else}} structures.)<br />
<br />
Programmers in the Scheme dialect often express loops using [[tail recursion]]. Scheme's commonality in academic computer science has led some students to believe that tail recursion is the only, or the most common, way to write iterations in Lisp, but this is incorrect. All frequently seen Lisp dialects have imperative-style iteration constructs, from Scheme's {{Lisp2|do}} loop to [[Common Lisp]]'s complex {{Lisp2|loop}} expressions. Moreover, the key issue that makes this an objective rather than subjective matter is that Scheme makes specific requirements for the handling of [[tail call]]s, and consequently the reason that the use of tail recursion is generally encouraged for Scheme is that the practice is expressly supported by the language definition itself. By contrast, ANSI Common Lisp does not require<ref>[http://www.lispworks.com/documentation/HyperSpec/Body/03_bbc.htm 3.2.2.3 Semantic Constraints] in [http://www.lispworks.com/documentation/HyperSpec/Front/index.htm ''Common Lisp HyperSpec'']</ref> the optimization commonly referred to as tail call elimination. Consequently, the fact that tail recursive style as a casual replacement for the use of more traditional [[iteration]] constructs (such as {{Lisp2|do}}, {{Lisp2|dolist}} or {{Lisp2|loop}}) is discouraged<ref>4.3. Control Abstraction (Recursion vs. Iteration) in [http://www.cs.umd.edu/~nau/cmsc421/norvig-lisp-style.pdf Tutorial on Good Lisp Programming Style] by [[Kent Pitman|Pitman]] and [[Peter Norvig|Norvig]], August, 1993.</ref> in Common Lisp is not just a matter of stylistic preference, but potentially one of efficiency (since an apparent tail call in Common Lisp may not compile as a simple [[Branch (computer science)|jump]]) and program correctness (since tail recursion may increase stack use in Common Lisp, risking [[stack overflow]]).<br />
<br />
Some Lisp control structures are ''special operators'', equivalent to other languages' syntactic keywords. Expressions using these operators have the same surface appearance as function calls, but differ in that the arguments are not necessarily evaluated—or, in the case of an iteration expression, may be evaluated more than once.<br />
<br />
In contrast to most other major programming languages, Lisp allows the programmer to implement control structures using the language itself. Several control structures are implemented as Lisp macros, and can even be macro-expanded by the programmer who wants to know how they work.<br />
<br />
Both Common Lisp and Scheme have operators for non-local control flow. The differences in these operators are some of the deepest differences between the two dialects. Scheme supports ''re-entrant [[continuation]]s'' using the {{Lisp2|call/cc}} procedure, which allows a program to save (and later restore) a particular place in execution. Common Lisp does not support re-entrant continuations, but does support several ways of handling escape continuations.<br />
<br />
Frequently, the same algorithm can be expressed in Lisp in either an imperative or a functional style. As noted above, Scheme tends to favor the functional style, using tail recursion and continuations to express control flow. However, imperative style is still quite possible. The style preferred by many Common Lisp programmers may seem more familiar to programmers used to structured languages such as C, while that preferred by Schemers more closely resembles pure-functional languages such as [[Haskell (programming language)|Haskell]].<br />
<br />
Because of Lisp's early heritage in list processing, it has a wide array of higher-order functions relating to iteration over sequences. In many cases where an explicit loop would be needed in other languages (like a {{Lisp2|for}} loop in C) in Lisp the same task can be accomplished with a higher-order function. (The same is true of many functional programming languages.)<br />
<br />
A good example is a function which in Scheme is called {{Lisp2|map}} and in Common Lisp is called {{Lisp2|mapcar}}. Given a function and one or more lists, {{Lisp2|mapcar}} applies the function successively to the lists' elements in order, collecting the results in a new list:<br />
<syntaxhighlight lang=Lisp><br />
(mapcar #'+ '(1 2 3 4 5) '(10 20 30 40 50))<br />
</syntaxhighlight><br />
This applies the {{Lisp2|+}} function to each corresponding pair of list elements, yielding the result {{Lisp2|(11 22 33 44 55)}}.<br />
<br />
==Examples==<br />
Here are examples of Common Lisp code.<br />
<br />
The basic "[[Hello world]]" program:<br />
<syntaxhighlight lang=Lisp><br />
(print "Hello world")<br />
</syntaxhighlight><br />
Lisp syntax lends itself naturally to recursion. Mathematical problems such as the enumeration of recursively defined sets are simple to express in this notation.<br />
<br />
Evaluate a number's [[factorial]]:<br />
<syntaxhighlight lang=Lisp><br />
(defun factorial (n)<br />
(if (= n 0) 1<br />
(* n (factorial (- n 1)))))<br />
</syntaxhighlight><br />
An alternative implementation, often faster than the previous version if the Lisp system has [[tail recursion]] optimization:<br />
<syntaxhighlight lang=Lisp><br />
(defun factorial (n &optional (acc 1))<br />
(if (= n 0) acc<br />
(factorial (- n 1) (* acc n))))<br />
</syntaxhighlight><br />
Contrast with an iterative version which uses [[Common Lisp]]'s {{Lisp2|loop}} macro:<br />
<syntaxhighlight lang=Lisp><br />
(defun factorial (n)<br />
(loop for i from 1 to n<br />
for fac = 1 then (* fac i)<br />
finally (return fac)))<br />
</syntaxhighlight><br />
<br />
The following function reverses a list. (Lisp's built-in ''reverse'' function does the same thing.)<br />
<syntaxhighlight lang=Lisp><br />
(defun -reverse (list)<br />
(let ((return-value '()))<br />
(dolist (e list) (push e return-value))<br />
return-value))<br />
</syntaxhighlight><br />
<br />
==Object systems==<br />
Various object systems and models have been built on top of, alongside, or into Lisp, including:<br />
*The [[Common Lisp Object System]], CLOS, is an integral part of ANSI Common Lisp. CLOS descended from New Flavors and CommonLOOPS. ANSI Common Lisp was the first standardized object-oriented programming language (1994, ANSI X3J13).<br />
*ObjectLisp<ref>pg 17 of Bobrow 1986</ref> or [[Object Lisp]], used by [[Lisp Machines Incorporated]] and early versions of Macintosh Common Lisp<br />
*LOOPS (Lisp Object-Oriented Programming System) and the later [[CommonLOOPS]]<br />
*[[Flavors (computer science)|Flavors]], built at [[Massachusetts Institute of Technology|MIT]], and its descendant New Flavors (developed by [[Symbolics]]).<br />
*KR (short for Knowledge Representation), a [[Constraint satisfaction|constraint]]s-based object system developed to aid the writing of Garnet, a GUI library for [[Common Lisp]].<br />
*[[Knowledge Engineering Environment|KEE]] used an object system called UNITS and integrated it with an [[inference engine]]<ref>Veitch, p 108, 1988</ref> and a [[Truth maintenance systems|truth maintenance system]] (ATMS).<br />
<br />
==See also==<br />
*[[Fexpr]]<br />
*[[Maxima (software)|Maxima]]<br />
*[[mod_lisp]]<br />
*[[P convention]]<br />
*[[Prolog]]<br />
*[[LFE (programming language)|LFE (Lisp Flavored Erlang)]]<br />
*[[MATHLAB]]<br />
<br />
==References==<br />
{{Reflist|30em}}<br />
<br />
==Further reading==<br />
{{Refbegin}}<br />
*{{cite web<br />
| last = McCarthy<br />
| first = John<br />
| authorlink =<br />
| title = The implementation of Lisp<br />
| work = History of Lisp<br />
| publisher = Stanford University<br />
| date = 1979-02-12<br />
| url = http://www-formal.stanford.edu/jmc/history/lisp/node3.html<br />
| doi =<br />
| accessdate = 2008-10-17}}<br />
*{{Cite conference<br />
| first = Guy L.<br />
| last = Steele, Jr.<br />
| authorlink =<br />
|author2=Richard P. Gabriel<br />
| title = The evolution of Lisp<br />
| conference = The second ACM SIGPLAN conference on History of programming languages<br />
| pages = 231–270<br />
| publisher = ACM<br />
| year = 1993<br />
| location = New York, NY<br />
| url = http://www.dreamsongs.com/NewFiles/HOPL2-Uncut.pdf<br />
| doi =<br />
| id =<br />
| isbn = 0-89791-570-4<br />
| accessdate = 2008-10-17}}<br />
*{{Cite book<br />
| first = Jim<br />
| last = Veitch<br />
| author-link =<br />
| author2-link =<br />
| editor-last = Salus<br />
| editor-first = Peter H<br />
| editor2-last =<br />
| editor2-first =<br />
| contribution = A history and description of CLOS<br />
| contribution-url =<br />
| title = Handbook of programming languages<br />
| volume = Volume IV, Functional and logic programming languages<br />
| edition = first<br />
| year = 1998<br />
| pages = 107–158<br />
| place = Indianapolis, IN<br />
| publisher = Macmillan Technical Publishing<br />
| url =<br />
| doi =<br />
| id =<br />
| isbn = 1-57870-011-6<br />
| postscript = <!--None--> }}<br />
*{{Cite book<br />
|title= [[Structure and Interpretation of Computer Programs]]<br />
|first= Harold<br />
|last= Abelson<br />
|author-link= Harold Abelson<br />
|first2= Gerald Jay<br />
|last2= Sussman<br />
|author2-link= Gerald Jay Sussman<br />
|first3= Julie<br />
|last3= Sussman<br />
|author3-link= Julie Sussman<br />
|year= 1996<br />
|edition= 2nd<br />
|publisher= MIT Press<br />
|isbn= 0-262-01153-0<br />
|doi= }}<br />
*[https://www.gnu.org/gnu/rms-lisp.html My Lisp Experiences and the Development of GNU Emacs], [[transcription (linguistics)|transcript]] of [[Richard Stallman]]'s speech, 28 October 2002, at the [[International Lisp Conference]]<br />
*{{Cite book<br />
|first= Paul<br />
|last= Graham<br />
|author-link= Paul Graham (computer programmer)<br />
|title= [[Hackers & Painters| Hackers & Painters. Big Ideas from the Computer Age]]<br />
|year= 2004<br />
|publisher= O'Reilly<br />
|isbn= 0-596-00662-4<br />
|doi= }}<br />
*{{Cite book<br />
|editor-last= Berkeley<br />
|editor-first= Edmund C.<br />
|editor-link= Edmund Berkeley<br />
|editor2-last= Bobrow<br />
|editor2-first= Daniel G.<br />
|editor2-link= Daniel G. Bobrow<br />
|title= The Programming Language LISP: Its Operation and Applications<br />
|url= http://www.softwarepreservation.org/projects/LISP/book/III_LispBook_Apr66.pdf<br />
|date= March 1964<br />
|publisher= MIT Press<br />
|location= Cambridge, Massachusetts<br />
|isbn=<br />
|doi= }}<br />
*{{Cite book<br />
|last= Weissman<br />
|first= Clark<br />
|title= LISP 1.5 Primer<br />
|year= 1967<br />
|url= http://www.softwarepreservation.org/projects/LISP/book/Weismann_LISP1.5_Primer_1967.pdf<br />
|publisher= Dickenson Publishing Company Inc.<br />
|location= Belmont, California<br />
|isbn=<br />
|doi=}}<br />
{{Refend}}<br />
<br />
==External links==<br />
{{Sister project links|wikt=Lisp|commons=Category:Lisp (programming language)|n=no|q=Lisp programming language|b=Subject:Lisp programming language|v=Topic:Lisp|s=Lambda Papers}}<br />
;History<br />
*[http://www-formal.stanford.edu/jmc/history/lisp/lisp.html History of Lisp] – [[John McCarthy (computer scientist)|John McCarthy]]'s history of 12 February 1979<br />
*[http://www8.informatik.uni-erlangen.de/html/lisp-enter.html Lisp History]{{dead link|date=May 2013}} – Herbert Stoyan's history compiled from the documents (acknowledged by McCarthy as more complete than his own, see: [http://www-formal.stanford.edu/jmc/history/ McCarthy's history links])<br />
*[http://www.softwarepreservation.org/projects/LISP/ History of LISP at the Computer History Museum]<br />
<br />
;Associations and meetings<br />
*[http://www.alu.org/ Association of Lisp Users]<br />
*[http://www.weitz.de/eclm2013/ European Common Lisp Meeting]<br />
*[http://european-lisp-symposium.org/ European Lisp Symposium]<br />
*[http://www.international-lisp-conference.org/ International Lisp Conference]<br />
<br />
; Books and tutorials<br />
*''[http://www.lisperati.com/casting.html Casting SPELs in Lisp]'', a comic-book style introductory tutorial<br />
*''[http://paulgraham.com/onlisptext.html On Lisp]'', a free book by [[Paul Graham (computer programmer)|Paul Graham]]<br />
*''[http://www.gigamonkeys.com/book/ Practical Common Lisp]'', freeware edition by Peter Seibel<br />
* [https://leanpub.com/lispweb Lisp for the web]<br />
* [http://landoflisp.com/ Land of Lisp]<br />
* [http://letoverlambda.com/ Let over Lambda]<br />
<br />
; Interviews<br />
*[http://purl.umn.edu/107476 Oral history interview with John McCarthy] at [[Charles Babbage Institute]], University of Minnesota, Minneapolis. McCarthy discusses his role in the development of time-sharing at the Massachusetts Institute of Technology. He also describes his work in artificial intelligence (AI) funded by the Advanced Research Projects Agency, including logic-based AI (LISP) and robotics.<br />
*[http://www.se-radio.net/2008/01/episode-84-dick-gabriel-on-lisp/ Interview] with [[Richard P. Gabriel]] (Podcast)<br />
<br />
;Resources<br />
*[http://www.cliki.net/ CLiki: the common lisp wiki]<br />
*[http://www.cl-user.net/ Common Lisp directory]<br />
*[http://www.faqs.org/faqs/lisp-faq/ Lisp FAQ Index]<br />
*[http://paste.lisp.org/ lisppaste]<br />
*[http://planet.lisp.org/ Planet Lisp]<br />
*[http://lispnews.wordpress.com/ Weekly Lisp News]<br />
*{{dmoz|Computers/Programming/Languages/Lisp|Lisp}}<br />
<br />
{{John McCarthy navbox}}<br />
<br />
{{DEFAULTSORT:Lisp Programming Language}}<br />
[[Category:1958 in computer science]]<br />
[[Category:Academic programming languages]]<br />
[[Category:American inventions]]<br />
[[Category:Articles with example Lisp code]]<br />
[[Category:Dynamically typed programming languages]]<br />
[[Category:Functional languages]]<br />
[[Category:Lisp (programming language)| ]]<br />
[[Category:Lisp programming language family| ]]<br />
[[Category:Programming languages created in 1958]]<br />
[[Category:Programming languages created in the 1950s]]<br />
[[Category:Extensible syntax programming languages]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Continuation-passing_style&diff=676028331Continuation-passing style2015-08-14T05:51:25Z<p>PuercoPop: Citation needed</p>
<hr />
<div>In [[functional programming]], '''continuation-passing style''' ('''CPS''') is a style of programming in which [[control flow|control]] is passed explicitly in the form of a [[continuation]]. This is contrasted with [[direct style]], which is the usual style of programming. [[Gerald Jay Sussman]] and [[Guy L. Steele, Jr.]] coined the phrase in [[AI Memo]] 349 (1975), which sets out the first version of the [[Scheme (programming language)|Scheme]] programming language.<ref>{{cite journal<br />
| author1-link = Gerald Jay Sussman | first1 = Gerald Jay | last1 = Sussman | author2-link = Guy L. Steele, Jr. | first2 = Guy L., Jr. | last2 = Steele<br />
|date=December 1975<br />
| title =[[wikisource:Scheme: An interpreter for extended lambda calculus|Scheme: An interpreter for extended lambda calculus]]<br />
| journal = [[AI Memo]]<br />
| volume = 349<br />
| page = 19<br />
| quote = That is, in this '''continuation-passing programming style''', ''a function always "returns" its result by "sending" it to another function''. This is the key idea.<br />
}}</ref><ref>{{cite journal<br />
| doi = 10.1023/A:1010035624696<br />
| author1-link = Gerald Jay Sussman | first1 = Gerald Jay | last1 = Sussman | author2-link = Guy L. Steele, Jr. | first2 = Guy L., Jr. | last2 = Steele<br />
|date=December 1998<br />
| title = Scheme: A Interpreter for Extended Lambda Calculus<br />
| url = http://www.brics.dk/~hosc/local/HOSC-11-4-pp405-439.pdf<br />
| format = reprint<br />
| journal = Higher-Order and Symbolic Computation<br />
| volume = 11<br />
| issue = 4<br />
| pages = 405–439<br />
| quote = We believe that this was the first occurrence of the term "'''continuation-passing style'''" in the literature. It has turned out to be an important concept in source code analysis and transformation for compilers and other metaprogramming tools. It has also inspired a set of other "styles" of program expression.<br />
}}</ref><br />
[[John C. Reynolds]] gives a detailed account of the numerous discoveries of continuations.<ref>{{cite journal<br />
| author1-link = John C. Reynolds | first1 = John C. | last1 = Reynolds<br />
| title = The Discoveries of Continuations<br />
| journal = Lisp and Symbolic Computation<br />
| volume = 6<br />
| number = 3-4<br />
| year = 1993<br />
| pages = 233–248<br />
| doi=10.1007/bf01019459<br />
}}<br />
</ref><br />
<br />
A function written in continuation-passing style takes an extra argument: an explicit "continuation" i.e. a function of one argument. When the CPS function has computed its result value, it "returns" it by calling the continuation function with this value as the argument. That means that when invoking a CPS function, the calling function is required to supply a procedure to be invoked with the subroutine's "return" value. Expressing code in this form makes a number of things explicit which are implicit in direct style. These include: procedure returns, which become apparent as calls to a continuation; intermediate values, which are all given names; order of argument evaluation, which is made explicit; and [[tail call]]s, which simply call a procedure with the same continuation, unmodified, that was passed to the caller.<br />
<br />
Programs can be automatically transformed from direct style to CPS. Functional and [[logic programming|logic]] compilers often use CPS as an [[intermediate representation]] where a compiler for an [[imperative programming|imperative]] or [[procedural programming|procedural]] [[programming language]] would use [[static single assignment form]] (SSA){{ citation needed }}. SSA is formally equivalent to a subset of CPS (excluding non-local control flow, which does not occur when CPS is used as intermediate representation).<ref name="Kelsey1995">* {{cite journal | first = Richard A. | last = Kelsey | title=A Correspondence between Continuation Passing Style and Static Single Assignment Form | journal=ACM SIGPLAN Notices |date=March 1995 | volume=30 | issue=3 | pages=13–22 | doi=10.1145/202530.202532}}</ref> Functional compilers can also use [[A-normal form]] (ANF) (but only for languages requiring eager evaluation), rather than with '[[thunk (delayed computation) |thunks]]' (described in the examples below) in CPS. CPS is used more frequently by [[compiler]]s than by programmers as a local or global style.<br />
<br />
==Examples==<br />
In CPS, each procedure takes an extra argument representing what should be done with the result the function is calculating. This, along with a restrictive style prohibiting a variety of constructs usually available, is used to expose the semantics of programs, making them easier to analyze. This style also makes it easy to express unusual control structures, like catch/throw or other non-local transfers of control.<br />
<br />
The key to CPS is to remember that (a) ''every'' function takes an extra argument, its continuation, and (b) every argument in a function call must be either a variable or a [[Lambda (programming)|lambda expression]] (not a more complex expression). This has the effect of turning expressions "inside-out" because the innermost parts of the expression must be evaluated first, so CPS explicates the order of evaluation as well as the control flow. Some examples of code in direct style and the corresponding CPS appear below. These examples are written in the [[Scheme (programming language)|Scheme programming language]]; by convention the continuation function is represented as a parameter named "<code>k</code>":<br />
{|<br />
!<center>Direct style</center>!!<center>Continuation passing style</center><br />
|-valign="top"<br />
|<source lang=scheme><br />
(define (pyth x y)<br />
(sqrt (+ (* x x) (* y y))))</source><br />
||<br />
<source lang=scheme><br />
(define (pyth& x y k)<br />
(*& x x (lambda (x2)<br />
(*& y y (lambda (y2)<br />
(+& x2 y2 (lambda (x2py2)<br />
(sqrt& x2py2 k))))))))<br />
</source><br />
|-valign="top"<br />
|<br />
<source lang=scheme><br />
(define (factorial n)<br />
(if (= n 0)<br />
1 ; NOT tail-recursive<br />
(* n (factorial (- n 1)))))<br />
</source><br />
||<br />
<source lang=scheme><br />
<br />
(define (factorial& n k)<br />
(=& n 0 (lambda (b)<br />
(if b ; growing continuation<br />
(k 1) ; in the recursive call<br />
(-& n 1 (lambda (nm1)<br />
(factorial& nm1 (lambda (f)<br />
(*& n f k)))))))))<br />
</source><br />
|-valign="top"<br />
|<br />
<source lang=scheme><br />
(define (factorial n)<br />
(f-aux n 1))<br />
(define (f-aux n a)<br />
(if (= n 0)<br />
a ; tail-recursive<br />
(f-aux (- n 1) (* n a))))<br />
</source><br />
||<br />
<source lang=scheme><br />
(define (factorial& n k) (f-aux& n 1 k))<br />
(define (f-aux& n a k)<br />
(=& n 0 (lambda (b)<br />
(if b ; unmodified continuation<br />
(k a) ; in the recursive call<br />
(-& n 1 (lambda (nm1) <br />
(*& n a (lambda (nta)<br />
(f-aux& nm1 nta k)))))))))<br />
</source><br />
|}<br />
<br />
Note that in the CPS versions, the primitives used, like <code>+&</code> and <code>*&</code> are themselves CPS, not direct style, so to make the above examples work in a Scheme system we would need to write these CPS versions of primitives, with for instance <code>*&</code> defined by:<br />
<source lang=scheme><br />
(define (*& x y k)<br />
(k (* x y)))<br />
</source> To do this in general, we might write a conversion routine:<br />
<source lang=scheme><br />
(define (cps-prim f)<br />
(lambda args<br />
(let ((r (reverse args)))<br />
((car r) (apply f<br />
(reverse (cdr r)))))))<br />
(define *& (cps-prim *))<br />
(define +& (cps-prim +))</source><br />
<br />
In order to call a procedure written in CPS from a procedure written in direct style, it is necessary to provide a continuation that will receive the result computed by the CPS procedure. In the example above (assuming that CPS-style primitives have been provided), we might call <code>(factorial& 10 (lambda (x) (display x) (newline)))</code>.<br />
<br />
There is some variety between compilers in the way primitive functions are provided in CPS. Above we have used the simplest convention, however sometimes boolean primitives are provided that take two [[Thunk (delayed computation)|thunks]] to be called in the two possible cases, so the <code>(=& n 0 (lambda (b) (if b ...)))</code> call inside <code>f-aux&</code> definition above would be written instead as <code>(=& n 0 (lambda () (k a)) (lambda () (-& n 1 ...)))</code>. Similarly, sometimes the <code>if</code> primitive itself is not included in CPS, and instead a function <code>if&</code> is provided which takes three arguments: a boolean condition and the two thunks corresponding to the two arms of the conditional.<br />
<br />
The translations shown above show that CPS is a global transformation. The direct-style ''factorial'' takes, as might be expected, a single argument; the CPS ''factorial&'' takes two: the argument and a continuation. Any function calling a CPS-ed function must either provide a new continuation or pass its own; any calls from a CPS-ed function to a non-CPS function will use implicit continuations. Thus, to ensure the total absence of a function stack, the entire program must be in CPS.<br />
<br />
===Continuations as objects===<br />
{{See also|Callback (computer programming)}}<br />
<br />
Programming with continuations can also be useful when a caller does not want to wait until the callee completes. For example, in user-interface (UI) programming, a routine can set up dialog box fields and pass these, along with a continuation function, to the UI framework. This call returns right away, allowing the application code to continue while the user interacts with the dialog box. Once the user presses the "OK" button, the framework calls the continuation function with the updated fields. Although this style of coding uses continuations, it is not full CPS.<br />
<br />
<source lang=javascript><br />
function confirmName() {<br />
fields.name = name;<br />
framework.Show_dialog_box(fields, confirmNameContinuation);<br />
}<br />
<br />
function confirmNameContinuation(fields) {<br />
name = fields.name;<br />
}<br />
</source><br />
A similar idea can be used when the function must run in a different thread or on a different processor. The framework can execute the called function in a worker thread, then call the continuation function in the original thread with the worker's results. This is in [[Java (programming language)|Java]] using the [[Swing (Java)|Swing]] UI framework:<br />
<br />
<source lang=java><br />
void buttonHandler() {<br />
// This is executing in the Swing UI thread.<br />
// We can access UI widgets here to get query parameters.<br />
final int parameter = getField();<br />
<br />
new Thread(new Runnable() {<br />
public void run() {<br />
// This code runs in a separate thread.<br />
// We can do things like access a database or a <br />
// blocking resource like the network to get data.<br />
final int result = lookup(parameter);<br />
<br />
javax.swing.SwingUtilities.invokeLater(new Runnable() {<br />
public void run() {<br />
// This code runs in the UI thread and can use<br />
// the fetched data to fill in UI widgets.<br />
setField(result);<br />
}<br />
});<br />
}<br />
}).start();<br />
}<br />
</source><br />
<br />
Using Java 8 lambda notation above code shortens to (<code>final</code> keyword might be skipped):<br />
<source lang=java><br />
void buttonHandler() {<br />
int parameter = getField();<br />
<br />
new Thread(() -> {<br />
final int result = lookup(parameter);<br />
javax.swing.SwingUtilities.invokeLater(() -> setField(result));<br />
}).start();<br />
}<br />
</source><br />
<br />
==CPS and tail calls==<br />
Note that in CPS, there is no implicit continuation—every call is a [[tail call]]. There is no "magic" here, as the continuation is simply explicitly passed. Using CPS without [[tail call optimization]] (TCO) will cause not only the constructed continuation to potentially grow during recursion, but also the [[call stack]]. This is usually undesirable, but has been used in interesting ways - see the [[Chicken (Scheme implementation)|Chicken Scheme]] compiler. As CPS and TCO eliminate the concept of an implicit function return, their combined use can eliminate the need for a run-time stack. Several compilers and interpreters for [[functional programming language]]s use this ability in novel ways.<ref>Appel, Andrew W. (1992). Compiling with Continuations. Cambridge University Press. ISBN 0-521-41695-7.</ref><br />
<br />
==Use and implementation==<br />
Continuation passing style can be used to implement continuations and control flow operators in a functional language that does not feature first-class [[continuations]] but does have [[first-class function]]s and [[tail-call optimization]]. Without tail-call optimization, techniques such as [[trampoline (computers)|trampolining]], i.e. using a loop that iteratively invokes [[Thunk (functional programming)|thunk]]-returning functions, can be used; without first-class functions, it is even possible to convert tail calls into just gotos in such a loop.<br />
<br />
Writing code in CPS, while not impossible, is often error-prone. There are various translations, usually defined as one- or two-pass conversions of pure [[lambda calculus]], which convert direct style expressions into CPS expressions. Writing in trampolined style, however, is extremely difficult; when used, it is usually the target of some sort of transformation, such as [[compiler|compilation]].<br />
<br />
Functions using more than one continuation can be defined to capture various control flow paradigms, for example (in [[Scheme (programming language)|Scheme]]):<br />
<source lang=scheme><br />
(define (/& x y ok err)<br />
(=& y 0.0 (lambda (b)<br />
(if b<br />
(err (list "div by zero!" x y))<br />
(ok (/ x y))))))<br />
</source><br />
<br />
It is of note that CPS transform is conceptually a [[Yoneda embedding]].<ref>Mike Stay, [http://golem.ph.utexas.edu/category/2008/01/the_continuation_passing_trans.html "The Continuation Passing Transform and the Yoneda Embedding"]</ref> It is also similar to the embedding of [[π-calculus]] in [[lambda calculus]].<ref>Mike Stay, [http://golem.ph.utexas.edu/category/2009/09/the_pi_calculus_ii.html "The Pi Calculus II"]</ref><ref>{{cite paper | first = Gérard | last = Boudol | id = {{citeseerx|10.1.1.52.6034}} | title = The π-Calculus in Direct Style }}</ref><br />
<br />
==Use in other fields==<br />
Outside of [[computer science]], CPS is of more general interest as an alternative to the conventional method of composing simple expressions into complex expressions. For example, within linguistic [[semantics]], Chris Barker and his collaborators have suggested that specifying the denotations of sentences using CPS might explain certain phenomena in [[natural language]]. [http://www.semanticsarchive.net/Archive/902ad5f7/barker.continuations.pdf]<br />
<br />
In [[mathematics]], the [[Curry–Howard isomorphism]] between computer programs and mathematical proofs relates continuation-passing style translation to a variation of double-negation [[embedding]]s of [[classical logic]] into [[intuitionistic logic|intuitionistic (constructive) logic]]. Unlike the regular [[double-negation translation]], which maps atomic propositions ''p'' to ((''p'' → ⊥) → ⊥), the continuation passing style replaces ⊥ by the type of the final expression. Accordingly, the result is obtained by passing the [[identity function]] as a continuation to the CPS-style expression, as in the above example.<br />
<br />
Classical logic itself relates to manipulating the continuation of programs directly, as in Scheme's [[call-with-current-continuation]] control operator, an observation due to Tim Griffin (using the closely related C control operator).<ref>{{cite journal<br />
| first = Timothy | last = Griffin.<br />
|date=January 1990<br />
| title = A formulae-as-type notion of control<br />
| journal = Proceedings of the Conference on the Principles of Programming Languages<br />
| volume = 17<br />
| pages = 47–58<br />
| doi=10.1145/96709.96714<br />
}}</ref><br />
<br />
==See also==<br />
*[[Tail recursion#Through trampolining|Tail recursion through trampolining]]<br />
<br />
==References==<br />
*Continuation Passing C (CPC) - [http://www.pps.univ-paris-diderot.fr/~kerneis/software/ programming language for writing concurrent systems], designed and developed by Juliusz Chroboczek and Gabriel Kerneis. [https://github.com/kerneis/cpc github repository]<br />
*The construction of a CPS-based compiler for [[ML programming language|ML]] is described in: {{cite book | last = Appel | first = Andrew W. | title=Compiling with Continuations | publisher=Cambridge University Press | year=1992 | isbn=0-521-41695-7 | url = http://books.google.com/books?id=0Uoecu9ju4AC&dq | authorlink= Andrew Appel}}<br />
*{{cite journal | doi=10.1017/S0960129500001535 | author1-link = Olivier Danvy | first1 = Olivier | last1 = Danvy | author2-link = Andrzej Filinski | first2 = Andrzej | last2 = Filinski | title=Representing Control, A Study of the CPS Transformation | journal=Mathematical Structures in Computer Science | volume=2 | issue=4 | pages=361–391 | year=1992 | id = {{citeseerx|10.1.1.46.84}} }}<br />
*[[Chicken Scheme compiler]], a [[Scheme (programming language)|Scheme]] to [[C (programming language)|C]] compiler that uses continuation-passing style for translating Scheme procedures into C functions while using the C-stack as the nursery for the [[Garbage collection (computer science)#Generational GC (aka Ephemeral GC)|generational garbage collector]]<br />
*{{cite journal | first = Richard A. | last = Kelsey | title=A Correspondence between Continuation Passing Style and Static Single Assignment Form | journal=ACM SIGPLAN Notices |date=March 1995 | volume=30 | issue=3 | pages=13–22 | doi=10.1145/202530.202532 |id = {{citeseerx|10.1.1.3.6773}} }}<br />
*{{cite journal | first = Andrew W. | last = Appel | title=SSA is Functional Programming | journal=ACM SIGPLAN Notices |date=April 1998 | volume=33 | issue=4 | pages=17–20 | doi=10.1145/278283.278285 | url = http://www.cs.princeton.edu/~appel/papers/ssafun.ps | authorlink= Andrew Appel}}<br />
*{{Cite web | first = Olivier | last = Danvy | first2 = Kevin | last2 = Millikin | first3 = Lasse R. | last3 = Nielsen | title = On One-Pass CPS Transformations | year = 2007 | pages = 24 | location = BRICS, Department of Computer Science, University of Aarhus | url = http://www.brics.dk/RS/07/6/ | id = RS-07-6 | issn = 0909-0878 | postscript = <!--None--> | accessdate=26 October 2007}}<br />
*{{cite book | authorlink = R. Kent Dybvig | first = R. Kent | last = Dybvig | title=The Scheme Programming Language | publisher=Prentice Hall | year=2003 | page=64 | url=http://www.scheme.com/tspl3/}} Direct link: [http://scheme.com/tspl3/further.html#./further:h4 "Section 3.4. Continuation Passing Style"].<br />
<br />
==Notes==<br />
{{Reflist}}<br />
<br />
{{DEFAULTSORT:Continuation-Passing Style}}<br />
[[Category:Continuations]]<br />
[[Category:Functional programming]]<br />
[[Category:Implementation of functional programming languages]]<br />
[[Category:Articles with example Scheme code]]<br />
[[Category:Articles with example Java code]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Patty_Wong&diff=674421884Patty Wong2015-08-03T20:41:22Z<p>PuercoPop: Remove the ex from previous occupations</p>
<hr />
<div>{{Infobox person<br />
| name = Patty Wong<br />
| image = <!-- just the name, without the File: or Image: prefix or enclosing [[brackets]] --><br />
| image_size = <br />
| alt = <br />
| caption = <br />
| birth_name = <br />
| birth_date = {{Birth date and age|1980|10|29|mf=yes}}<br />
| birth_place = Lima, Peru<br />
| death_date = <!-- {{Death date and age|YYYY|MM|DD|YYYY|MM|DD}} (death date then birth date) --><br />
| death_place = <br />
| nationality = <br />
| ethnicity = <!-- Ethnicity should be supported with a citation from a reliable source --><br />
| citizenship = <br />
| education = <br />
| alma_mater = <br />
| occupation = [[Businesswoman]], [[Television presenter|TV presenter]], [[Model (profession)|model]]<br />
| religion = <!-- Religion should be supported with a citation from a reliable source --><br />
| denomination = <!-- Denomination should be supported with a citation from a reliable source --><br />
| criminal_charge = <!-- Criminality parameters should be supported with citations from reliable sources --><br />
| criminal_penalty = <br />
| criminal_status = <br />
| spouse = {{ubl|{{marriage|Paolo Arroyo|2009|2010|reason=divorced}}}}<br />
| partner = <!-- unmarried life partner; use ''Name (1950–present)'' --><br />
| children = Ariatna Guadalupe (b. 2005)<br />
| parents = <br />
| relatives = <br />
| awards = Miss Perú Tusán (2001)<br />
}}<br />
'''Patty Wong''' (born October 29, 1980 in [[Lima]], [[Peru]]) is a Peruvian model. She formerly co-hosted a popular youth-oriented Peruvian show called ''R con R''. She also won in "Miss Perú Tusan," a beauty contest for [[Chinese Peruvian|Peruvian-Chinese]] girls, like her. She also co-hosts a Peruvian television show in the singing talent contest format, called ''Camino a la fama''. She was also the host of the cancelled children's show Zoombate along with Cati Caballero as co-host, another famous Peruvian model that started her career in ''R con R''.<br />
<br />
==External links==<br />
*{{es icon}} [http://www.perumodelos.net/modelos/105/ Information and Photos]<br />
<br />
{{Persondata <!-- Metadata: see [[Wikipedia:Persondata]]. --><br />
| NAME = Wong-wong, Patty<br />
| ALTERNATIVE NAMES =<br />
| SHORT DESCRIPTION = Peruvian model<br />
| DATE OF BIRTH = October 29, 1980<br />
| PLACE OF BIRTH = Lima, Peru<br />
| DATE OF DEATH =<br />
| PLACE OF DEATH =<br />
}}<br />
{{DEFAULTSORT:Wong-wong, Patty}}<br />
[[Category:Peruvian people]]<br />
[[Category:People from Lima]]<br />
[[Category:Peruvian women in business]]<br />
[[Category:Peruvian people of Chinese descent]]<br />
[[Category:Peruvian television presenters]]<br />
[[Category:Peruvian female models]]<br />
[[Category:1980 births]]<br />
[[Category:Living people]]<br />
<br />
<br />
{{peru-bio-stub}}</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Moira_Kelly&diff=672393882Moira Kelly2015-07-21T07:56:20Z<p>PuercoPop: /* Filmography */ properly disambiguate little odessa to film entry</p>
<hr />
<div>{{About|the American actress|the Australian humanitarian|Moira Kelly (humanitarian)}}<br />
<br />
{{BLP sources|date=June 2012}}<br />
<br />
{{Infobox person<br />
| image = <!-- only free-content images are allowed for depicting living people. Non-free and "fair use" images, e.g. promo photos, CD/DVD covers, posters, screen captures, etc., will be deleted - see [[WP:NONFREE]] --> |<br />
| imagesize =<br />
| name = Moira Kelly<br />
| birth_date = {{birth date and age|mf=yes|1968|3|6}}<br />
| birth_name =<br />
| birth_place = [[Queens]], [[New York City|New York]], [[United States|U.S.]]<br />
| occupation = Actress<br />
| yearsactive = 1991–present<br />
| height = 5'4" (1.62 m)<ref>http://www.imdb.com/name/nm0446702/</ref><br />
| spouse = Steve Hewitt (2000–present; 2 children)<br />
| children = Ella (b. 2001)<br>Eamon (b. 2003)<br />
}}<br />
'''Moira Kelly''' (born March 6, 1968) is an American actress. She played Dorothy Day in ''[[Entertaining Angels: The Dorothy Day Story]]'', Kate Moseley in the 1992 film ''[[The Cutting Edge]]'', as well as single mother [[List of One Tree Hill characters#Karen Roe|Karen Roe]] on the [[teen drama]] ''[[One Tree Hill (TV series)|One Tree Hill]]'', White House media consultant [[Mandy Hampton]] in the first season of ''[[The West Wing]]'', and the voice of Simba's love interest Nala in ''[[The Lion King]]'' and its sequel ''[[The Lion King II: Simba's Pride]]''.<br />
<br />
==Early life==<br />
Kelly was born in [[Queens, New York]], the daughter of Irish immigrants. Her father, Peter, was trained as a concert violinist, and her mother, Anne, is a nurse. Kelly is the third of six children and was raised in [[Ronkonkoma, New York|Ronkonkoma]]. She was brought up as a Catholic.<ref>{{cite news|url=http://www.nytimes.com/1993/01/03/movies/up-coming-moira-kelly-playing-two-roles-chaplin-while-dreaming-joan-arc.html?pagewanted=1|title=Moira Kelly; Playing Two Roles in 'Chaplin' While Dreaming of Joan of Arc|publisher=[[The New York Times]]|work=|date=1993-01-03|quote = She is an ardent Roman Catholic...|accessdate=2010-05-20|first=Jeff|last=Giles}}</ref> Kelly attended [[Connetquot High School|Connetquot Senior High School]] in [[Bohemia, New York|Bohemia, Long Island]], graduating in the class of 1986. Later she attended [[Marymount Manhattan College]].<br />
<br />
In her youth, Kelly was cast in a small role in her high school's 1984 production of ''[[Annie (musical)|Annie]]''. Due to illness, the girl playing Miss Hannigan was replaced, causing a series of cast changes leading to her choice of career. A faithful Catholic, Kelly had to decide between acting and her childhood ambition of becoming a [[nun]].<ref name="Allmovie">{{Cite web<br />
| last = Buchanan<br />
| first = Jason<br />
| title = Moira Kelly > Biography<br />
| work = [[Allmovie]]<br />
| publisher = [[Rovi Corporation]]<br />
| url = http://www.allmovie.com/artist/moira-kelly-37546/bio<br />
| accessdate = 2010-01-08}}</ref><br />
<br />
==Career==<br />
Kelly made her professional acting debut in the made-for-TV movie ''[[Love, Lies and Murder]]'', playing a teenage murderer. She went on to have small roles in the films ''[[The Boy Who Cried Bitch]]'' and ''[[Billy Bathgate]]'' before being cast as [[Donna Hayward]] in ''[[Twin Peaks: Fire Walk with Me]]''. For that film, she went home and got permission from her priest because of an explicit sex scene.<ref name="Allmovie" /> In the same year, she starred opposite [[D. B. Sweeney]] in the romantic comedy ''[[The Cutting Edge]]'' and played two roles opposite [[Robert Downey, Jr.]] in ''[[Chaplin (film)|Chaplin]]''. According to a ''[[TV Guide (magazine)|TV Guide]]'' interview, before taking on her role in ''Daybreak'', Kelly once again asked her priest for advice: "Being a Catholic, I wondered if it would be against my religion to play a girl who has premarital sex." The priest told her "it was okay, as long as my artistic intentions were true and I wasn't doing it for the notoriety or the money."<ref>[http://www.catholic.com/thisrock/1993/9302drag.asp "A Message from Marrs".] ''This Rock''. February 1993.</ref><br />
<br />
She has since appeared in the movies ''[[With Honors (film)|With Honors]]'', ''[[Little Odessa]]'', ''The Tie That Binds'' and ''[[Dangerous Beauty]]'' amongst others, and provided the adult voice of [[List of The Lion King characters|Nala]] in [[Disney]]'s ''[[The Lion King]]'', ''[[The Lion King II: Simba's Pride]]'', and ''[[The Lion King 1½]]''. In her independent film career, Kelly had the starring role of activist [[Dorothy Day]] in ''[[Entertaining Angels: The Dorothy Day Story]]'' and starred alongside [[Glenn Close]] in ''[[The Safety of Objects]]''. She played [[Helen Keller]] in the made-for-TV movie ''Monday After the Miracle'', which broadcast on November 15, 1998, on [[CBS]].<br />
<br />
Kelly starred in the CBS drama ''[[To Have & to Hold (TV series)|To Have & to Hold]]'' opposite [[Jason Beghe]] before playing [[Mandy Hampton]] in the first season of ''[[The West Wing]]''. In 2003, Kelly began playing single mother [[Karen Roe]] on the [[teen drama]] ''[[One Tree Hill (TV series)|One Tree Hill]]''. She also directed two episodes of the series: "Resolve" (2007) and "I Slept with Someone in Fall Out Boy and All I Got Was This Stupid Song Written About Me" (2006).{{Citation needed|date=April 2011}} In the fifth season, she ceased to be a regular cast member, but made guest appearances in the 100th episode and the sixth season finale. She has made guest appearances in television shows such as ''[[Heroes (TV series)|Heroes]]'', ''[[Law & Order]]'', and ''[[Numbers (TV series)|Numb3rs]]''. Kelly has also appeared in the films ''[[Remember the Daze]]'', ''[[A Smile as Big as the Moon]]'' and ''Taken Back: Finding Haley''.<br />
<br />
==Personal life==<br />
In 2000, Moira Kelly married Steve Hewitt, a Texas businessman. They have two children, Ella and Eamon.<ref>http://www.tvguide.com/celebrities/moira-kelly/bio/167050</ref><br />
<br />
==Filmography==<br />
{|class="wikitable" style="font-size: 95%;" border="2" cellpadding="4" background: #f9f9f9;<br />
|- align="center"<br />
! style="background:#B0C4DE;" | Year<br />
! style="background:#B0C4DE;" | Title<br />
! style="background:#B0C4DE;" | Role<br />
! style="background:#B0C4DE;" | Notes<br />
|-<br />
| rowspan = "3" | 1991 || ''[[The Boy Who Cried Bitch]]'' || Jessica ||<br />
|-<br />
| ''[[Love, Lies and Murder]]'' || Cinnamon || TV movie<br />
|-<br />
| ''[[Billy Bathgate (film)|Billy Bathgate]]'' || Rebecca ||<br />
|-<br />
| rowspan = "3" | 1992 ||''[[Twin Peaks: Fire Walk with Me]]'' || [[Donna Hayward]] ||<br />
|-<br />
| ''[[The Cutting Edge]]'' || Kate Moseley ||<br />
|-<br />
| ''[[Chaplin (film)|Chaplin]]'' || Hetty Kelly / [[Oona O'Neill]] ||<br />
|-<br />
| 1993 || ''[[Daybreak (1993 film)|Daybreak]]'' || Blue || TV Movie<br />
|-<br />
| rowspan="2" | 1994 || ''[[The Lion King]]'' || Adult [[Nala (The Lion King)|Nala]] || Voice Only<br />
|-<br />
| ''[[With Honors (film)|With Honors]]'' || Courtney Blumenthal ||<br />
|-<br />
| 1995 || ''[[Little Odessa (film)|Little Odessa]]'' || Alla Shustervich ||<br />
|-<br />
| rowspan="2" | 1996 || ''[[Unhook the Stars]]'' || Ann Mary Margaret ||<br />
|-<br />
| ''[[Entertaining Angels: The Dorothy Day Story]]'' || [[Dorothy Day]] ||<br />
|-<br />
| 1997 || ''[[Drive, She Said]]'' || Nadine Ship ||<br />
|-<br />
| rowspan=4 | 1998 || ''[[To Have & to Hold (TV series)|To Have & to Hold]]'' || Annie Cornell || TV Series: 13 Episodes<br />
|-<br />
| ''[[Love Walked In (1997 film)|Love Walked In]]'' || Vera ||<br />
|-<br />
| ''[[The Lion King II: Simba's Pride]]'' || Nala || Voice Only<br />
|-<br />
| ''[[Dangerous Beauty]]'' || Beatrice ||<br />
|-<br />
|1999–2000 || ''[[The West Wing]]'' || [[Mandy Hampton]] || TV Series: 22 Episodes<br />
|-<br />
| 1999 || ''[[Henry Hill (film)|Henry Hill]]'' || Cynthia ||<br />
|-<br />
| rowspan=2| 2002 || ''[[The Twilight Zone (2002 TV series)|The Twilight Zone]]'' || Elizabeth Carter / Bess Wicker || TV Series: Episode: "[[Found and Lost]]"<br />
|-<br />
| ''[[Hack (TV series)|Hack]]'' || Vanessa Griffin || TV Series: 1 Episode<br />
|-<br />
| 2003 || ''[[The Safety of Objects]]'' || Susan Train ||<br />
|-<br />
| 2003–2009 || ''[[One Tree Hill (TV series)|One Tree Hill]]'' || [[Karen Roe]] || TV Series: 90 Episodes<br />
|-<br />
| 2004 || ''[[The Lion King 1½]]'' || Adult Nala || Voice Only<br />
|-<br />
| 2006 || ''[[Two Tickets to Paradise (film)|Two Tickets to Paradise]]'' || Kate ||<br />
|-<br />
| 2007 || ''[[Remember The Daze]]'' || Mrs. Ford || Alternative Title: ''The Beautiful Ordinary''<br />
|-<br />
| 2008 || ''[[Law & Order]]'' || Catherine Donovan || TV Series: 1 Episode<br />
|-<br />
| 2009 || ''[[Heroes (TV series)|Heroes]]'' || Abby Collins || TV Series: 1 Episode<br />
|-<br />
| 2010 || ''[[Numbers (TV series)|Numb3rs]]'' || Mary Paulson || TV Series: 1 Episode<br />
|-<br />
| rowspan="2" | 2012 || ''[[A Smile as Big as the Moon]]'' || Darcy Kersjes || TV Movie<br />
|-<br />
| ''[[Taken Back: Finding Haley]]'' || Karen || TV Movie<br />
|-<br />
| 2013 || ''[[Drop Dead Diva]]'' || Cindy Kasper || TV Series: 1 Episode<br />
|}<br />
<br />
==References==<br />
{{Reflist}}<br />
<br />
== External links ==<br />
* {{IMDb name|446702|Moira Kelly}}<br />
* [http://www.ultimatedisney.com/moirakelly-interview.html "The Lion Queen": An Interview with Moira Kelly by Aaron Wallace at UltimateDisney.com]<br />
<br />
{{ScreenActorsGuildAwards EnsembleTVDrama 2000–2009}}<br />
<br />
{{Authority control}}<br />
<br />
{{Persondata<br />
|NAME= Kelly, Moira<br />
|ALTERNATIVE NAMES=<br />
|SHORT DESCRIPTION= [[Actor]]<br />
|DATE OF BIRTH= 1968-3-6<br />
|PLACE OF BIRTH= [[Queens]], [[New York]], [[United States|U.S.]]<br />
|DATE OF DEATH=<br />
|PLACE OF DEATH=<br />
}}<br />
{{DEFAULTSORT:Kelly, Moira}}<br />
[[Category:1968 births]]<br />
[[Category:American film actresses]]<br />
[[Category:American people of Irish descent]]<br />
[[Category:American Roman Catholics]]<br />
[[Category:American television actresses]]<br />
[[Category:American voice actresses]]<br />
[[Category:Living people]]<br />
[[Category:Marymount Manhattan College alumni]]<br />
[[Category:Actresses from New York City]]<br />
[[Category:20th-century American actresses]]<br />
[[Category:21st-century American actresses]]<br />
[[Category:People from Queens, New York]]<br />
[[Category:People from Ronkonkoma, New York]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Talk:Zo%C3%AB_Lund&diff=672344917Talk:Zoë Lund2015-07-20T23:12:46Z<p>PuercoPop: Remove vandalism</p>
<hr />
<div>{{WPBiography<br />
|living=no<br />
|class=stub<br />
|musician-work-group=yes|musician-priority=low<br />
|filmbio-work-group=yes|filmbio-priority=low<br />
|listas=Tamerlis Lund, Zoe<br />
}}<br />
{{WikiProject Fashion<br />
|listas = Tamerlis Lund, Zoe<br />
|class = stub<br />
|importance = low<br />
}}<br />
{{WikiProject Women writers|importance=|class=stub|auto=stub}}<br />
<br />
==Fair use rationale for Image:Zoe Lund as Thana in Ms. 45.jpg==<br />
[[Image:Nuvola apps important.svg|70px|left]]<br />
'''[[:Image:Zoe Lund as Thana in Ms. 45.jpg]]''' is being used on this article. I notice the image page specifies that the image is being used under [[Wikipedia:Fair use|fair use]] but there is no [[Wikipedia:Fair use rationale guideline|explanation or rationale]] as to why its use in '''this''' Wikipedia article constitutes fair use. In addition to the [[Wikipedia:Image copyright tags/Fair use|boilerplate fair use template]], you must also write out on the image description page a specific explanation or rationale for why using this image in each article is consistent with [[WP:FU|fair use]].<br />
<br />
Please go to [[:Image:Zoe Lund as Thana in Ms. 45.jpg|the image description page]] and edit it to include a [[Wikipedia:Fair use rationale guideline |fair use rationale]]. Using one of the templates at [[Wikipedia:Fair use rationale guideline]] is an easy way to insure that your image is in compliance with Wikipedia policy, but remember that you must complete the template. Do not simply insert a blank template on an image page.<br />
<br />
If there is other fair use media, consider checking that you have specified the fair use rationale on the other images used on this page. Note that any fair use images lacking such an explanation can be deleted one week after being tagged, as described on [[Wikipedia:Criteria for speedy deletion#Images.2FMedia|criteria for speedy deletion]]. If you have any questions please ask them at the [[Wikipedia:Media copyright questions|Media copyright questions page]]. Thank you.<!-- Template:Missing rationale2 --><br />
<br />
[[User:BetacommandBot|BetacommandBot]] ([[User talk:BetacommandBot|talk]]) 03:19, 12 February 2008 (UTC)</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Arequipa&diff=668502229Arequipa2015-06-24T18:29:32Z<p>PuercoPop: /* Demographics */</p>
<hr />
<div>{{about|the city of Arequipa}}<br />
{{cleanup|reason=horrifically bad direct translations|date=September 2014}}<br />
{{Infobox settlement<br />
|official_name = Arequipa<br />
|other_name =<br />
|native_name =<br />
|nickname = ''La Ciudad Blanca'' (The White City)<br />
|image_skyline =<br />
|imagesize = 250px<br />
|image_caption =<br />
|image_flag = Bandera_de_Arequipa.svg<br />
|flag_size =<br />
|image_shield = Escudo de Armas de Arequipa.svg<br />
|shield_size = 100px<br />
|image_blank_emblem =<br />
|blank_emblem_size =<br />
|image_map =<br />
|mapsize = <br />
|pushpin_map_caption = Location in Peru<br />
|pushpin_map = Peru<br />
|pushpin_label_position =<br />
|coordinates_region = PE<br />
|subdivision_type = Country<br />
|subdivision_name = [[Peru]]<br />
|subdivision_type1 = [[Regions of Peru|Region]]<br />
|subdivision_name1 = [[Arequipa Region|Arequipa]]<br />
|subdivision_type2 = [[Provinces of Peru|Province]]<br />
|subdivision_name2 = [[Arequipa Province|Arequipa]]<br />
|subdivision_type3 =<br />
|subdivision_name3 =<br />
|subdivision_type4 =<br />
|subdivision_name4 =<br />
|government_type =<br />
|leader_title = Mayor<br />
|leader_name = Alfredo Zegarra Tejada<br />
|leader_title1 = <!-- for places with, say, both a mayor and a city manager --><br />
|leader_name1 =<br />
|leader_title2 =<br />
|leader_name2 =<br />
|leader_title3 =<br />
|leader_name3 =<br />
|leader_title4 =<br />
|leader_name4 =<br />
|established_title = Established<br />
|established_date = August 15, 1540<br />
|founder = [[Garcí Manuel de Carbajal]]<br />
|established_title2 = <!-- Incorporated (town) --><br />
|established_date2 =<br />
|established_title3 = <!-- Incorporated (city) --><br />
|established_date3 =<br />
|area_magnitude =<br />
|unit_pref = <!--Enter: Imperial, if Imperial (metric) is desired--><br />
|area_footnotes =<br />
|area_total_km2 = 69<br />
|area_land_km2 =<br />
|area_water_km2 =<br />
|area_total_sq_mi =<br />
|area_land_sq_mi =<br />
|area_water_sq_mi =<br />
|area_water_percent =<br />
|area_urban_km2 =<br />
|area_urban_sq_mi =<br />
|area_metro_km2 = 2923.53<br />
|area_metro_sq_mi =<br />
|pop_est_as_of =2015<br />
|pop_est_footnotes =<ref name="proyeccion2015INEI">{{cite report |url=http://proyectos.inei.gob.pe/web/biblioineipub/bancopub/Est/Lib1020/cuadros/c0206.xls |title=Perú: Población estimada al 30 de junio y tasa de crecimiento de las ciudades capitales, por departamento, 2011 y 2015 |work=Perú: Estimaciones y proyecciones de población total por sexo de las principales ciudades, 2012-2015 |publisher=Instituto Nacional de Estadística e Informática |date=March 2012 |access-date=2015-06-03}}</ref><br />
|population_est =869351<br />
|population_as_of = <br />
|population_footnotes =<br />
|population_note =<br />
|settlement_type = <!--For Town or Village of the Dead (Leave blank for the default City)--><br />
|population_total =<br />
|population_density_km2 = auto<br />
|population_density_sq_mi =<br />
|population_metro = [[List of metropolitan areas of Peru|920.047]]<br />
|population_density_metro_km2 = <br />
|population_density_metro_sq_mi =<br />
|population_urban =<br />
|population_density_urban_km2 =<br />
|population_density_urban_mi2 =<br />
|population_demonym = Arequipeño<br />
|timezone = PET<br />
|utc_offset = -5<br />
|timezone_DST = PET<br />
|utc_offset_DST = −5<br />
|latd= 16|latm= 23 |latNS=S<br />
|longd= 71|longm= 32 |longEW=W<br />
|coordinates_display=d<br />
|elevation_footnotes = <!--for references: use<ref> </ref> tags--><br />
|elevation_m = 2335<br />
|elevation_ft = <br />
|postal_code_type = Postal code<br />
|postal_code = 04000<br />
|area_code = 54<br />
|website = [http://www.muniarequipa.gob.pe www.munarequipa.gob.pe]<br />
|footnotes =<br />
}}<br />
<br />
'''Arequipa''' is the capital and largest city of the [[Arequipa Region]] and the seat of the [[Constitutional Court of Peru]]. It is the [[List of metropolitan areas of Peru|third most populous metropolitan area]] of Peru and according to the [[INEI|National Institute of Statistics and Informatics]] is the [[List of cities in Peru|second most populous city]] with 861,145 inhabitants.<ref name=autogenerated1>{{cite web |url=http://www.inei.gob.pe/web/NotaPrensa/Attach/14584.pdf |format=pdf |title=Población oficial 2012 |language=Spanish |deadurl=no |accessdate=13 December 2012}}</ref><br />
<br />
Arequipa is the second most industrialized<ref name="export17p">Mincetur. "Export Investment Guide", p. 17</ref> and commercial city of Peru.<ref name="chanfreau40p">Chanfreau, p. 40</ref> Its industrial activity includes manufactured goods and camelid wool products for export. The city has close trade ties with [[Chile]], [[Bolivia]] and [[Brazil]].<br />
<br />
The city was founded on August 15, 1540 by [[Garcí Manuel de Carbajal]] as 'Villa Hermosa de Nuestra Señora de la Asunción". By Royal Decree of September 22, 1541, King [[Charles V, Holy Roman Emperor|Charles V]] of Spain granted Arequipa the title of 'City'. During the Colonial period, Arequipa became highly important for its economic prosperity <ref name="chanfreau40p"/> and for its loyalty to the [[Monarchy of Spain|Spanish Crown]].<ref name="linares115p">Linares Málaga, p. 115.</ref><br />
<br />
After Peru gained its independence from Spain, the city acquired greater prominence in politics,<ref name="ponce53p">{{harv| Ponce|1960|p=53|sp=sí}}</ref> being the center of uprisings. Many Peruvian intellectual, political, and religious figures became prominent in this era. Moreover, it was declared the capital city of Peru in 1835 and 1883.<br />
<br />
The historic center of Arequipa spans an area of 332 hectares<ref name="compendio80p">Provincial Municipality of Arequipa. "Compendium of rules of the historic center of Arequipa", p. 80.</ref> and is a [[UNESCO]] World Heritage Site.<ref name="unesco">{{cite web |url=http://whc.unesco.org/en/list/1016 |title=Historical Centre of the City of Arequipa |accessdate=4 August 2009 |author=UNESCO |date=30 November 2000}}</ref> Its historic heritage, natural scenery and cultural sites, make the city a national and international tourist destination. Its religious, colonial, and republican architectural styles blend European and native characteristics<ref name="Compendio">{{cite journal |author=Oficina Técnica del Centro Histórico y Zona Monumental de Arequipa (MPA – OTCHA) |title=Compendio Normativo Final del Centro Histórico de Arequipa |year=2002 |number=1 |id=p. 2 |url=http://www.mincetur.gob.pe/apec1/pdf/Mincetur_Arequipa22.pdf}}</ref> into a unique style called "Escuela Arequipeña".<ref name="benavides73p">{{harv|Benavides|p=73|1990|sp=sí}}</ref><br />
<br />
== Etymology ==<br />
[[File:Basílica Catedral de Arequipa.jpg|thumb|right|View of the main square of the city of Arequipa at night, located in the historic centre of Arequipa. The Cathedral of Arequipa is seen at the right.]]<br />
The name of the city is a Spanish language transliteration of the name of the valley in which the city was founded. Based on traditions, there are various tales that attempt to explain the origins of the name.<br />
<br />
A local tradition states that the [[Inca]] [[Mayta Cápac|Mayta Capac]] received a petition from his subjects to reach the valley of the River Chili. They asked him for permission to stay in the region as they were impressed by the beauty of the landscape and the mild climate. The Inca answered ''"Ari qhipay"'' (Quechua: ''"Yes, stay")''.<ref name="garayar51p">{{harv|Garayar|p=51|2004|sp=sí}}</ref><br />
<br />
Another similar tale says that when the Europeans first arrived there, they pointed at the ground and asked for the name of the land. the local chief, not understanding the question, assumed they were asking for a permission to sit down and gave a positive answer, which sounded like "Arequipa".<ref>[[Lev Uspensky]], ''«Имя дома твоего»''</ref><br />
<br />
Chroniclers [[Blas Valera]] and [[Inca Garcilaso de la Vega]] suggested that the name of the city came from an ancient [[Aymara language|Aymara]] phrase, "ari qquepan", supposedly meaning "trumpet sound", in reference to the sound produced from blowing into an empty conch-like seashell.<ref name="palma30p">{{harv|Palma|1893|p=29|sp=sí}}</ref><br />
<br />
Another possible origin of the city's name comes from the [[Aymara language|Aymara]] language phrase "qhipaya ari" or "Ari qipa" (from 'ari': acute, sharp or pointed; and 'qhipaya': behind), which translates to "behind the peak," referring to the nearby volcano, [[El Misti|Misti.]]<ref name="Etimologia">[http://www.saludarequipa.gob.pe/epidemiologia/ASIS/Asis2004/ASIS%20PRIMERA%20PARTE%202004.pdf Toponymy "Arequipa"]</ref><br />
<br />
== History ==<br />
{{Cleanup|reason = Poor English in this section, possibly translated from another version of Wikipedia|date = January 2014}}<br />
{{Simple Horizontal timeline<br />
|from=-500<br />
|to=2000<br />
|inc=500<br />
|row1=note<br />
|row1-10-at=-300<br />
|row1-10-text='''1st Agriculture?'''<br />
|row1-20-at=500<br />
|row1-20-text='''Tiwanaku'''<br />
|row1-40-at=1000<br />
|row1-40-text='''Churajon'''<br />
|row1-60-at=500<br />
|row1-60-text='''Tiwanaku'''<br />
|row1-80-at=1350<br />
|row1-80-text='''Inca'''<br />
|row1-100-at=1540<br />
|row1-100-text='''Spain'''<br />
|axis-negativeFmt=%s BC<br />
|axis-positiveFmt=%s AD<br />
|axis-zeroFmt= %s AD<br />
|axis-nudge=-0.8em<br />
|row2=scale<br />
}}<br />
<br />
=== Pre-Inca period ===<br />
<br />
Centuries before the rise of the Inca Empire the area was inhabited by nomadic people who relied on activities such as [[hunting]], [[fishing]] and [[Hunter–gatherer|gathering]] for survival; pre-Inca cultures [[Domestication|domesticated]] llamas and became [[Sedentism|sedentary]] with the generation of [[agriculture]]. Eventually, after the start of migration process within the region, early settlements were established, many close to the sea, and as such giving rise to the first communication channels and thereby increasing the accessibility of the territory.<ref name="galdos13p2">{{harv|Galdós Rodríguez|1997|p = 13|sp = sí}}<br />
</ref><br />
<br />
During this time, major irrigation channels were built within the valley of the Chili river, which allowed the development of agriculture by means of terraces built on both sides of the river. The Yarabaya and Chimbe tribes settled in the city's current location, and together with the Cabana and Collagua tribes they developed an agrarian economy in the desert valley.<ref name="galdos13p2" /><br />
<br />
=== Inca period ===<br />
<br />
When the [[Sapa Inca|Inca]] [[Huayna Capac]] arrived in the valley of the Chili river, he didn't build cities. Instead, he ordered his [[mitma|mitimae]] (settlers from lands within the Inca empire) to settle in the valley to gain control of the existing population, perform intelligence tasks and strengthen border enclaves as a way to control the unconquered villages.<ref name="galdos14p2">{{harv|Galdós Rodríguez|1997|p = 14|sp = sí}}<br />
</ref><br />
<br />
The mitimae system of settlements in the Inca Empire was not related to the act of founding of a town. The Inca, when conquering a new land, didn't order the founding of new cities; instead, they replaced most of the native population with settlers loyal to the Inca, while moving that native population to other places within the Inca Empire.<ref name="galdos14p2" /> A Hispanic version of the events, detailed by chronicler [[Garcilaso de la Vega (chronicler)|Garcilaso de la Vega]], who has been described as historically inaccurate,<ref name="galdos15p2">{{harv|Galdós Rodríguez|1997|p = 15|sp = sí}}<br />
</ref> suggests that around 1170 Huayna Capac stopped with his army in the valley of the Chili River, which he called ''Ari qepay'' - an expression meaning "let's stay here". Lands were then distributed among three thousand families who founded the towns of Yanahuara, Cayma, Tiabaya, Socabaya, Characato and others, which still exist nowadays.<ref name="garayar50p2">{{harv|Garayar|2004|p = 50|sp = sí}}<br />
</ref><br />
<br />
=== Colonial Arequipa ===<br />
Arequipa was founded on 15 August 1540 by [[Garcí Manuel de Carbajal|Garci Manuel de Carbajal]]<nowiki> </nowiki>in the valley of the Chili river as "Villa de la Asunción de Nuestra Señora del Valle Hermoso de Arequipa" in an area occupied by some [[Native American (Americas)|Native American]] villages.<ref name="«arellano257p»2">{{harv|Arellano|1988|sp = sí|p = 257}}<br />
</ref><nowiki> </nowiki>When the city was founded, the first blocks around the main square were given to the Pizarro Family, the [[Cabildo (council)|Cabildo]] (or City Hall) and the [[Dominican Order]].<br />
<br />
At the time of its foundation, Arequipa had already a city council, because the foundation of the town occurred in part as a relocation of Villa Hermosa de Camana, a coastal city. The name was partially conserved as Villa Hermosa de Arequipa.<ref name="neira244p2">{{harv|Neira|1990|p = 244|sp = sí}}<br />
</ref> [[Charles V, Holy Roman Emperor|Charles V]] of Germany and I of Spain gave the town a status of 'city' by Royal Decree on 22 September 1541.<ref name="cornejob35p2">{{harv|Cornejo Bouroncle|1952||p = 16|sp = sí}}<br />
</ref> The relocation efforts were led by [[Garcí Manuel de Carbajal|Garci Manuel de Carbajal]], who was selected as the political authority for the foundation of the<nowiki> </nowiki>new town.<ref name="neira246p2">{{harv|Neira|1990|p = 246|sp = sí}}<br />
</ref><br />
<br />
Among the first public works carried out in the city are the Main<nowiki> </nowiki>Church, the City Hall, the bridge on the Chili River and the monastery of Nuestra Señora de Gracia.<ref name="neira256p2">{{harv|Neira|1990|p = 256|sp = sí}}<br />
</ref><br />
<br />
=== Arequipa during the Independence from Spain ===<br />
Although revolutionary movements like the one commanded by [[Mateo Pumacahua|Pumacahua]] and pro independence troops entered Arequipa, the city remained under Spaniard control<nowiki> </nowiki>until the Battle of Ayacucho due to internal struggles for local political power.<ref name="gadea1p2">{{cite web |publisher = Universidad Católica de Santa María|title = ¿Por qué el Perú es independiente?|url = http://www.ucsm.edu.pe/arequipa/peru6.htm|accessdate = 8 November 2012|work = Arequipa al día|date = 23 August 2006|language = Spanish|last = Gadea Aburto|first = Saúl|editor = Arequipa al día}}<br />
</ref><br />
<br />
Colonial authorities were flexible concerning liberal thinking and higher education in Arequipa. An example of this is the foundation of the Academia Lauretana de Ciencias y Artes (Lauretan Academy of Sciences and Arts) on 10 December 1821, which was also home to the first printing office in the region. The main members of the academy: [[Francisco Xavier de Luna Pizarro]], Aparicio Gómez Sánchez, Francisco de Paula Gonzalez Vigil, Gualberto Valdivia, Manuel Amat y Leon and Juan de Dios Salazar took sides in favor of the independence from Spain. The result of the activity of the Lauretan Academy was the foundation of the National College of American Independence and the National University of San Agustin created in 1827.<br />
<br />
==== Fidelismo ====<br />
One aspect that distinguished Arequipa from the rest of the country was the particularly explicit and public commitment of the city to the Spanish Crown, a phenomenon called ''fidelismo.'' Among its most remarkable defenders were Francisco de Paula Quiroz, Mariano de Rivero, Nicolás Fernández, and José Miguel de Lastarria.<ref name="garayar54p2">{{harv|Garayar|2004|p = 54|sp = sí}}<br />
</ref> It was this attitude of its citizens the reason why the city received the title of ''Faithful'' by Royal Charter in 1805.<ref name="caceres127p2">{{harv|Cáceres-Péfaur|2006|p = 127|sp = sí}}<br />
</ref><br />
<br />
Since its Spanish founding and over three centuries, the population of the city was mostly of Spanish origin, which represented a faithful following of [[Spain]].<ref name="caceres128p2">{{harv|Cáceres-Péfaur|2006|sp = sí|p = 128}}<br />
</ref> Another factor was geography, because of its location Arequipa was not heavily influenced by libertarian movements, and also kept the city distant to other cities with big Aboriginal population.<ref name="caceres128p2" /><br />
<br />
=== Republican period ===<br />
[[File:BCP Building Arequipa.jpg|thumb|right|Main Office with eclectic architecture of Banco de Credito del Peru (BCP)]]<br />
After independence, the territory corresponding to the "Intendencia de Arequipa" was given the status of 'Departamento' or [[Arequipa Region|Region of Arequipa]] by decree of 26 May 1822. The Peruvian Congress of 1826 and the Constitutional Assembly of 1827 were led by Arequipa native Francisco Xavier de Luna Pizarro. During the government of [[Simón Bolívar|Bolivar]], right after the victory of the Battle of [[Battle of Ayacucho|Ayacucho]], Arequipa was a political center against the dictatorial powers of Bolivar.<br />
<br />
Arequipa did not have an important official status during the colonial period although it did play an important economic role. During colonial times its location was at the crossroads of the trade route of silver and after independence, the wool trade route. This privileged location allowed Arequipa to accumulate administrative, commercial and industrial power which benefited local social classes committed to the future of the city.<ref name="chanfreau40p" /> Thus, Arequipa not only was the birthplace of significant political figures in Peru,<ref name="cotler97p">{{harv|Cotler|2009|p=97|sp=sí}}</ref> but also the scene of several important political movements that achieved national prominence.<ref name="cotler93p">{{harv|Cotler|2009|p =93|sp=sí}}</ref><br />
<br />
From the 1820s until the end of the decade, Peruvian society was in a transitional period right after its independence from Spain.<ref name="ponce51p">{{harv| Ponce|1960|p=51|sp=sí}}</ref> Also during this time, the pillars that supported the economy of Arequipa – manufacture of wool products and the operation of the Southern Railway – began to decline. For these and other reasons, Arequipa saw the rise of a number of political leaders shaped by a growing middle class of professionals, intellectuals and technocrats, who played a role in the defense of the legal and economic stability of the city.<ref name="bethell402p">{{harv|Bethell|1991|p=402|sp=sí}}</ref> It was during this period that the population of the city increased significantly and its citizens had a prominent political participation thus establishing the importance of Arequipa as the country's second city, and in frequent rivalry with Lima.<ref name="ponce53p" /><br />
<br />
In 1835, [[Luis José de Orbegoso|General Orbegoso]] moved his government from Lima to Arequipa, by presidential decree on 13 January 1835.<ref name="neira438p2">{{harv|Neira|1990|p = 438|sp = sí}}<br />
</ref> Meanwhile, in Lima, General [[Felipe Santiago Salaverry]]<nowiki> </nowiki>named himself Supreme Chief of the Republic, arguing that the country was leaderless, i.e. without President, as Orbegoso was outside the capital.<ref name="congreso.gob.pe2">[[transport|Decree assuming command of the Republic General Felipe Santiago Salaverry, February 25, 1835]] .<br />
</ref> Orbegoso then sought support from then Bolivian President [[Andrés de Santa Cruz]] against the claims of [[Felipe Santiago Salaverry|Salaverry.]]<nowiki> </nowiki>Deciding battles between troops and Salaverry Confederation were in Uchumayo, near the city of Arequipa, on 4 February 1836, where he defeated Salaverry, and Socabaya, three days later, on 7 February, beating [[Andrés de Santa Cruz|Santa Cruz.]]<ref name="garayar56p2">{{harv|Garayar|2004|p = 56|sp = sí}}<br />
</ref> On 18 February 1836, Salaverry and his top aides were shot in the main square of the city.<ref name="rivap2">{{harv |de la Riva Agüero|1858|sp = sí|p = }}<br />
</ref><br />
<br />
After expressing their rejection of the [[Peru–Bolivian Confederation|Confederation]], Chile sent under General [[Ventura Blanco Encalada]] a military expedition that reached the territory arequipeño 12 October 1837.<ref name="pardo34p2">{{harv|Pardo y Aliaga|2007|p = 34|sp = sí}}<br />
</ref><br />
<nowiki> </nowiki>Before going into battle were negotiations that allowed signing a peace<br />
<nowiki> </nowiki>treaty in Paucarpata, adjacent to the city district, on 17 November, <br />
between the Chilean military chief Gen. Quiroz, of the Confederation. <br />
Chile did not endorse the treaty and sent a second expedition under [[Manuel Bulnes Pinto|General Bulnes]], the following year, in support of [[Ramón Castilla]] and other Peruvian military leaders opposed to Santa Cruz.<ref name="pinguioXp2">{{harv|Monguió|1968|sp = sí|p = }}</ref><br />
<br />
In the following years the city hosted insurrectionary successive military coups. On 20 February 1843, there was proclaimed as the supreme head of the Republic General [[Manuel Ignacio de Vivanco]], whose ambitions ended with the Battle of Carmen Alto on 22 July 1844.<br />
<br />
On 14 April 1854 from Arequipa insirió as interim president General [[Ramón Castilla|Ramon Castilla]], who managed to take power. Against this de facto government, on 1 November 1856 took up arms again in Arequipa, [[Manuel Ignacio de Vivanco|General Vivanco.]] After failing his military expeditions to [[Lima]] and [[Trujillo, Peru|Trujillo]], had to return to Arequipa in late 1857 to organize its defense. The forces commanded by [[Miguel de San Román]] Vivanco faced in the battle of Paucarpata on 29 June 1857.<ref name="garayar57p2">{{harv|Garayar|2004|p = 57|sp = sí}}</ref><br />
<br />
==== War with Chile ====<br />
{{main|War of the Pacific}}<br />
Lizardo Montero arrived in Arequipa on 31 August 1882, declaring the <br />
capital of Peru. Also, Montero convened a National Congress on 28 April <br />
1883.<ref name="neira532p2">{{harv|Neira|1990|p = 532|sp = sí}}<br />
</ref><br />
<br />
{{blockquote|«De la noche a la mañana Arequipa se convirtió en la "Capital del Perú": con presidente y escolta en "palacio", con ministros y secretarios en sus despachos, con el alto mando militar en sus cuarteles. Un viejo y reitarado sueño se transformaba en realidad aunque con visos de sainete y de tragedia: el gobierno no ejercía el poder en todo el territorio nacional que en sus zonas neurálgicas estaba militarmente ocupado por el enemigo...»|Niera, Máximo, ''«Historia General de Arequipa»''<ref name=neira532p>{{harv|Neira|p=532|1990|sp=sí}}</ref>}}<br />
<br />
Montero's government had a "National Congress" installed on 22 April <br />
1883 in the cloisters of the College Independence and National <br />
University of San Agustin, a military support consists of all males 20 <br />
to 60 years<ref name="mcevoy222p2">{{harv|Mc Evoy|1997|p = 222|sp = sí}}<br />
</ref> that formed an army of 4,000 men and 8,000 National Guardsmen to 10 000<ref name="bulnes285p2">{{harv|Bulnes|1996|p = 285|sp = sí}}<br />
</ref><br />
<nowiki> </nowiki>and an important financial support based on quotas and taxes erogacione<br />
<nowiki> </nowiki>both the economic elite and the various southern agricultural <br />
districts.<ref name="mcevoy222p2" /><br />
<br />
However, Peru's Arequipa forces revolted against the authority of <br />
Lizardo Montero. On 25 October 1883, a popular uprising overthrew the <br />
government and military of [[Lizardo Montero Flores]] who retired in Arequipa to [[La Paz, Honduras|La Paz]], bringing Chilean troops under Jose Velasquez occupied the city on 29 October, this being delivered by the diplomatic corps of the city.<br />
<br />
==== Twentieth and twenty-first centuries ====<br />
[[File:Neocolonial Reniec Building.jpg|thumb|right|Headquarters of the National Registry of Identification and Civil Status (RENIEC). Built in the 1940s, is an example of the neo-colonial architecture in Arequipa.]]<br />
[[File:Chaves de la Rosa, Arequipa.jpg|thumb|right|French type architecture in Arequipa]]<br />
Reached the twentieth century, the city was the scene of military coups on 22 August 1930, when the commander [[Luis Miguel Sánchez Cerro|Luis Sánchez Cerro]] was proclaimed Supreme Head and forced the resignation to President Augusto B. Leguia, and 27 October 1948, when General [[Manuel A. Odría|Manuel A. Odria]] formed a joint government and ousted President [[José Bustamante y Rivero|José Luis Bustamante y Rivero.]]<br />
<br />
The city was also the scene of brave civic protests against arbitrariness.<ref name="Atlas2">{{cite book |last = GARAYAR|first = Carlos|title = Atlas del Perú – Arequipa|year = 2003|work = Lima: PEISA|id = 992-40-315-7}}<br />
</ref> The two most important were against the [[Manuel A. Odría|Odria]], one on 17 June 1950, featuring students of the College of American Independence and the second for nine days of December 1955. As usual earthquakes in the department had special significance earthquakes in 1868,1878 and 1913, for the severe injury and damage that resulted.<br />
<br />
The city's economic development was favored by the railroad Arequipa [[Islay]] built by [[Henry Meiggs|Henry Meiggs.]] This was linked to the railway linking Arequipa, [[Cusco|Cuzco]] and [[Juliaca|Juliaca.]] The first telegraph system in the region, which connected [[Mollendo]], Arequipa and Vitor, was established in 1908. Drinking water was supplied to the city with an aqueduct leading Yumina mineral waters, <br />
opened in 1914. In 1931 he built roads Yura Arequipa-Puno and Arequipa. <br />
In Chili to {{convert|78|km|0|abbr = off}}<br />
<nowiki> </nowiki>from the city and 4300 masl dam was built to irrigate El Fraile 3000 ha<br />
<nowiki> </nowiki>in the plains of La Joya. This hardworking engineering work was <br />
completed in 1938. In 1940 he inaugurated the modern Alfredo Rodriguez <br />
Ballon Airport.<br />
<br />
In the mid-nineteenth century, the expansion of international demand <br />
helped reorganize the landlords and warlords colonial exploitation of <br />
indigenous peasants in Puno through the expansion of large estates while<br />
<nowiki> </nowiki>a circle of Arequipa controlled the marketing and processing wool at <br />
the expense of rural communities.<ref name="cotler20p2">{{harv|Cotler|2009|p = 20|sp = sí}}<br />
</ref><br />
<br />
The momentum of this market, broader than deep, Arequipa is built <br />
from the second half of the nineteenth century as a city of middle <br />
classes, merchants, artisans, professionals, home to an elite regional <br />
macro in modern business city located.<ref name="cotler27p2">{{harv|Cotler|2009|p = 27|sp = sí}}<br />
</ref><br />
<nowiki> </nowiki>In time, the elite arequipeña happens to collect, process and export <br />
wool, producing, acquiring lands medium farmers or indigenous highland <br />
and developing an operating system supported by income. This modern <br />
twentieth-century Arequipa, old families, industries, large middle <br />
classes and workers organized in unions, is constructed as a bourgeois <br />
city, civic, democratic.<ref name="cotler28p2">{{harv|Cotler|2009|p = 28|sp = sí}}<br />
</ref><br />
<br />
In the early twentieth century intellectual groups emerged, such as the "Group Aquelarre" movement, whose demands were focused on political decentralization and a regional identity which coincided with a resurgence of anti-limeño/anti-centralist sentiment. These groups were disassociated from issues related to social justice and economic reform and ultimately came to an abrupt end as a result of the [[Great Depression|Great Depression.]]<ref name="love6p">{{harv|Love|1995|p=6|sp=sí}}</ref> Prominent leaders also arose such as Victor Andres Belaunde and [[José Bustamante y Rivero|José Luis Bustamante y Rivero]], who left their mark as strong-willed constitutionalists in early 1930, and from 1945 to 1948 when [[José Bustamante y Rivero|José Luis Bustamante y Rivero]] served as president of Peru.<ref name="bethell402p" /><br />
<br />
In 1945 Bustamante y Rivero became the president of Peru thanks to an alliance with the APRA party and lobbying from Arequipa and other supporters in Lima and other parts of the country. However, the alliance with APRA collapsed early in his presidency weakening his government and giving rise to a military coup by Odría who suppressed APRA and its leaders.<br />
<br />
In 1950 the lawyer Francisco Mostajo (a prominent liberal from Arequipa since 1901) led a failed revolution in Arequipa against the dictator general Odria. In 1962 and in 1963 Fernando Belaunde Terry and his [[Popular Action (Peru)|Popular Action]] party with the support of another party originally from Arequipa, the Christian Democrats, won the presidency of Peru.<br />
<br />
Law 15,923 of 10 January 1966 authorized the creation of the <br />
industrial park of Arequipa, important motivator mediated regional <br />
manufacturing.<br />
<br />
In the early years of this century the historic center of Arequipa was declared [[World Heritage Site|Cultural Heritage of Humanity]], there was also an 8.4 magnitude earthquake on 23 June 2001, one of the largest earthquakes in the world since 1900,<ref>[[tax|The highest magnitude earthquakes since 1900]].<br />
</ref><br />
<nowiki> </nowiki>and of greater magnitude in the history of Peru because of this <br />
earthquake, many of the historic buildings in Arequipa were damaged or destroyed.<ref>{{cite web |url = http://khatati.igp.gob.pe/cns/publi/simposium02/pdf_simposium02/sgp_ber2_tave.PDF|title = Cuantificación del Tamaño del Terremoto de Arequipa del 23 June 2001|accessdate = 18 August 2012|author = Tavera, Hernando|year = 2011|language = Spanish|archivedate = 20 January 2010|archiveurl = http://web.archive.org/web/20100120020910/http://khatati.igp.gob.pe/cns/publi/simposium02/pdf_simposium02/sgp_ber2_tave.PDF}}<br />
</ref><br />
<br />
=== Uprisings ===<br />
[[File:TomadeArequipa.JPG|thumb|right|Revolution of 1856, from his exile in Chile Vivanco epistolary conspired against the second government of Castile and proclaimed overlord by a revolution started in Arequipa (1 November 1856), returned to take charge. It was the beginning of a long civil war, perhaps the most serious suffered by the Peruvian Republic.]]<br />
Throughout history Arequipa policy have led to many uprisings that earned the city the adjective of "The Lion of the South".<ref name="leondelsur">{{cite web |url=http://linda-arequipa.com/historia-de-arequipa/levantamientos-y-revoluciones/ |title=History of Arequipa |accessdate=5 February 2010 |author=Linda Arequipa |year=2007}}</ref> According to Leslie Bethell Cambridge University "if Arequipa was the capital of liberalism the other regions of Peru promoted their own interests only through their ideology'.<ref name="bethell403p">{{harv|Bethell|1991|p=403|sp=sí}}</ref> other authors conclude that revolutions were not developed under personal interests or politicians that incentivized, but by passion for law and justice, for his religious faith and his honor.<ref name="leondelsur" /><br />
<br />
Leslie Bethell emphasizes the importance of revolutions of Arequipa stating:<br />
{{quote|:«None of the numerous ''aprista'' insurrections in the three decades, including that in Trujillo in 1932, secured as much political leverage as these three Arequipa-based movements.»<br />
<br />
: «Ninguna de las numerosas insurrecciones apristas en las tres décadas, incluyendo la de Trujillo en 1932, han garantizado una gran influencia política como estos tres movimientos surgidos en Arequipa.»|Leslie Bethell, ''The Cambridge History of Latin America: Latin America since 1930''<ref name=bethell403p/>}}<br />
<br />
This revolutionary fame known among Peruvians still won it through numerous rebellions where almost all revolutions, some with national impact, armed themselves to defend local autonomy, compared to a centralizing capital more and more taking up arms in the revolutions following:<ref name="guillemete3p">{{harv|Guillemette|2010|p=3|sp=sí}}</ref><br />
<br />
{{Columns<br />
|col1 = * Revolution of 1834<br />
* Revolution of 1841<br />
* Revolution of 1844<br />
* Revolution of 1851<br />
* Revolution of 1854|col2 = * Revolution of 1856<br />
* Revolution of 1865<br />
* Revolution of 1867<br />
* Revolution of 1883<br />
* Revolution of 1884|col3 = * Revolution of 1930<br />
* Revolution of 1931<br />
* Revolution of 1950<br />
* Revolution of 1955}}<br />
<br />
=== Political trend ===<br />
The starting point of the political path followed by Arequipa is marked by the new national bourgeoisie, which appears to challenge the existing bourgeois elite in Peru, where there was a significant and growing stratum of people in Peru with professional, administrative and trade.<ref name="bethell401p">{{harv|Bethell|1991|p=401|sp=sí}}</ref><br />
<br />
Since the 1900s the rebellious spirit Arequipa, reborn from the pen of a group of intellectuals, a new generation of liberal anticlericalism characterized by a very Catholic society and opposition to economic and political centralization of the country,<ref name="guillemete5p">{{harv|Guillemette|2010|p=5|sp=sí}}</ref> this opposition Arequipa to the political and economic centralization of the country naturally led to a constitutional position in the 1930s and the subsequent adoption of ideologies Christian Democrats in the 1940s and 1950s. Lawyers and projected a strong church influence in politics Arequipa, as well as the middle class gained further declined participation to economic prosperity in the south of the country.<ref name="bethell402p" /><br />
<br />
These new interests take political structure more clearly inside the country whose strongest political structure was the city of Arequipa, and their potential strengths of this national election that was reflected by strength in the candidacy of Fernando Belaunde Terry in the 1956 presidential elections. The southern region, dominated by the city of Arequipa has a long history of separatism and the Republic of Peru, Arequipa and the upper class of the twentieth century has preserved a distinctive regional identity.<ref name="bethell402p" /><br />
<br />
== Geography ==<br />
<br />
=== Location ===<br />
The city is located at {{convert|2328|m}} of elevation above sea level, with the lowest part of the city being at {{convert|2041|m}} above sea level in the area called Huayco [[Uchumayo District|Uchumayo]] while the highest is located at {{convert|2810|m}} above sea level.<br />
<br />
The central part of the city is crossed by the Chili River from north to south; to the north and east of Arequipa are the Andes mountains, while to the south and west there are minor mountain ranges associated to the Andes. The valley of Arequipa, open toward the coast, plays a key role in allowing Arequipa to be a city that strategically links the coastal and highland regions of southern Peru.<ref name="gutierrez17p">{{harv|Gutiérrez|p=17|1994|sp=sí}}</ref><br />
<br />
A series of volcanic cones dominates the skyline from the city. These volcanoes form mountains like the [[El Misti|Misti]], [[Pikchu Pikchu]] and [[Chachani]]. This rugged [[Andes|Andean]] western edge of South America is characterized by thick layers of volcanic lava that cover large areas.<ref name="regional19p">Regional Government of Arequipa. "Analysis of the state and of the determinants of health", p. 19.</ref><br />
<br />
=== Climate ===<br />
<br />
The climate of the city is predominantly dry in [[winter]], [[autumn]] and [[Spring (season)|spring]] due to the low atmospheric moisture and an effective precipitation corresponding to that of a [[Semi-arid climate|semiarid]] climate. Arequipa has also 300 days of sunshine a year on average. Throughout the year, temperatures do not exceed {{convert|25|°C|0}} and rarely drop below {{convert|10|°C|0}}. The wet season lasts from December to March and is marked by the presence of clouds in the afternoon and low rainfall. In winter (June, July), weather gets a little cooler and the temperature drops to an average of {{convert|10|°C|0}}.<br />
<br />
The average relative humidity is 46%, with an average high of 70% in the summer season and a minimum average of 27% during the seasons of autumn, winter and spring, according to data from the weather station at Goyeneche Hospital.<ref name="conam21p">National Environmental Council. "To clear the air", p. 21.</ref><br />
<br />
The winds are influenced by a system of local winds and the passage of frontal systems of low atmospheric pressure, which are conditioned by the topographical surrounding the valley where the city is. These winds occur mainly in the evening and early morning; mountain breezes flow in a north-east direction and in the course of the day valley breezes dominate with a South-West direction. The wind velocity along the day fluctuates between 1.5 m / s and 2.5 m / s.<ref name="conam21-22p">National Environmental Council. "To clear the air", pp. 21–22.</ref><br />
<br />
{{Weather box<br />
|location = Arequipa|metric first = Y|single line = Y|Jan high C = 21.5|Feb high C = 21.0|Mar high C = 21.4|Apr high C = 21.7|May high C = 21.8|Jun high C = 21.3|Jul high C = 21.4|Aug high C = 21.9|Sep high C = 22.3|Oct high C = 22.6|Nov high C = 22.5|Dec high C = 22.1|year high C = 21.8|Jan low C = 8.6|Feb low C = 8.8|Mar low C = 8.5|Apr low C = 6.9|May low C = 6.3|Jun low C = 5.5|Jul low C = 5.5|Aug low C = 5.5|Sep low C = 6.4|Oct low C = 6.6|Nov low C = 6.6|Dec low C = 7.7|year low C = 6.9|rain colour = green|Jan rain mm = 28.0|Feb rain mm = 35.6|Mar rain mm = 21.3|Apr rain mm = 0.7|May rain mm = 0.2|Jun rain mm = 0.0|Jul rain mm = 0.0|Aug rain mm = 1.8|Sep rain mm = 1.4|Oct rain mm = 0.2|Nov rain mm = 1.1|Dec rain mm = 4.3|year rain mm = 94.6|source 1 = [[World Meteorological Organization]]<ref name= WMO>{{cite web <br />
| url = http://worldweather.wmo.int/029/c00109.htm<br />
| title = World Weather Information Service – Arequipa<br />
| publisher = World Meteorological Organization<br />
| accessdate = August 21, 2013}}</ref>|date = August 2013}}<br />
<br />
=== Solar radiation ===<br />
The global [[Sunlight|solar radiation]] recorded in the city ranges from 850–950 ''W / m <sup>2</sup>'' (watts / square meter), considered one of the highest levels of radiation in South America and the highest recorded in Peru. This phenomenon is due to its proximity to the area of influence of the [[Atacama Desert]] and [[pollution]] at every stage.<ref name="conam21p" /><br />
<br />
=== Cityscape ===<br />
<br />
==== Historic Centre ====<br />
On 15 August 1540 a plot was made forty-nine "blocks or islands." {{refn|«Se dispusieron las calles a cordel perpendicularmente, formando islas o manzanas en número de 56, es decir, un auténtico damero, que se conserva hasta nuestros días con muy pocas variantes.»<ref name=neira224p>{{harv|Neira|1990|p=224|sp=sí}}</ref>|group = nota}} sides were measured and each had a length of "400 feet Castilians' (111.40 meters), separated by streets" 37 feet Castilian "(10.30 meters), so that the checkerboard foundation is characterized by perfection in drawing apples.<ref name="Municipalidad">{{harv|Municipalidad Provincial de Arequipa|p=10|sp=sí|2002}}</ref> {{refn|«La anchura de las calles fue de treinta pies y el largo de cada cuadra de 250 pies. La Planta primitiva fue luego alterada al fundarse los conventos y monasterios que requirieron dos manzanas algunos de ellos: Es entonces cuando recién aparecen las pequeñas plazas. Efectuada la distribución de solares por vecinos, estos no edificaron de inmediato, los Bandos del Cabildo son reiterativos para que edificaran sus viviendas.»<ref name=neira224p/>|group = nota}}<br />
<br />
The writer Pedro Davalos and Lisson, in his book ''The First Century ''contains the description given by Paz Soldan in 1855:<br />
{{blockquote|Fundose esa ciudad por orden de Francisco Pizarro y con bando solemne el día 15 de agosto de 1540. Su primer sitio, fue atrás de Caima, pero después se trasladó al en que hoy se halla, por presentar más extensión y comodidades. Al trazarla se cuidó que sus calles se cortasen en ángulos rectos y en dirección casi de NS y EO, y que cada cuadra tuviese 150 varas de largo y doce poco más o menos de ancho. Para conservar la salubridad, comodidad y aseo, se cortaron acequias en el medio de las calles, así rectas como transversales, cuyo cauce está bien acanalado. Las calles que corren −230- de E a O son ocho (las principales) y las otras también ocho: sus aceras todas están bien enlosadas con una especie de piedra blanca volcánica, llamada Sillary el piso restante empedrado con guijarros.|'''Pedro Dávalos y Lissón''' – ''La primera centuria : causas geográficas, políticas y económicas que han detenido el progreso moral y material del Perú en el primer siglo de su vida independiente. Tomo II.’’<ref name=davalos320p>{{harv|Dávalos y Lissón|p=320|1863|sp=sí}}</ref>}}<br />
<br />
Because of this, there is no doubt that the former "Villa Hermosa de Arequipa" he intended to occupy the regional capital. The city became a connecting link between Cuzco, ponds and the ocean. And in fact the city of Arequipa in the exploitation phase of silver in Potosi, has since become "'a major logistics hub." The urban setting near the present district of San Lazaro, where was erected the first chapel of the city occupied an area of 850 x 875 meters.<ref name="diagnostico12p">Provincial Municipality of Arequipa. "Diagnosis of the historic center of Arequipa", p. 12.</ref><br />
<br />
The square foundation, located three blocks from the river and occupied an eccentric position in the founding and checkerboard patterns as Hispanic was the focal point of the city. Apples was occupied by four or eight lots, and were distributed according to their importance in the new neighborhood. With the passage of time some religious institutions came to occupy a block as the case of the Convent of Santa Catalina and San Francisco Monastery.<ref name="diagnostico12p" /><br />
<br />
==== Republican Era ====<br />
In the Republican era shows a growth process similar to the colonial era, where the urban area has grown at the expense of the countryside, a process that has worsened in recent decades. The city also experienced an expansion to the east of what is now called historic, new avenues were plotted as Parra Boulevard and Twentieth Century Avenue, was established wooded neighborhood of El Vallecito, where he built the first shawls to the 1940s,<ref name="vallecito">{{cite web |url=http://www.mariorommelarce.com/portal/?p=439 |title=Los Barrios: Su historía, costumbre y tradiciones |accessdate=28 October 2009 |author=Mario Rommel Arce}}</ref> and the city extended into Yanahuara, poor people came to occupy the districts of Miraflores, Barrio Obrero, Jacinto Ibanez.<br />
[[File:Av La Marina Arequipa.JPG|thumb|right|Consuelo Quiñones Interchange, located at the intersections of Quiñones Avenue and La Marina Avenue, is part of the modernization of road infrastructure in Arequipa]]<br />
<br />
Urban architecture is extended with new construction, and moved the market town located in the Plaza de Armas to the park Duhamel and later to its present location at the Convent of the Order of St. Camillus agonizing Parents, between 1905 and 1910 Goyeneche Hospital was built, also built bridges linking the city center with the district as the bridge Yanahuara Real. By the year 1940, the first project was proposed expansion and urban facilities. This plan envisaged the creation of a ring of houses greater than existing growth plan consolidating regarding radial and concentric paths regarding land use, neighborhoods were enabled Cuarto Centenario and Selva Alegre.<ref name="diagnostico14p">Provincial Municipality of Arequipa. "Diagnosis of the historic center of Arequipa", p. 14.</ref> He was also given a boost to urban facilities with the construction of the Municipal Theatre, the Hotel de Turistas, the Municipal Library, the Athenaeum Theatre, American Independence College, Campus of the Universidad Nacional de San Agustin.<ref name="diagnostico14p" /><br />
<br />
Until the late 1950s there were two factors that substantially changed the trends of urban growth, the earthquakes in the years of 1958 and 1960 and the drought plateau, which accelerated peripheral growth.<ref name="diagnostico15p">Provincial Municipality of Arequipa. "Diagnosis of the historic center of Arequipa", p. 15.</ref><br />
<br />
This period starts with greater force the displacement of resident population sectors, there is a shift in the industry that was located in the Barrio del Solar and El Barrio Obrero<ref name="diagnostico24p">Provincial Municipality of Arequipa. "Diagnosis of the historic center of Arequipa", p. 24.</ref> following the creation of the industrial park, causing a process outsourcing of the city center towards commercial activities primarily in the informal sector.<ref name="diagnostico6p">Provincial Municipality of Arequipa. "Diagnosis of the historic center of Arequipa", p. 6.</ref> An example of this exodus is the displacement of some educational institutions that previously were located in the city center as the National University of San Agustin in the year of 1962 and residential sectors to consolidate the periphery to the center of the city as a dynamic central business district.<ref name="diagnostico15p" /><br />
<br />
== Demographics ==<br />
According to [[Peru 2007 Census|census XI]] of 2007, the province of Arequipa concentrates 75.5% of the total population of the region and the city of Arequipa, the capital of the department, with 70% of the total population and 90% of urban population. {{refn|«El departamento de Arequipa está ubicado en la zona sur occidental del Perú. Tiene una población de 1&nbsp;140&nbsp;810 habitantes, distribuida en 8 provincias y 109 distritos ubicados en una superficie de 63&nbsp;345.39 km<sup>2</sup>. El 82&nbsp;% de la población vive en poblados de más de 2000 habitantes, considerados como población urbana y el 84&nbsp;% vive en la sierra. La provincia de Arequipa concentra el 75,5&nbsp;% de la población total de la región y la ciudad de Arequipa, capital del departamento, concentra el 70&nbsp;% de la población total, y el 90&nbsp;% de la población urbana.»<ref name=cotler94p>{{harv |Cotler|2009|p=94|sp=sí}}</ref>|group = nota}}<br />
<br />
=== Demographic trends ===<br />
<br />
One of the first references that can be found is the one by historian Ventura Travada y Córdova who in the mid-eighteenth century, wrote:<br />
{{blockquote|El número de gentes que tiene esta ciudad es de 30.000 de todos sexos, estados y edades.<br />
Los indios apenas 4.000 y para su doctrina basta una sola parroquia en la ciudad – la de Santa Marta – que comprende todos los indios forasteros y naturales que viven dispersos en la ciudad y para ser una sola no es muy numerosa porque excepcionando algunos negros, mulatos y otros apenas llegan a 6.000. todos los demás son españoles, muchos de ellos de nobleza conocida cuya sangre procuran honroso no degenerar...|Ventura Travada y Córdova<ref name=ventura&travada>{{cite book |author=Ventura Travada y Córdova<br />
|title=El suelo de Arequipa convertido en cielo<br />
|year=1752<br />
|page= 90<br />
}}</ref><br />
<br />
}}<br />
<br />
One of the first population census in the city date back to 1796 where there were 37,241 inhabitants in the 'pen' which corresponded to 22 207 Spanish, 5929 Indians, mestizos 4908, 2487 and 1710 slave castes.<ref name="gutierrez83p">{{harv|Gutiérrez|p=83|1994|sp=sí}}</ref> At the end of the first half of the twentieth century, the effects of momentum multplicadores to Arequipa by the works of 1940 demonstrated very quickly which was clearest symptom population growth, as annual population growth of 1.1% for the period of 1876 to 1917 tripled to 3.3% annually in the period that goes from 1940 to 1960.<ref name="gutierrez226p">{{harv|Gutiérrez|p=226|1994|sp=sí}}</ref><br />
<br />
In the early years of the second half of the twentieth century the city would rise from 85,000 in 1940 to 158,000 in 1961 in an unprecedented population explosion process, whose possible reasons have to do with the establishment of the first industrial enterprises generated as opening import substitution due to World War II and the transformation of agricultural production.<ref name="gutierrez226p" /> The demographic trend is substantially modified by two factors: the earthquake of 1958 and the drought plateau, accelerating migration and urbanization, and peripheral growth that lasts until today.<ref name="diagnostico15p" /> The population explosion was enhanced by the rearrangement of urban space after the earthquakes was really impressive and Arequipa's population doubled in a decade.<ref name="gutierrez231p">{{harv|Gutiérrez|p=231|1994|sp=sí}}</ref> The 158 000 inhabitants in 1961, would be 309 000 in 1972 and almost 500,000 in 1983. The expansion of the urban area to previous rural areas incorporated subsistence farming actively into the urban cycle.<ref name="gutierrez232p">{{harv|Gutiérrez|p=232|1994|sp=sí}}</ref><br />
<br />
'''Evolution of the population of Arequipa in the period between 1796 and 2012'''<br />
<br />
<br />
: <small>Sources: Population Census 1804 (Gil de Toboada)<ref name="diagnostico12p" /> Viceroyalty of Peru in 1812, {{refn|«Se ha considerado a la población del partido del "Cercado", que puede ser más amplia que la de la ciudad propiamente dicha, pero puede servirnos de referencia.»<ref name=contreras278p>{{harv |Contreras|2004|p=278|sp=sí}}</ref>|group = nota}} Census of inhabitants of Peru (1876) {{refn|«La ciudad de Arequipa está compuesta por los distritos de Arequipa, Miraflores y Palomar.»<ref name=direccion426p>{{harv |Dirección de Estadística|1878|p=426|sp=sí}}</ref>|group = nota}} Census of the City of Arequipa in 1917<ref name="inep">{{harv|Instituto Nacional de Estadistica|1944|p=60|sp=sí}}</ref> INEI,<ref>{{cite journal |title=El crecimiento de las ciudades |publisher=Migraciones Internas en el Perú |work=Instituto Nacional de Estadística e Informática |url=http://www.inei.gob.pe/biblioineipub/bancopub/Est/Lib0018/cap31002.htm |accessdate=9 August 2012}}</ref> INEI 2012 population estimate<ref name="proyeccion2015INEI" /> </small><br />
<br />
== Economy ==<br />
[[File:Anntarah, Campo Redondo, Arequipa.JPG|thumb|right|Boutique in Piazza Campo Redondo]]<br />
Since Arequipa is predominantly urban, industry, commerce and construction taking place in the capital of the department have a central role in the future of the town. However, the presence of fertile valleys and high Andes allows agricultural activity has great importance for the development of the city: a central axis of the demands arequipeñas is building irrigation to improve their productivity. Finally, in recent times, the mining industry has entered a stage of modernity, has ceased to be only artisanal or small business to include large-scale mining, as in the case of Cerro Verde,<ref name="cotler96p">{{harv|Cotler|2009|p =96|sp=sí}}</ref> established in 1993 in the Arequipa.<ref name="centrum">Centrum. Cerro Verde Financial Reports, p. 4.</ref><br />
<br />
From the twentieth century in the city have developed the [[Industry|industries]] related to the primary sector, highlighting the textile and agricultural industries. They constitute a center of exchange and mediation in the southern Andes, serving as a link between the [[coast]] and the mountains.<ref name="PlanArequipaMetro">[http://www.cipca.org.pe/cipca/webir/regarequipa/captuloiv.pdf Metropolitan Strategic Plan of Arequipa, Arequipa Economics]</ref><br />
<br />
=== Economic indicators ===<br />
The contribution of the city of Arequipa in Arequipa region's GDP is 74.2% of its GDP according to studies by the National University of San Agustin, also the region's GDP is the highest Arequipa after Lima.<br />
<br />
In the period 2003–2008 was the "City with greatest economic growth in Latin America", according to the report in 2009 of "America Economia" presenting a percentage change in GDP per capita of 66.1%. Also in 2007–2008 was the city with the highest percentage change in GDP in Latin America with a variation of 9.59%.<ref name="AméricaEconomía">{{cite journal |author=América Economía |title=Ser verde en 2009 es como estar online en 1999 |year= 2009 |language=Spanish |journal=América Economía |number=7728 | id = p. 22 – p. 25 |url=http://web.archive.org/web/20090520235518/http://www.americaeconomia.com/Multimedios/Otros/7782.pdf<br />
}}</ref><br />
<br />
{| class="wikitable" border="1" cellpadding="0" cellspacing="1" width="50%" style="float:center;text-align:center;clear:all;margin-left:25%;font-size:84%"<br />
|-<br />
! bgcolor="black" colspan="5"|Economic Indicators – City of Arequipa<br />
|- bgcolor="#efefef"<br />
! width="20%"| Population (MM)<br />
! width="20%"| GDP 2010 (millions U.S. $)<br />
! width="20%"| GDP per capita 2010 (U.S. $)<br />
! width="20%"| % Unemployment 2011<br />
! width="20%"| No. investment banks<br />
|-<br />
| &nbsp;0–9<br />
| 10,587<br />
| 12,188<br />
| 5,0<br />
| 1<br />
|-<br />
| colspan="5" style="background:#e9e9e9" align="center"|<small>Source: American Journal Economics. ''Special Cities''<ref name="america2011">{{cite journal |author=América Economía |year=2012 |title=Las mejores ciudades para hacer negocios |publisher=Especiales |work=América Economía |url=http://rankings.americaeconomia.com/2011/ciudades/ranking.php |accessdate=23 August 2012}}</ref></small><br />
|-<br />
|}<br />
<br />
According to the "Specialized Household Survey on Employment Levels" has the largest amount of "Economically able to work" within the country amounting to 625 547 people, and the most economically active population (PEA) which amounts to 376 764 people having a same employment rate above the national average with an average monthly income of 928 soles<ref>{{cite journal |year=2007 |title=Ciudades:Promedio y mediana del ingreso laboral mensual de la PEA ocupada |publisher=Programa de Estadísticas y Estudios Laborales |work=Ministerio del Trabajo |url=http://www.mintra.gob.pe/archivos/file/estadisticas/peel/estadisticas/oflapeaocupada_17.pdf |accessdate=10 August 2012}}</ref> whose main areas of activity in which play is manufacturing (12.9%), trade (23%) and non-personal services (36.6%).<ref>{{cite journal |year=2000 |title=PEA Ocupada según diversas variables: estructura de mercado, grupo ocupacional y rama de actividad |publisher=Programa de Estadísticas y Estudios Laborales |work=Ministerio del Trabajo |url=http://www.mintra.gob.pe/archivos/file/estadisticas/peel/estadisticas/40_1.pdf |accessdate=10 August 2012}}</ref><br />
<br />
The contribution to the national sales tax is 20.3%, in solidarity tax on 17% being the second national taxpayer in these taxes. Arequipa has a production structure strongly biased to trade and services sectors, the primary sector of agriculture and [[mining]] accounted for 29.6% of GDP, the secondary sector of manufacturing industry and 20.7% in the tertiary sector and trade and services 49.7%, it was strengthened in recent years by a lack of productive investment.<br />
<br />
=== Construction ===<br />
<br />
<!-- {| class="toc" cellpadding="0" cellspacing="1" width="25%" style="float:right;text-align:center;clear:all;margin-left:3px;font-size:85%"<br />
|-<br />
! bgcolor="black" colspan="3" style="color:white"|Construction<br />
|-<br />
|}<br />
!bgcolor = # e0e0e0 colspan = 3 | construction activity<br />
|-Bgcolor = # efefef<br />
! width = 60% | Destination<br />
! width = 20% | m <sup>2</sup><br />
! width = 20% |%<br />
| –<br />
| Align = left | '''Housing | | 401,530 | | 65.61'''<br />
| –<br />
| Align = left '''| Commercial | | 63,456 | | 10.37'''<br />
| –<br />
| Align = left | '''Offices | | 23,367 | | 3.82'''<br />
| –<br />
| Align = left | '''Other Destinations | | 123,608 | | 20.2'''<br />
| –<br />
| Align = center | '''TOTAL | | 611,961 | | 100%'''<br />
| –<br />
| Align = center colspan = 3 | <small>'''Peruvian Chamber of Construction''' </small><br />
| –<br />
|}<br />
--><br />
[[File:Villa Médica Towers.jpg|thumb|right|Construction has been the fastest growing sector in recent years. High-rise apartment buildings at Villa Medica.]]<br />
The construction sector of the city is the second most dynamic in the country, after Lima, according to the Study of Urban Buildings by the Institute of Construction and Development of the Peruvian Chamber of Construction.{{Citation needed|date=December 2012}} Building activity in 2011 amounted to 611 961 m <sup>2,</sup> 65% for housing, 10% for offices and commercial premises 4%.{{Citation needed|date=December 2012}} In the case of housing supply, departments account for 70% and 30% households of the total supply in this sector of destination.{{Citation needed|date=December 2012}}<br />
<br />
=== Fairs, exhibitions and congresses ===<br />
The city is seen as a place of exhibitions and events in the country,<ref>{{cite news |title= Eguren, Arequipa se consolida como plaza para convenciones y eventos|url=http://www.rpp.com.pe/2009-11-21-eguren-arequipa-se-consolida-como-plaza-para-convenciones-y-eventos-noticia_224065.html |work=Radio Programas del Perú |date=21 November 2009 |accessdate=10 August 2012}}</ref><ref name="eventosTravel">{{cite news |title=Convención minera 2011 confirma a la ciudad como plaza principal de realización de eventos |url=http://www.travelupdate.com.pe/nacional/6227-arequipa-convencion-minera-2011-confirma-a-la-ciudad-como-plaza-principal-de-realizacion-de-eventos |work=Travel Update |accessdate=10 August 2012}}</ref> among which were:<br />
<br />
* '''International Book Fair'''<br />
<br />
The III International Book Fair held in Arequipa in 2011 had an influx of 400,000 people and a collection of a million and a half soles<ref>{{Cite web |title=¿CÓMO SE GESTÓ EL PREMIO INTERNACIONAL DE NOVELA CORTA MARIO VARGAS LLOSA? – Premio Internacional de Novela Corta Mario Vargas Llosa |url=http://filarequipa.pe/premiomariovargasllosa/como-se-gesto-el-premio-internacional-de-novela-corta-mario-vargas-llosa-2 |deadurl=no |accessdate=11 December 2012}}</ref><br />
<br />
* '''Mining Convention'''<br />
<br />
Oriented mining sector entrepreneurs, investors and government delegations in the last edition in the year 2011 had the presence of 40 countries bringing together 50,000 people.<ref>{{Cite web |title=requipa: 50 mil personas visitan al momento Convención Minera |url=http://www.rpp.com.pe/2011-09-15-arequipa-50-mil-personas-visitan-al-momento-convencion-minera-noticia_404087.html |deadurl=no |accessdate=11 December 2012}}</ref><br />
<br />
=== Tourism ===<br />
In Arequipa tourism is a factor of the economy energizing establishing itself as the third most visited city in the country after Cusco and [[Lima]].<ref name="export17p"/> In 2010, Arequipa received a total of 1.395 million visitors according to the [[Ministry of Foreign Commerce and Tourism (Peru)|Ministry of Commerce and Tourism.]]<ref name="Turistas">{{cite journal |year=2011 |title=Arequipa:principales indicadores del sector turismo 2001–2010 |publisher=Banco de publicaciones estadísticas |work=Instituto Nacional de Estadística e Informática |url=http://www.inei.gob.pe/biblioineipub/bancopub/Est/Lib0937/cuadros/arequipa/2_4_3_16.xls |accessdate=9 August 2012}}</ref><br />
<br />
=== Industry ===<br />
[[File:Parque Industrial de Arequipa.jpg|thumb|right|Partial view of Arequipa Industrial Park located south of the metropolis]]<br />
The city's industrial sector has the largest nationwide diversification<ref name="Industria">{{cite book |work=Banco Central de Reserva del Perú |title=Arequipa, perfil Económico |url=http://www.bcrp.gob.pe/bcr/dmdocuments/Publicaciones/seminarios/Conf200701/Lib200701-03 |edition=ilustrada |year=2006 |page=292 |chapter=3}}</ref> and is the second most industrialized city of Peru<ref name="export17p"/> product of the Industrial Park was established during the first government of [[Fernando Belaúnde Terry|Fernando Belaúnde Terry.]] After two major earthquakes, in 1958 and 1960, with the law of the "Rehabilitation and Development Board of Arequipa» Industrial Park was built with two or three factories at that time, and the Yura Cement factory.<ref name="Industria"/><br />
<br />
The city's industrial sector comprises industrial parks among which may be mentioned the "Parque Industrial de Arequipa" orientaado to large and medium enterprises, the "Industrial Park APIMA" to small businesses,<ref name="apima">{{cite book |last=Centty Villafuerte |first=Eymor B. |work=Banco Central de Reserva del Perú |title=Informe Pymes de Arequipa 2002|url=http://www.eumed.net/libros/2008c/422/PROMOCION%20ESTATAL%20A%20LAS%20PYMES.htm |year=2002|page=124}}</ref> the "Industrial Park Rio Seco "and industrial areas in the Alfonso Ugarte Av, Alternative Uchumayo and North Cone.<ref name="zonificación">{{cite book |work=Oficina de Planificación y Gestión Urbano Ambiental – Municipalidad Provincial de Arequipa |title=Aspecto Normativos del Plan Director |url=http://web.archive.org/web/20070306125343/http://www.muniarequipa.gob.pe/proyectos/plan_director/aspectos_normativos/aspectos_normativos.pdf|year=2002 |id=p. 11 |page=29 |chapter=Zonificación Industrial}}</ref> Finally, there is a consolidated sector and planned and Ladrilleras Umapalca Yarabamba way. Spatial occupancy for industrial zones cover an area of 286 hectares.<ref name="conamu26p">National Environmental Council. "To clear the air", p. 26.</ref><br />
<br />
* '''Arequipa Industrial Park,''' along its existence has undergone several transformations of their industries, showing a more dynamic consumer related industries (food and beverages), construction (PVC, cement and steel) and those of Export (textile companies). In this industrial companies are also engaged in the chemical industry and plastics, companies producing non-metallic minerals, stationery and printing, among others,<ref name="Industria"/> conglomerando over 150 companies, among which we can highlight to Alicorp SAA, Processed Foods SA, Laive, La Iberica, Manuel Muñoz Najar, Bin Pan SA, Consorcio Industrial Arequipa SA, Omniagro, Backus & Johnston, Corporación Aceros Arequipa. Also in Arequipa is developed textiles both cotton and alpaca and wool factories represented by: Francky and Ricky, Michell & Cia. e IncaTops, companies are also in the Arequipa Industrial Park.<ref name="Industria"/><br />
<br />
=== Media and Entertainment ===<br />
On 15 August 1959 was the first television transmission in the city of Arequipa at the Cultural Hall of the National University of San Agustin. It was an initiative of businessman Jack Dwyre through his new company Televisora Sur Peruana in partnership with the [[Universidad Nacional de San Agustín de Arequipa|National University of San Agustin]] as Channel 2 (now TV UNSA).<ref name="television">{{cite web |url=http://www.mariorommelarce.com/portal/?p=470 |title=50 años de la televisión en Arequipa |accessdate=29 October 2009 |author=Mario Rommel Arce}}</ref> The aforementioned university became one of the first in South America to operate a public TV station from inside its campus.<ref name="television" /><br />
<br />
Furthermore, two other public television stations began to operate in Arequipa: Radio Television Continental (Channel 6) in 1962 and Compañía de Radiodifusión Arequipa (Channel 8) in 1987 (broadcasting as ATV Sur since 2012).<ref name="television2">{{Cite book |url=http://books.google.com.pe/books?id=fOKgtCnP9FoC&dq |title=El impacto económico de la cultura en Perú |accessdate=10 July 2012 |author=Universidad de "San Martín de Porres." Escuela Profesional de Turismo y Hotelería. Instituto de Investigacíon |year=2005}}</ref><br />
<br />
Among the newspapers that are printed in the city, ''El Pueblo'' is the oldest (active since 1 January 1905) and the second oldest in the country. Writers like Percy Gibson and Alberto Hidalgo, and politicians like Hector Cornejo Chavez, Mario Polar Ugarteche and Alfonso Montesinos started their careers in this newspaper.<ref name="garayar60p">{{harv|Garayar|p=60|2004|sp=sí}}</ref><br />
<br />
== Education ==<br />
According to the 2007 Census data INEI in [[Arequipa Province|Arequipa]], there is a student population totaling 823,148 inhabitants of three years or more to attend a regular school, which represents 95.24% of the entire provincial population of Arequipa.<br />
<br />
=== Nursery, primary and secondary ===<br />
In 2007 in the districts of the city 20% nbsp; 595 students at grade level or initial childhood education, primary education, 143 543 and 219 305 secondary education. Among the oldest schools in the city are the Seminary of San Jeronimo in operation since 1622,<ref>{{cite web |url=http://www.seminariosanjeronimoarequipa.org.pe/historia.php |title=Historia del Colegio San Jerónimo |accessdate=3 August 2012 |work=Colegio San Jerónimo}}</ref> the American Independence College, St. Francis College, Don Bosco Salesian College, College De La Salle and St. Joseph College.<br />
<br />
=== Higher education ===<br />
The city of Arequipa has the presence of more than 15 universities, with only one national and eight private headquartered in the city, the rest are private and national universities both at home and abroad (Chile).<br />
<br />
In 2007 in the existing universities housed a university population of 70,894 students and colleges university not a population of 56 087 students, becoming the city with the highest number of home university of the country after the capital and the city with the highest population percentage-wise university of Peru. The population categorized with university and complete university reached 108 823 and 70 252 students respectively.<br />
<br />
==== National University of San Agustin ====<br />
{{main|National University of St Augustin of Arequipa}}<br />
[[File:Pabellón de la Cultura, UNSA.JPG|thumb|right|University City at the National University of San Agustin, Arequipa marking neocolonial style under a scheme of L'Ecole des Beaux Arts in Paris]]<br />
It is the second largest public university in the country, behind the University of San Marcos,<ref name="anr10p">National Assembly of Rectors. "University Statistical Data", p. 10.</ref> had the predecessor to the Royal and Pontifical University Intra calustra, created by decree on 22 January 1714 and the Academy of Sciences Lauretana Arts and founded on 10 December 1821,<ref name="robles45p">{{harv|Robles|p=45|2006|sp=sí}}</ref> from which was born the National University of San Agustin who was installed on 11 November 1828 but according to the university law recognizes the creation of the university on 2 June 1827.<ref name="unsaresena">{{cite web |author=Universidad Nacional de San Agustín |year=2012 |title=Reseña Histórica |publisher=La Universidad |url=http://www.unsa.edu.pe/index.php/la-universidad/resena-historica |accessdate=11 August 2012}}</ref><br />
<br />
===== University Campus =====<br />
The construction of the university city of the National University of San Agustin is a product of the projection made by the architect Hector Velarde in 1940<ref name="gutierrez216p">{{harv|Gutiérrez|p=216|1994|sp=sí}}</ref> but it was not until 1962 that the university decentralizes its functions and moves to the campus.<ref name="diagnostico15p" /> The campus features correspond to a scheme totally academic teaching style of L'Ecole des Beaux Arts in Paris, with remarkable symmetry in the arrangement of the elements and pavilions which then lead to a neo-formal lexicon<ref name="gutierrez217p">{{harv|Gutiérrez|p=217|1994|sp=sí}}</ref> that led it to adopt a "style arequipeño" whose formal features transcended the city and were projected to other centers of Peru and the rest of America. {{refn|«Buen ejemplo del neoarequipeño es el edificio del Diario de la Nación de Buenos Aires en la calle Florida, obra del Arq. Pirovano.»<ref name=gutierrez217p_a>Citado en {{harv|Gutiérrez|1994|p=217|sp=sí}}</ref>|group = nota}}<br />
<br />
==== Private Universities ====<br />
The first private university established in the city was the Catholic University of Santa Maria, the establishment of this university was followed by San Pablo Catholic University, University of San Francisco.<ref>University of San Francisco. [http://spij.minjus.gob.pe/Normas/sumillas/020909S.pdf ''Creating the Autonomous University of San Francisco'']''<nowiki/>''</ref> and the University of La Salle, it belongs to International Network of Universities of La Salle, and Javier Prado Private University and Southern University.<br />
<br />
Additionally, in the city are located branches from other universities, as a branch of the [[National University of San Marcos|Universidad Nacional Mayor de San Marcos]], subsidiaries of Néstor Cáceres Velásquez Andean University, Technological University of Peru, Peruvian Wings University; San Pedro Private University, the University del Mar, Chile, the University of Chimbote Los Angeles, School of Business San Francisco Xavier, the Universidad Inca Garcilaso de la Vega and San Martin de Porres University for example-that add universities established in the city of Arequipa.<br />
<br />
{| class="wikitable sortable" style="float:center;text-align:center;clear:all;margin-left:15%;font-size:80%" border="1" cellpadding="0" cellspacing="1" width="70%"<br />
<br />
! colspan="4" bgcolor="#e0e0e0" |<br />
Universities<ref name="anr19p">National Assembly of Rectors. "University Statistical Data", p. 19.</ref><ref name="anr20p">National Assembly of Rectors. "University Statistical Data", p. 20.</ref><br />
|- bgcolor="#efefef"<br />
! width="60%" |<br />
University<br />
! width="20%" |<br />
Installation<br />
! width="20%" |<br />
Undergraduates<ref name="universitarioredatam">{{cite journal |journal=Instituto Nacional de Estadística e Informática |authorlink=http://desa.inei.gob.pe/cenaun/redatam/ |year=2012 |title=Reporte Universitario REDATAM |url=https://docs.google.com/spreadsheet/ccc?key=0AlWxBwWL6_X6dE9SX3hKQUw3eUtXeDAzWVhfVWJBSlE |accessdate=18 August 2012}}</ref><br />
! width="20%" |<br />
Main Campus<br />
|-<br />
| align="left" |&nbsp;'''National University of San Agustin'''<br />
| 1828<br />
| 24188<br />
| Arequipa<br />
|-<br />
| align="left" |&nbsp;'''Catholic University of Santa Maria'''<br />
| 1963<br />
| 12268<br />
| Arequipa<br />
|-<br />
| align="left" |&nbsp;'''San Pablo Catholic University'''<br />
| 2004<br />
| 4769<br />
| Arequipa<br />
|-<br />
| align="left" |&nbsp;'''San Francisco University'''<br />
| 2010<br />
| –<br />
| Arequipa<br />
|-<br />
| align="left" |&nbsp;'''University of La Salle'''<br />
| Maestría en Ingeniería del Software Aplicada<br />
| –<br />
| Arequipa<br />
|-<br />
| align="left" |&nbsp;'''Private University of Health Sciences'''<br />
| Maestría en Ingeniería del Software Aplicada<br />
| –<br />
| Arequipa<br />
|-<br />
| align="left" |&nbsp;'''Private Autonomous University of South'''<br />
| Maestría en Ingeniería del Software Aplicada<br />
| –<br />
| Arequipa<br />
|-<br />
| align="left" |&nbsp;'''Javier Prado University<ref name="javierprado">{{cite web |url=http://es-la.facebook.com/note.php?note_id=339160186127553 |title=El "boom" de las universidades particulares |accessdate=25 April 2012 |work=Semanario Vista Libre |language=Spanish}}</ref>'''<br />
| Maestría en Ingeniería del Software Aplicada<br />
| –<br />
| Arequipa<br />
|-<br />
| align="left" |&nbsp;'''San Francisco Xavier University'''<br />
| 2010<br />
| –<br />
| Arequipa<br />
|-<br />
| align="left" |&nbsp;'''Alas Peruanas University<ref name="alasperuanas">{{cite web |url=http://www.uap.edu.pe/Esp/DondeEstamos/FilialesUAP/Arequipa/ |title=Página Institucional de la Universidad Alas Peruanas |accessdate=25 April 2012 |work=Dónde estamos}}</ref>'''<br />
| 2004<br />
| 9743<br />
| Lima<br />
|-<br />
| align="left" |&nbsp;'''José Carlos Mariátegui University<ref name="mariategui">{{cite web |url=http://www.universidadmariategui.com/universidadmariategui.html |title=Página Institucional de la Universidad José Carlos Mariategui |accessdate=25 April 2012 |work=La Universidad |language=Spanish}}</ref>'''<br />
| Maestría en Ingeniería del Software Aplicada<br />
| –<br />
| Lima<br />
|-<br />
| align="left" |&nbsp;'''Néstor Cáceres Velásquez University<ref name="uncv">{{cite book |url=http://www.uancv.edu.pe/archivo/memoria2011.pdf |title=Memoria Institucional 2011}}</ref>'''<br />
| 2006<br />
| 1038<br />
| Puno<br />
|-<br />
| align="left" |&nbsp;'''Technological University of Peru<ref name="utparequipa">{{cite web |url=http://www.utpaqp.edu.pe/index.php?option=com_content&task=view&id=15&Itemid=60 |title=Página Institucional de la Universidad Tecnológica del Perú Arequipa |accessdate=25 April 2012|work=UTP Arequipa |language=Spanish}}</ref>'''<br />
| 2007<br />
| 1201<br />
| Lima<br />
|-<br />
| align="left" |&nbsp;'''San Pedro Private University{{citation needed|date = April 2012}}'''<br />
| 2010<br />
| –<br />
| Chimbote<br />
|-<br />
| align="left" |&nbsp;'''University Los Angeles de Chimbote'''<br />
| 2009<br />
| 344<br />
| Chimbote<br />
|-<br />
| align="left" |&nbsp;'''University of the Sea<ref name="mararequipa">{{cite web |url=http://larevista.aqpsoluciones.com/2011/08/06/carrera-en-prevencion-de-riesgos-y-medio-ambiente-en-arequipa/ |title=Carrera en Prevención de Riesgo de la Universidad del Mar |accessdate=25 April 2012}}</ref>'''<br />
| 2009<br />
| –<br />
| Chile<br />
|-<br />
! colspan="4" style="color:gray" |<br />
<small>'''Source:''' Second National Census of Universities (2010)</small><br />
|}<br />
<br />
== Culture ==<br />
Arequipa culture is marked by the regionalism of its inhabitants. Arequipa, unlike other big Peruvian cities with mestizo and indigenous features, has been highlighted as a "Spanish island in an indigenous sea", resulting in regional cultural features more clearly defined than in the rest of Peru, being described both culturally and geographically as a cultural and natural oasis.<ref name="love4p">{{harv|Love|1995|p=4|sp=sí}}</ref> This important Spanish presence is documented by many historians and chroniclers such as Ventura Travada y Córdova:<br />
<br />
{{blockquote|«El número de gentes de esta ciudad es apenas 30.000... los negros, mulatos y otros apenas llegan a 6000, todos los demás son españoles, muchos de ellos de conocida nobleza, porque esta ciudad es de las que sobresalen en el reino de gente española cuya sangre procuran no degenerar, celebrando muchos casamientos con españoles llamados huampos. [Estos españoles] al instante que arriban a este reino se aplican al comercio mercantil porque generalmente es uno de los empleos más honrosos...»|Ventura Travada y Córdova<ref name=ventura&travada/><br />
<br />
}}<br />
<br />
Unlike other regional sentiments within Peru, Arequipa's regionalism was connected to the fight against centralism:<br />
<br />
{{blockquote|«En contraste con otros regionalismos peruanos, especialmente el del Cusco con su singular legado de haber sido la capital del Imperio Incaico, el sentimiento regionalista arequipeño estaba conectado a la lucha contra la política centralista de crear un Estado moderno, alternativa creíble para el centralismo limeño. El regionalismo arequipeño ha logrado evitar ser despedido como un mero provincianismo. Critíca a la política descentralista esfuerzo sobre la base de una reserva de locales, el lugar específico de las imágenes como capital simbólico para validar el éxito material de las clases dominantes regionales.»|Thomas Love, ''Redefining Identity, Maintaining Control in Southwestern Peru''<ref name=love1p>{{harv|Love|1995|p=1|sp=sí}}</ref>}}<br />
<br />
This proud [[Regionalism (international relations)|regionalism]], expressed in numerous insurrections or revolutions that have earned the city the nickname "Ciudad Caudillo" (Warlord City) or better explained by Peruvian historian Jorge Basadre: "Arequipa is a gun pointed at the heart of Lima ', when making a reference to the antagonism between both cities.<ref name="guillemete3p" /><br />
<br />
=== Dialect ===<br />
An element of culture in Arequipa City is its Spanish dialect that incorporates a distinctive rhythmic way of speaking, which usually elongates the last vowel of the final word in each sentence. Spanish language in Arequipa, also incorporates several Quechua words, besides the use of the [[Voseo|voseo.]]<br />
<br />
==== Voseo ====<br />
[[File:Mapa - Paises voseantes.png|thumb|right|Map showing Arequipa]]<br />
Many sources agree that the province of Arequipa is the representative area of Peruvian [[voseo]],<ref name="guajardo15p">{{harv|Guajardo Castro|2009|p=15|sp=sí}}</ref><ref name="carricaburo36p">{{harv|Carricaburo|1997|p=36|sp=si}}</ref> that is, the use in Spanish language of the pronoun 'vos' to replace the use of 'tú' or 'usted' (all meaning the pronoun 'you'). In Peru, the voseo is sometimes heard only in rural areas except in Arequipa, where that way of speaking is heard in both rural and urban areas.<ref name="voseoRAE">{{cite web |url=http://www.rae.es/dpd/?key=voseo |title=Diccionario Panhispánico de Dudas |accessdate=2 February 2009 |author=Real Academia Española de la Lengua |date=October 2005}}</ref><br />
<br />
==== Loncco ====<br />
It is a rural dialect of the city, has been largely lost due to migration from other provinces and the standardization of Castilian by the media in the capital, however, always in schools competitions are promoted lonccos poems.<br />
<br />
{{Quote box|border = 1px|align = left|quote = <poem style="margin-left: 4px"><br />
Dicen que los Lonccos somos rudos y vulgares,<br />
también que somos rústicos, toscos y ordinarios:<br />
pueden ponernos todos los apodos que truenen mal,<br />
comparamos con un desgastado cuchillo oxida'u.<br />
pero nunca nos quitaran nuestro modo de hablar.<br />
<br />
No importa, maqueseya cantando o quetimbiando,<br />
nuestro dejo es arequipeño, no es roto, guaso ni limeño.<br />
Loncco es el que madruga con el Lucero matutino,<br />
pa' tomar el primer bebe de agua del fresco manantial<br />
o el primer chorro de leche antes de mamanto del ternero<br />
</poem>}}<br />
<br />
{{Quote box|border = 1px|align = left|title = Excerpt from "Loncco" Felix Garcia Salas,<br/> "The Poet Loncco" of Arequipa|quote = <poem style="margin-left: 4px"><br />
Drolomm…drolóomm…<br />
dos clamores sonaron,<br />
allá en el campanario<br />
de mi pueblito solitario;<br />
dos clamores llorones<br />
que me ccajllaron l’alma,<br />
había muerto mi mama,<br />
la más guapa de las mamas.<br />
<br />
Y las gentes de la útra banda,<br />
chimbando el rio llegaban,<br />
y tuitos puel’alma rezaban<br />
de la qu’en vida jué mi mama”;<br />
tan güeña que era la finada,<br />
tuito el pueblo comentaba,<br />
y cada campanazo que sonaba,<br />
era pa’mí una puñalada.<br />
</poem>}}<br />
<br />
=== Visual arts ===<br />
<br />
Its principle is based or iconographic art of petroglyphs and pre-Columbian pottery. The site with more graphs in stone are the Toro Muerto has been the subject of many studies, most notably those of Dr. Eloy Linares Málaga and Dr. Antonio Núñez Jiménez Cuban.<br />
<br />
His second contribution is the Spanish state and Indo-American, who initially had applications in the size of walls, faces carved churches and altars, des painting appeared as mestizo, which is a naïve tried to recreate the Christian symbolism . The art of deep chiaroscuro, anatomical and ingenuity hieratic provisions lasted for many years since the European Renaissance failed hard because of geographical distance, but so that the increased media and travel advances and ado came to the third stage, which is the art academic and romantic, then arequipeñas wealthy families brought European art, mostly from France, England and Spain, the art, but not high-level teachers, gave the foundation for what would advance the fourth state of our history of fine arts, Carlos Baca Flor, Masias and Reynoso Vinatea preamble contemporary art [[Teodoro Núñez Ureta|Teodoro Nunez Ureta]], Ureta Alejandro Nunez and Luis Palao Berastain among youth of that based on the short edge new American realism and impressionism .<br />
<br />
After the fifth stage amorphous art, symbolist and other current and conceptual styles imported from North America and Europe with vertigo by mass media, among the master of this new era are Ramiro Pareja, Germán Rondon, Ricardo Córdova, the Evaristo and brothers Dario Callo Anco, Erick Huanca, Juan Carlos Zevallos, Companoca and other young master that currently contribute at various isms and boundaries of what is visual art. The Museum of Contemporary Art and the Museum of Arequipa Fundo del Fierro are good benchmarks.<br />
<br />
[[File:Pedro Paulet, padre de la Aeronautica.PNG|thumb|<br />
Pedro Paulet, scientist born in Arequipa in 1874, was one of the first to experiment with rocket propulsion.<br />
]]<br />
<br />
=== Gastronomy ===<br />
{{main|Arequipan cuisine}}<br />
The city has a great diversity of foods compared to many other parts of Peru, with a registered 194 varieties of dishes, which represent 40 entrees, 11 soups or lunches, 11 wines, 70 dishes, 51 desserts and 11 drinks.<ref name="cornejo44p">{{harv|Cornejo Velásquez|p=44|2010|sp=sí}}</ref> The cuisine of the city stands by the use of seasonings and preparation methods introduced by both Andean and Europeans,<ref name="internaXp">{{cite journal |title=El egasín, revista interna de Egasa |accessdate=18 August 2012 |author=Various authors |year=2011 |language=Spanish |url=https://docs.google.com/open?id=0B1WxBwWL6_X6VHlDQUwzTk1RNVU}}</ref> because many dishes were created to satisfy the tastes of Spanish merchants, soldiers and priests who had settled in Arequipa.<ref name="cornejo54p">{{harv|Cornejo Velásquez|p=54|2010|sp=sí}}</ref><br />
<br />
The eating habits are characterized by a slow diet for each day of the week, this fact shows that in most restaurants and picanterías gets used to prepare on Monday: Chaque, Tuesday: Chairo, Wednesday: Chochoca, Thursday: Suck Colorado or potato flour, Friday: Suck, Saturday: stew or Timpusca and Sunday: white broth or Pebre loins.<ref name="cornejo47p">{{harv|Cornejo Velásquez|p=47|2010|sp=sí}}</ref> This practice follows a global context where food has established fixed schedules and are respected by the population and most restaurants and picanterías city and moved to the availability of specific ingredients in local markets to meet demand according to the day of the week.<ref name="cornejo48p">{{harv|Cornejo Velásquez|p=48|2010|sp=sí}}</ref><br />
<br />
Among the most popular dishes are the shrimp Suck, Ocopa Arequipa, Rocoto filling Adobo Arequipa, Single cheese, potato cake, fried ribs, Cuy chactado, Cauche cheese, Locro pectoris, Chaque, among others. For dessert highlight the cream cheese, donuts, convent sweets, chocolates, and beverages such as, Chicha de Jora, the region anise (anise or aniseed liqueur).<ref name="cornejo58p">{{harv|Cornejo Velásquez|p=58|2010|sp=sí}}</ref><br />
<br />
=== Literature ===<br />
[[File:Vargas Llosa-PUC.jpg|thumb|right|Jorge Mario Pedro Vargas Llosa (Arequipa, Peru, 28 March 1936) Nobel Prize for Literature in 2010]]<br />
The identity of Arequipa literature is linked to the early nineteenth-century libertarians. [[Mariano Melgar]] is, in that sense, a compulsory reference, as to the quality of his lyrics, his example and his vital attention to the themes and modes land drew the line that would guide the creative writing in his hometown. In the mid-nineteenth century, the poetic voices from Benito Bonifaz, Manuel Castillo, José Mariano Llosa, Ignacio Gamio, among others, gave prestige to the letters Arequipa. Later that century, the novel George, the son of the village (1892), Maria Nieves and Bustamante, on the line of Victor Hugo, in the opinion of Luis Alberto Sanchez, gave us in his interesting 'Introduction', some signs preciosistas White City.<br />
[[File:Mariano Melgar.jpg|thumb|right|Lorenzo Mariano Melgar Valdivieso, Peruvian poet and revolutionary independence]]<br />
<br />
Poetry is heading towards the teaching of [[Manuel González Prada]] vibrant, and there are poems full of ideas and concepts Jorge Polar, philosopher and jurist, author of Arequipa. Description and social studies (1891), whose statement: "Years Arequipa has fought bravely to win free institutions for the Fatherland. Not born in vain at the foot of a volcano ", summarizes the feeling that inaugurated [[Mariano Melgar]] and that in one way or another, is present in Arequipa literature of the nineteenth and much of the twentieth, and the romantic voice of Francisco Mostajo, popular leader, who openly criticized the prevailing tone and advocated without success, the vital airs of modernism in its statements to the wind, 1908.<br />
<br />
The twentieth century imposes rhythm and casually characteristic of youth. In this area appears Group The Coven, with distinctly modernist aspirations. Their representatives make up a generation varied, but a common concern for change. They are in their ranks: Percy Gibson, Cesar Rodriguez Atahualpa, and Renato Federico Morales Agüero Well Rivera. This group Arequipa, sort of "colónidos" (Colónida group of Lima, founded by [[Abraham Valdelomar]] in the decade of 10), to which are added the poets featured Alberto Guillen and Alberto Hidalgo latter a vanguard that has not yet received the recognition it deserves, assumes a freer language, away from the prevailing rhetoric and romantic. His affiliation would be closer to some avant-garde notions.<br />
<br />
The gathering is organized in the halls, and the talents of the poets of the time are not indexed for arequipeño masterfully, but [[Abraham Valdelomar|Valdelomar Abraham]], who evokes an evening of 1910 in the article "The throne of the sun. Notes of a journey." The Conde de Lemos highlights in it to Percy Gibson author of the verses of the famous waltz Melgar, who put music Benigno Ballon, who invites Colónida write in the journal.<br />
<br />
In this Gibson he published the poem "Democratic Gospel":<br />
<br />
{{Quote box|Revista Colonida – Percy Gibson, «Evangelio democrático» |border = 1px|align = left|quote = <poem style="margin-left: 4px"><br />
¡Yo soy arequipeño del cogollo,<br />
valeroso, nervudo, de meollo/ volcánico,<br />
fantástico, potente<br />
y lo mismo que yo es cualquier criollo!...</poem>}}<br />
<br />
For its part, the paradoxes Tower (1926), Cesar Rodriguez Atahualpa, which pays homage to his homeland, as well as his "Song of Arequipa" (1918), set the tone of the regionalist pride to which we have referred at the beginning. This group accounted mamuel happened that Gallego Sanz, brothers Jorge and Xavier Bacacorzo and Guillermo Mercado (1904–1983), the latter poet who started within indigenismo and published, among other books, Golden Soul (1925) A chullo of poems (1928) and Song of Sachaca (1940). The prose had its greatest exponent in the first half of the twentieth century, in the figure of Augusto Morales Aguirre (1888–1957), who left as proof of his masterly novel The People of the sun (the first is around 1924), which managed continental resonance. His works include Dream Flower (1906) and Prayer (1913), poems, and Justice of Huayna Capac (1919), novel.<br />
<br />
Scholar and journalist, Aguirre Morales worked in newspapers and Universal Chronicle. Among his contemporaries are Juan Manuel Osorio and Juan Manuel Polar. Later, Arequipa also produce a noted literary critic, internationally recognized, Enrique Cornejo Quea (1936–1996) who applied the concept so sharply of "diversity" in American literary studies. Born in Arequipa in 1931, Oswaldo Reynoso released in 1961, "The innocent stories", and in 1964, the novel "In October there are no miracles, who have had multiple reprints. Owner of a poetic prose breath, then posted The beetle and man "(1970)", In search of Aladdin "(1993) and" The eunuchs immortal "(1995). But undoubtedly the most renowned Arequipa in the field of letters is [[Mario Vargas Llosa]] (1936), [[Anexo:Premio Nobel de Literatura|Nobel Prize for Literature in 2010]] and author among other texts ''of the Hero'' (1964), ''The Green House'' (1966), ''The War of the End of the World'' (1981), ''The Feast of the Goat'' (2000) and inspired by the life of [[Flora Tristan]], ''The Paradise on the other corner'' (2003).<br />
<br />
Arequipa maintains an intense literary life, to mention a few names of different generations, quote Jose Ruiz Rosas, poet who, although born in Lima (1928), developed his poetic valuable in the city of Arequipa and currently resides in this, among others, the poems Grocery (1978), Poems (1980), gathered Poetry (1992) in the White City; Oswaldo Chanove (1953), poet, author of The Hero and his relationship with the heroine (1983), Study on the action and passion (1987) y.el Pale Rider (1994), or Carlos Herrera (1961), the original focus narrator who posted black and white (1995) and blind Argonaut Chronicles (2002).<br />
<br />
=== Museums and cultural centers ===<br />
[[File:Teatro Municipal de Arequipa Pano.jpg|thumb|right|Teatro Municipal de Arequipa, built in commemoration of the fourth centenary of the Spanish founding of Arequipa]]<br />
Cultural events are mainly in the cultural institutes, organizations such as the Alliance Française, the Peruvian Center for German and Peruvian North American Cultural Center organized activities around the arts, music, dance and literature, among others. Meanwhile, the Centro Cultural de la Rosa Chaves National University of San Agustin and the Catholic University of Santa Maria promote cultural activities.<ref name="López53p">{{harv|sp=sí|López de Romaña|2006|p=53}}</ref><br />
<br />
In the 1990s banking institutions showed great interest in promoting and managing cultural activities, private companies, meanwhile, joined this movement by sponsoring various projects.<ref name="López54p">{{harv|sp=sí|López de Romaña|2006|p=54}}</ref><br />
<br />
* '''Cathedral Museum'''<ref>[http://www.andina.com.pe/espanol/Noticia.aspx?id=rx/v4rI7Em4= Andina: New Museum of Arequipa Cathedral opens its doors]</ref><br />
* '''Virtual Hall of Arequipa,'''<ref>Provincial Municipality Virtual Room Arequipa</ref> located at the "Gateway to the City" are contained several aspects of urban town of the historic center of Arequipa, more precisely the area that has been declared as a World Heritage Site and some nearby; here shows the evolution of the architecture over time arequipeña.<br />
* '''Regional Museum of the Central Reserve Bank.'''<ref>Andean [http://www.andina.com.pe/Espanol/Noticia.aspx?id=vo4syk8tHsM= BCR Museum].</ref> The center has a numismatic room, where you can see notes and coins that were minted in the Central Reserve Bank of Arequipa in the sixteenth and seventeenth centuries. The museum also has a gallery comprising 17 eighteenth-century paintings of the Cusco School, and archaeological pieces in metal and ceramics from the Chavin, Chimu, Moche, Viru, Recuay, Nasca and Inca.<br />
* '''Archaeological Museum José María Morante'''<ref>[http://www.unsa.edu.pe/index.php?option=com_content&amp;view=article&amp;id=344&amp;Itemid=347 UNSA Museum]</ref><br />
* '''Archaeological Museum of the University of St. Augustine''', located in a seventeenth-century mansion, the museum exhibits a varied collection comprising lithic, bone remains of human sacrifices, pottery elementary and pre-Columbian textiles.<ref name="López54p" /><br />
<br />
[[File:Mac arequipa.jpg|left|thumb|right|Virtual Hall of Arequipa, located in City Hall, opened in June 2003]]<br />
* '''UCSM Archaeological Museum,'''<ref>[http://www.deperu.com/arqueologia/museos2.html Guide Museums: Archaeological UCSM]</ref> displays about 1000 objects developed different cultural groups in the region from 12 000 a year.&nbsp;C. until the colony: Nasca, Tiahuanaco, Wari, Churajón, Acari, Aruni and Inca, and colonial and transitional material.<br />
* '''Andean Sanctuaries''' Museum of the Catholic University of Santa Maria, was created on 26 March 1997, following the significant archaeological research by Project 'height Sanctuaries Southern Andes ", led by Professors [[Johan Reinhard]] and Jose Antonio Chavez.<ref>{{cite web |author=Universidad Católica de Santa María |title=Museo Santuarios Andinos |url=http://www.ucsm.edu.pe/santury/|accessdate=22 September 2012}}</ref> In this museum is the Mummy Juanita who was sacrificed on Mount Ampato, despite being an attractive displays, museum work has been questioned.<ref name="López54p" /><br />
* Numismatic Museum<br />
* '''Museum of Contemporary Art,'''<ref name="López55p">{{harv|López de Romaña|p=55|sp=sí|2006}}</ref> is devoted to painting and photography from 1900 onwards, houses an interesting collection of twentieth-century art, photography and exhibitions of Miguel Vargas and Carlos Vargas, Cusco photographer Martin Chambi, was mentor of the two brothers, that through his work documenting daily life and customs of the city of Arequipa twentieth-century. Also on display are works by young local artists, paintings [[Fernando de Szyszlo|of]] Peruvian artists like [[Fernando de Szyszlo|Fernando]] and [[Carlos Enrique Polanco]] [[Fernando de Szyszlo|Szyszlo]], Ramiro Llona, José Tola, Gerardo Chavez, Natalia Iguíñiz, Jaime Higa, Light Letts, Carlos Runcie Tanaka, Amelia Weiss, Claudia Cuzzi and Venancio Shinki.<br />
* '''Museum of Natural History,'''<ref>[http://museohn.unmsm.edu.pe/ Natural History Museum]</ref> located in the metropolitan district of Yanahuara, under the administration of the convent of La Recoleta.<br />
* '''Museo de Santa Catalina'''<ref>[http://www.santacatalina.org.pe/ Museum of Santa Catalina]</ref><br />
* '''Graphic Museum Gazette,''' the house museum located in Bolivar, it shows the evolution of writing from cave paintings to the first printing presses and machinery involved in the production process of official gazette '''El Peruano.''' In this museum you can see the resolution of Arequipa passport and Original Declaration in which Arequipa is declared on 4 September 1882 as "Capital of Peru".<br />
* Colonial Art Museum Santa Teresa<br />
* Columbian Museum La Recoleta<br />
* Chiribaya Culture Museum<br />
* '''The Amazonian Museum,''' located in the district of Yanahuara exhibiting objects from the activity of the missionaries in the jungle during the XVI, XVII, XVIII.<br />
* '''Forestry Museum Ecological Police,''' this museum located in the metropolitan district of Paucarpata has a sample of more than 300 animal species of Peruvian wildlife, especially the one in danger of extinction. Also has 35 live animals.<br />
<br />
=== Music ===<br />
Since late viceroyalty there are important academic composers like [[Mariano Melgar]] (who was best known in his role as poet), Pedro Jiménez Tirado April and Florentino Diaz is apparently coming to Arequipa one of the cities in the country with more of the best composers and musical training.<ref name="musica">{{cite book |author=Patronato Popular y Porvenir Pro Música Clásica |title=La Música en el Perú |year=1985|work=Lima, Perú: Patronato Popular y Pro Música Clásica|page=121|url=http://books.google.com.pe/books?ei=fgMqT5m1IJDUgQeI6vnQDw&id=fMxbAAAAMAAJ&dq=la+musica+en+el+peru&q=parece+ser+Arequipa#search_anchor}}</ref><br />
<br />
In the Republican era include Manuel Aguirre who assimilated the teachings of Chopin and Schuman to give them some melanconlia and simplicity to his music. Similarly, Luis Duncker Lavalle-a master pianist who can speak both academic folk-music as Octavio Polar, Manuel Aguirre, David H. Molina, who spread his orchestral works with the Association of Arequipa and Aurelio Diaz Espinoza who was author of the Hymn of Arequipa. Also, with a more modernist highlights Carlos Sanchez Malaga. Later in the twentieth century include Roberto Ramirez-Ortiz Zevallos, Roberto Carpio Valdez, Juan Francisco Ballon Ballon, Armando Sanchez-Málaga and Benigno Ballón Farfán González, author of numerous yaravíes, sailors and popular waltz ''Melgar.''<ref name="garayar65p">{{harv|Garayar|p=65|2004|sp=sí}}</ref><br />
<br />
=== Symbols ===<br />
<br />
==== Coat of arms ====<br />
Nearly a year after the founding of the town, King [[Charles V, Holy Roman Emperor|Charles I of Spain]] elevated it to the rank of [[city]] by royal decree on 22 December 1540, awarding it a coat of arms on which a mythical animal carries a banner with the inscription ''Karlos V'' or ''Del Rey.''<ref name="palma30p" /> Peruvian writer [[Ricardo Palma]] in his ''Peruvian Traditions,'' explains the position and meaning of some components in the shield based on the report of a chronicler with knowledge of heraldry. In Palma's tradition of ''"The godson of providence"'', it is explained:<br />
<br />
{{blockquote|«Such Democrat who writes this —understands nothing of Heraldry— Thus listen to the explanation of such allegory, that a chronicler gives: Says he, that the inscription of the flag; expresses the way in which the King took possession of Arequipa, that when he placed that One(flag)— not under the feet but in the hand of "The Griffin"— so wished the monarch to manifest his appreciation for the city; not stepping on her like a servant one, instead giving her a hand as a favored one. If there exists one who explains this better, his finger he may raise...(English translation)»|'''Ricardo Palma''', ''Tradiciones Peruanas''<ref name=palma30p/>}}<br />
<br />
==== Flag ====<br />
The origin of the crimson flag of the city has been a subject of debate among historians. In 1940 various scientific publications such as those by historians Francisco Mostajo and Victor M. Barriga firmly confirmed the crimson color of the banner, as opposed to the blue banner proposed as the original by historian Victor Benavente. This matches the color used in sports activities in the city.<ref name="galdos246p">{{harv|Galdós Rodríguez|p=246|1997|sp=sí}}</ref><nowiki> On September 2, 1940, Francisco Mostajo sent a letter to the Mayor of the City to explain his views regarding the color of the Banner of Arequipa, basing his claims on the '</nowiki>''Act of the oath of King Carlos III'' ''" of'' 11 August 1788. On September 23 of the same year, Father Victor M. Barriga also published an important document in the Catholic newspaper ''El Deber'' that contains a description of the royal standard of Arequipa found in the ''"Act of 3 September 1789".''<ref name="neira354p">{{harv|Neira|p=354|1990|sp=sí}}</ref><br />
<br />
Both of these documents state that the standard color is crimson and that its origins date back to the colonial flag of the city, which is described as cited:<ref name="neira356p">{{harv|Neira|p=356|1990|sp=sí}}</ref><br />
<br />
{{blockquote|«(For the Celebration of the Royal feasts of Proclamation and the Oath of the King Sir Carlos IV. The illustrious Council had mandated to make in advance —a new crimson velvet emblem with the Royal coat of arms and the city coat of arms adorned with gold overlay— which was fastened to an exquisitely carved mast, which culminated in a spear head; thereof hanged two crimson silk cords with tassels thus completing an exquisite ensemble. A canopy: with throne cloth panels, pillows and bench covers with both fringe and tassels of gold.) Para la celebración de las fiestas reales de proclamación y jura del rey don Carlos IV, había mandado el Ilustre Cabildo hacer con anticipación un nuevo estandarte de terciopelo carmesí, con los escudos de Arreas Reales y de la Ciudad, guarnecido de sobrepuesto de oro, el cual estaba asido de una asta primorosamente labrada, rematando ésta en una lengueta de espolón, desde cuya garganta pendían dos cordones de seda carmesí con sus borlas, que hacían primoroso juego. Un dosel, paños de sitial, cojines y sobrebancas con flecos y rapacejos de oro.»|''Juramento, proclamación y fiestas populares que hicieron celebrar en esta ciudad el Intendente D. Antonio Álvarez y Jiménez y el Alférez Real D. Manuel Flores del Campo en homenaje al Rey Carlos IV, con motivo de su exaltación al trono de España (Oath, Proclamation and Popular feasts whom mandated to celebrate in this city the Foreman D. Antonio Álvarez y Jiménez and the Royal Ensign D. Manuel Flores del Campo in homage to the King Carlos IV on the occasion of his exaltation to the throne of Spain) ''<ref name=galdos245p>{{harv|Galdós Rodríguez|p=245|1997|sp=sí}}</ref>}}<br />
<br />
==== Anthem ====<br />
The anthem of the city is called the ''Fourth Centenary Anthem.'' It was written by Emilio Pardo Valle with music by Aurelio Diaz Espinoza, who won a contest organized by the city council in 1939 for the creation of the music and lyrics of the anthem. The award was given in 1940 and the hymn has been sung ever since at all important civic events held in the city.<ref name="himno">{{cite book |url=http://books.google.com.pe/books?id=YDplAAAAMAAJ |title=Arequipa: su pasado, presente y futuro |accessdate=17 September 2009 |author=Adela Pardo Gamez de Belaunde |date=20 February 2002 |format=PDF |language=Spanish}}</ref><br />
<br />
==== Names and Honorific Titles ====<br />
'''Very noble and very loyal'''<br />
Arequipa was one of the cities of the [[Viceroyalty of Peru]] that received frequent and intense praise for its weather and its loyalty<ref name="historia">[http://sisbib.unmsm.edu.pe/BibVirtual/libros/Literatura/melgar/en_arequipa.htm History and legend, Mariano Melgar]</ref> Among the praises for the city found in the literature is a reference in the play "[[La Galatea]]" by classic Spanish writer Miguel de Cervantes Saavedra, who mentions that the Spanish poet Diego Rivera Martinez, having been to Arequipa, praised the city<ref name="historia" /> with the phrase "In Arequipa, eternal spring".<ref>Miguel de Cervantes Saavedra. La Galatea, The song of Calliope, Madrid (1585), the reference to Martinez de Ribera, in 66 and 67 octaves.</ref><br />
<br />
The city was also awarded various distinctions and titles by the Spanish Crown such as its Coat of Arms and the titles of Very Noble and Loyal, Faithful, and the treatment of Excellence.<ref name="neira226p">{{harv|Neira|p=226|1990|sp=sí}}</ref><br />
<br />
'''Most Faithful'''<br />
One aspect that distinguished Arequipa from other areas of Peru and Lima in particular is the explicit public commitment of the city to the Spanish crown and the close following of its directives. This phenomenon was called "fidelism" and had some notable defenders in Francisco de Paula Quiroz, Mariano de Rivero, Nicólas Fernández, and José Miguel de Aubrey. Since its Spanish foundation and over three centuries the city was mostly inhabited by families of Spanish origin. One reason that contributed to maintaining and strengthening fidelism was obviously the prevalence of Spanish people in high society and their representative organizations.<ref name="caceres128p">{{harv|Cáceres-Péfaur|2006|sp=sí|p=128}}</ref> Another factor was geographical because given the city's location it was not likely to be influenced by regions with libertarian movements or by areas with large concentrations of indigenous people.<ref name="caceres128p" /><br />
<br />
The ruling classes and city leaders were always faithful and loyal to the Spanish crown during the sixteenth and seventeenth centuries. In the eighteenth century, upon the rise of movements and rebellions from the indigenous and mestizo population, Arequipa retained its political balance. During the Tupac Amaru II uprising the city assembled at its own expense a column of troops that helped destroy the siege of the city of La Paz.<ref name="neira227p">{{harv|Neira|p=227|1990|sp=sí}}</ref> This earned the city the epithet of "Restorative province of the Collao ». For these services the King Carlos IV also issued a royal decree in the city of San Lorenzo on 5 December 1805 in which he conferred the title and the name of "Most Faithful" to the city.<ref name="neira228p">{{harv|Neira|p=228|1990|sp=sí}}</ref><br />
<br />
'''Excellence '''The city received a treatment of "excellence" by a royal decree issued in the city of Madrid on 16 November 1818. This distinction was granted following reports submitted by Don Hipólito Unanue, deputy of the province of Arequipa and the Municipality of the city, of Arequipa's involvement in defending the royal cause in the uprising of the city of La Paz in 1809.<ref name="neira228p" /><br />
<br />
'''Heroic City of the Free'''<br />
In the republican era, a decree issued by General Orbegoso ordered that the department and its capital city be denominated "Department of Law" and "heroic city of the free".<ref name="neira438p">{{harv|Neira|p=438|1990|sp=sí}}</ref> General Orbegoso installed his government in Arequipa in 13 January 1835 and, as a consequence, General [[Felipe Santiago Salaverry]] named himself Supreme Chief of the Republic with the pretext that the country was leaderless, i.e. without President, as Orbegoso was outside the capital of Lima.<ref name="congreso.gob.pe">[http://www.congreso.gob.pe/museo/mensajes/a-Mensaje-1835-1.pdf Decree assuming command of the Republic General Felipe Santiago Salaverry, February 25, 1835] .</ref><br />
<br />
== Sports ==<br />
Among the scenarios that the city has for the practice of football we mention Virgen de Chapi Stadium (property of San Agustin National University), [[Estadio Mariano Melgar|Mariano Melgar Stadium]], Los Palitos Stadium and Umacollo Stadium.<br />
<br />
=== Soccer ===<br />
Association football or Soccer is the most popular sport in Arequipa, with the most popular team being Melgar F.C. This team currently plays in the Peruvian [[Peruvian Primera División|First Division]] of association football, winning its first national championship in 1981.<ref name="almanaque2002">{{cite book |authorlink= http://www.inei.gob.pe |title=Almanaque de Arequipa 2002 |url= |editor=INEI |page=169}}<!--|accessdate=3 August 2012--></ref><br />
<br />
== Law and Government ==<br />
Arequipa, as the capital of the [[Arequipa Province|province]], is governed by the Provincial Municipality of Arequipa that has jurisdiction over the entire territory of the province. The district municipalities within the province also have jurisdiction over matters relating to their own districts.<br />
<br />
The city, as the regional capital, is home to the ''Regional Government of Arequipa.'' It is also headquarters of the different regional offices of [[Council of Ministers of Peru|ministries]] that make up the Civil Government of Peru.<br />
<br />
=== City administration ===<br />
<br />
The Provincial Municipality of Arequipa regulates important citywide, metropolitan and [[Arequipa Province|provincial]] issues like urban planning, [[transport]], municipal [[tax]] collection, management of road safety (jointly with the [[Municipal police (Spain)|local police]]), the maintenance of public roads and urban greenery, etc. It is also responsible for the construction of municipal facilities such as sports centers, libraries and social services centers.<ref name="reglamento1p">{{cite journal |author=Municipalidad Provincial de Arequipa |title=Reglamento Interno del Concejo de la Municipalidad Provincial de Arequipa |publisher=Información General de la Municipalidad Provincial de Arequipa |url=http://www.muniarequipa.gob.pe/transparencia/informacion_general/Reglamento%20Interno%20del%20Concejo.pdf |accessdate=19 August 2012 |language=Spanish}}</ref><br />
<br />
{| class="wikitable" style="text-align:center; width:80%;"<br />
|+<br />
<nowiki> </nowiki>List of mayors of Arequipa in recent years<br />
!<br />
Period<br />
!<br />
Mayor<br />
!<br />
Political party<br />
|-<br />
|1994–1995<br />
|Fernando Sebastián Ramírez Alfaro<br />
|Neighborhood Unity Front<ref>{{cite web |url=http://www.infogob.com.pe/Localidad/ubigeoprocesodetalle.aspx?IdUbigeo=040100&IdTab=0&IdProceso=50 |title=Detalles del Proceso Electoral – Elecciones Municipales de 1993 |accessdate=27 August 2012 |authorlink=http://www.jne.gob.pe/ |editor=Observatorio de la Gobernabilidad |work=Jurado Nacional de Elecciones |language=Spanish}}</ref><br />
<br />
|-<br />
<br />
|1996–1998<br />
|Roger Luis Caceres Peréz<br />
|FRENATRACA<ref>{{cite web |url=http://www.infogob.com.pe/Localidad/ubigeoprocesodetalle.aspx?IdUbigeo=040100&IdTab=1&IdProceso=43 |title=Detalles del Proceso Electoral – Elecciones Municipales de 1995 |accessdate=27 August 2012 |authorlink=http://www.jne.gob.pe/ |editor=Observatorio de la Gobernabilidad |work=Jurado Nacional de Elecciones |language=Spanish}}</ref><br />
<br />
|-<br />
<br />
|1999–2002<br />
|Juan Manuel Guillen Benavides<br />
|Arequipa.Tradition and future<ref>{{cite web |url=http://www.infogob.com.pe/Localidad/ubigeoprocesodetalle.aspx?IdUbigeo=040100&IdTab=1&IdProceso=37 |title=Detalles del Proceso Electoral – Elecciones Municipales de 1998 |accessdate=27 August 2012 |authorlink=http://www.jne.gob.pe/ |editor=Observatorio de la Gobernabilidad |work=Jurado Nacional de Elecciones |language=Spanish}}</ref><br />
<br />
|-<br />
<br />
|2003–2006<br />
|Peyson Yamel Romero Peralta<br />
|APRA<ref>{{cite web |url=http://www.infogob.com.pe/Localidad/ubigeoprocesodetalle.aspx?IdUbigeo=040100&IdTab=1&IdProceso=03 |title=Detalles del Proceso Electoral – Elecciones Municipales de 2002 |accessdate=27 August 2012 |authorlink=http://www.jne.gob.pe/ |editor=Observatorio de la Gobernabilidad |work=Jurado Nacional de Elecciones |language=Spanish}}</ref><br />
<br />
|-<br />
<br />
|2007–2011<br />
|Simon Balbuena Marroquín<br />
|[[Peruvian Nationalist Party|PNP]]<ref>{{cite web |url=http://www.infogob.com.pe/Localidad/ubigeoprocesodetalle.aspx?IdUbigeo=040100&IdTab=1&IdProceso=19 |title=Detalles del Proceso Electoral – Elecciones Municipales de 2006 |accessdate=27 August 2012 |authorlink=http://www.jne.gob.pe/ |editor=Observatorio de la Gobernabilidad |work=Jurado Nacional de Elecciones |language=Spanish}}</ref><br />
<br />
|-<br />
<br />
|2011–2015<br />
|Zegarra Alfredo Tejada<br />
|Arequipa Reborn<ref>{{cite web |url=http://www.infogob.com.pe/Localidad/ubigeoprocesodetalle.aspx?IdUbigeo=040100&IdTab=1&IdProceso=93 |title=Detalles del Proceso Electoral – Elecciones Municipales de 2010 |accessdate=27 August 2012 |authorlink=http://www.jne.gob.pe/ |editor=Observatorio de la Gobernabilidad |work=Jurado Nacional de Elecciones |language=Spanish}}</ref><br />
<br />
|-<br />
|}<br />
<br />
=== Seat of the Constitutional Court ===<br />
[[File:Grau Bridge, Zemanat, Arequipa.jpg|thumb|right|Grau Bridge View from the district of Selva Alegre]]<br />
{{main|Constitutional Court of Peru}}<br />
<br />
The Constitutional Court is the highest authority and control interpretation of the Constitution. It is autonomous and independent of other constitutional bodies. Subject only to the Constitution and the Organic Law. The court has seven judges elected by the Congress with the favorable vote of at least two thirds of the legal number of members for a period of five years.<br />
<br />
The city is the ''"Legal Capital of Peru"'' and ''"Official Headquarters of the Constitutional Court",''<ref name="coaguila4p">{{harv|Coaguila Valdivia|p=4|2010|sp=sí}}</ref> as a result of a project decentralist the first vice presidential candidate, Manuel Seoane Corrales, who proposed the initiative of the city of Arequipa was the headquarters of the Superior Court of Justice, which would make the city was the Legal Capital of Peru. Due to the military coup that began in Peru, the initiative was in the air, to be reborn after the election of the Constituent Assembly in 1978. This time, the initiative did not succeed due to the high opposition, but later concluded that Arequipa would host the then "Constitutional Court", as stated in Article 304 º of the Constitution of Peru, 1979: ''"The Constitutional Court is based in the city of Arequipa ".''<ref name="juridica04">{{cite web |url= http://www.mariorommelarce.com/portal/la-tradicion-juridica-de-arequipa/ |title=La tradición jurídica de Arequipa |accessdate=3 August 2012 |last=Rommel Arce |first=Mario}}</ref><br />
<br />
Later, by the Constitution of 1993, created the "Constitutional Court", which, according to its Charter, is based in Arequipa, although under Regulation Regulatory Constitutional Court.<ref name="tribunal2p">Regulation Regulatory Constitutional Court, p. 2.</ref><br />
<br />
=== Administrative division ===<br />
The city is bounded by the district lines that comprise his constituency, the figure for the same population of the city is not adjusted to the total population of the districts that could be partially or fully recitals within the city, as RENIEC entities considered that the city is divided into 15 administrative districts, coordinated by the provincial municipality, which in turn are subdivided into [[district]]s,<ref>{{cite web |url=http://www.reniec.gob.pe/portal/html/estadistica/images/GG08_PobElec_Ciudad_Arequipa.pdf |title=Distritos de Arequipa |editor=RENIEC |accessdate=11 July 2012}}</ref> however INEI uses other methodologies for the delimitation of the city.<br />
<br />
<center><br />
{| class="wikitable sortable" style="float:center;text-align:center;clear:all;margin-left:25%;font-size:84%" border="1" cellpadding="0" cellspacing="1" width="50%"<br />
<br />
! align="center" width="20" |<br />
<nowiki> </nowiki>No.<br />
! align="center" width="150" |<br />
<nowiki> </nowiki>District<br />
! align="center" width="20" |<br />
<nowiki> </nowiki>No.<br />
! align="center" width="150" |<br />
<nowiki> </nowiki>District<br />
|-<br />
| align="center" | 1<br />
| align="center" | [[Arequipa District|Downtown]]<br />
| align="center" | 7<br />
| align="center" | Paucarpata<br />
|-<br />
| align="center" | 2<br />
| align="center" | Cayma<br />
| align="center" | 8<br />
| align="center" | James Hunter<br />
|-<br />
| align="center" | 3<br />
| align="center" | [[Cerro Colorado District|Cerro Colorado]]<br />
| align="center" | 9<br />
| align="center" | Miraflores<br />
|-<br />
| align="center" | 4<br />
| align="center" | Sachaca<br />
| align="center" | 10<br />
| align="center" | Tiabaya<br />
|-<br />
| align="center" | 5<br />
| align="center" | Yanahuara<br />
| align="center" | 11<br />
| align="center" | [[José Luis Bustamante District|JL Bustamante y Rivero]]<br />
|-<br />
| align="center" | 6<br />
| align="center" | Alto Selva Alegre<br />
| align="center" | 12<br />
| align="center" | [[Mariano Melgar District|Mariano Melgar]]<br />
|-<br />
| align="center" | 7<br />
| align="center" | Sabandía<br />
| align="center" | 14<br />
| align="center" | Socabaya<br />
|-<br />
! colspan="5" align="center" | <br />
<small>Source: National Institute of Statistics and Informatics </small><br />
|}<br />
</center><br />
<br />
==== Metropolitan area ====<br />
The metropolitan area is to head to the city and consists of 19 districts with metropolitan category,<ref name="muni23p2012">{{harv|García de los Reyes Arquitectos y Asociados|2012b|p=|sp=sí}}</ref> extends over a surface of {{convert|305798|acres|0|abbr = off}} of which {{convert|10142|acres|0|abbr = on}} are distinctly urban.<ref name="muni36p2012a">{{harv|García de los Reyes Arquitectos y Asociados|2012a|p=36|sp=sí}}</ref> A metropolitan level unemployment level reaches the level of 8%,<ref name="muni23p2012" /> in contrast to 5% unemployment in the city.<ref name="america2011" /><br />
<br />
== Sights and attractions ==<br />
<br />
=== The Old Town ===<br />
{{main|Historic Centre of Arequipa}}<br />
[[File:Centro Histórico de la ciudad de Arequipa (mapa).jpg|thumb|Map showing Arequipa]]<br />
In its 332 hectares<ref name="compendio80p"/> has 5817 properties<ref name="diagnostico39p">Provincial Municipality of Arequipa. "Diagnosis of the historic center of Arequipa", p. 39.</ref> of which 500 are categorized as heritage properties, generally have been built in the nineteenth century, on the site of earlier colonial buildings destroyed by the earthquake of 1868. The houses, usually made in [[ashlar]], are characterized by semi-circular arches and vaulted ceilings. Ashlar structures always have thick walls: 1 to 1.5 meters for rooms, 2 meters for churches. Through the use of lime mortar, the walls are shown homogeneous image that is reinforced with brick vaults or ashlar that are justified in the rarity of the wood.<ref name="diagnostico40p">Provincial Municipality of Arequipa. "Diagnosis of the historic center of Arequipa", p. 40.</ref><br />
<br />
In the city itself is a stylistic school called "School Arequipa" of crucial importance in the region and whose influence reached Potosi. This school is characterized by profuse decoration planiform textilográfica and the open spaces and the design and size of their covers, which differ in these aspects of Cuzco and Lima covers.<ref name="cristobal16p">{{harv|San Cristobal Sebastian|2009|p=16|sp=sí}}</ref><br />
<br />
The architecture in the historic center is characterized by the prominence of ashlar, the use of which begins in the last third of the s. XVI. This volcanic stone, white or pink exceptionally soft, lightweight, and weatherproof, emerged as a seismic structural solution. The ashlar was unable to take the early years, except for the covers of the main church and some houses. The original city was built with adobe, masonry, sticks and straw roofs or mud pie. Houses of this type were made until the nineteenth century and were common in the eighteenth century, some remain in the original district of San Lazaro. Later came the brick and tile houses with tile found in the Monastery of Santa Catalina. The cataclysm of 1582 settled these systems and raised the earthquake reconstruction. Then came the ashlar as prime structural solution.<ref name="diagnostico18p">Provincial Municipality of Arequipa. "Diagnosis of the historic center of Arequipa", p. 18.</ref><br />
<br />
Major earthquakes which milestones in the formation of Arequipa architecture. You can mention five periods:<br />
{{Columns<br />
|col1=* Founding and village (1540–1582),<br />
* Splendor of Baroque (1582–1784),<br />
* Rococo and Neoclassical Reviews (1784–1868),<br />
|col2=* Empiricism and modernizing<br />
* Evocations neo colonial (1868–1960) and<br />
* Contemporary.<br />
}}<br />
[[File:Cafes, San Francisco, Arequipa.JPG|thumb|right|San Francisco Street is one of the main places where since the 50s settled nightclubs, gourmet restaurants and bars refined]]<br />
[[File:Iglesiacompañia.jpg|thumb|right|Church of the Jesuits]]<br />
<br />
==== Religious Monuments ====<br />
[[File:Centro, Santa Catalina, Arequipa.jpg|thumb|right|Monasterio de Santa Catalina]]<br />
In historical existence is accounted for 14 churches or temples, four chapels, five convents and 3 monasteries,<ref name="diagnostico65p">Provincial Municipality of Arequipa. "Diagnosis of the historic center of Arequipa", p. 65.</ref> among the monuments of this type include:<br />
* [[Basilica Cathedral of Arequipa]]<br />
It is the most important neoclassical ediicio Peru, product reconstruction started in 1844 and finished three years later and led by architect Lucas Poblete.<ref name="humanity">UNESCO. History of Humanity, p. 221.</ref> Its interior is faced with trs ships with one of the side walls of the main square which fills a side façade is divided by Corinthian columns.<ref name="fergusson432p">{{harv|Fergusson|p=432|sp=sí|}}</ref><br />
<br />
* Church of the Company<br />
It is the monument maximum Arequipeña School,<ref name="benavides73p"/> is one of the most splendid creations of Peruvian Baroque and starting point of this school,<ref name="arellano256p">Arellano, p. 256.</ref> in its façade has an inscription inscribed with the year 1698 which shows that the beginning of the eighteenth century this regional art had reached its peak, therein lies a more exaggerated baroque altar.<ref name="benavides74p">{{harv|Benavides|p=74|1990|sp=sí}}</ref><br />
<br />
* [[Santa Catalina Monastery|Convent of Santa Catalina]]<br />
<br />
==== Civil-Public Monuments ====<br />
{{blockquote|«Pétrea ciudad adusta. Sólida trabazón de viviendas donde el sillar es símbolo de la psicología colectiva: roca y espuma; dureza y ductilidad. Amalgama de fuego, en que el aliento del volcán funde y anima las piedras y las almas»|José Luis Bustamente y Rivero (President of Perú 1945–1948)<ref name=elogio>José Luis Bustamante y Rivero ''Una visión del Perú. Elogio de Arequipa''. Ediciones P.L.V. Lima, 1972.</ref>}}<br />
There are 10 buildings that origin were engaged in civic purposes, such as Phoenix theaters. and the Municipal Theatre, the Goyeneche Hospital and the Hospital of Priests of St. Peter, bridges Bolognesi and Grau, the Instituto de la Rosa Chavez, Railway Station, Mercado San Camilo and the Molino de Santa Catalina.<ref name="diagnostico65p"/><br />
<br />
==== Military Monuments ====<br />
The historic center of Arequipa lacked a wall as we had the city of Lima, they persist despite military monuments as Twentieth Century Prison and Penal Fundo El Fierro women.<ref name="diagnostico66p">Provincial Municipality of Arequipa. "Diagnosis of the historic center of Arequipa", p. 66.</ref><br />
<br />
==== Civil-Domestic Monuments ====<br />
Within the historic center there are 246 houses were declared monuments household,<ref name="diagnostico65p"/> this type of construction is characterized by thick walls made solid as drawer, with arches and domes similar to those built in the temples and monasteries religious, giving the same robustness and monumentality to these constructions built from the seventeenth and eighteenth centuries and generally used for housing.<ref name="diagnostico18p"/><br />
{{Columns<br />
|col1=* Casa del Moral<br />
* Goyeneche Palace<br />
* Tristan del Pozo House<br />
* Mint<br />
* Casona Ugarte<br />
|col2=* House Irribery<br />
* House Arrospide<br />
* Casa del Alferez Flowers<br />
* Casona del Corregidor Maldonado<br />
* Casa del Corregidor April and Maldonado<br />
|col3=* Casona Goyeneche<br />
* House of Pastor<br />
* Bronze Tambo<br />
* Tambo of the Loggerhead<br />
* Tambo de Ruelas<br />
}}<br />
<br />
=== Parks and gardens ===<br />
In the historic center of the city's parks and squares for a total of 26 hectares of green areas that are complemented by {{convert|22|acres|0|abbr=on}} of countryside within this historic area,<ref name="diagnostico51p">Provincial Municipality of Arequipa. "Diagnosis of the historic center of Arequipa", p. 51.</ref> between the squares and parks include the following areas:<br />
{{Columns<br />
|col1=* ''Plaza de Armas''<br />
* ''Plaza San Francisco''<br />
* ''Grau Playground''<br />
* ''Biela Park''<br />
* ''Oval Miguel Grau''<br />
* ''Bolognesi Malecón''<br />
|col2=* ''Park 28 February''<br />
* ''Parque La Recoleta''<br />
* ''Recoleta park 1''<br />
* ''Recoleta park 2''<br />
* ''Juan Manuel Polar Oval''<br />
* ''Park The Poet''<br />
* ''Benigno Park Ballón Farfán''<br />
|col3=* ''Salta Park''<br />
* ''Dante Alighieri Park''<br />
* ''Martinetty Park''<br />
* ''Melgar Park''<br />
* ''South Institute''<br />
* ''San Camilo Plazoleta''<br />
* ''Duhamel Park''<br />
|col4=* ''Place 15 August''<br />
* ''Spain Square''<br />
* ''Plaza Santa Teresa''<br />
* ''Plaza Independencia''<br />
* ''Parque San Lazaro''<br />
* ''Park Hotel Libertador''<br />
* ''Selva Alegre Park''<br />
|col5=* ''Forest Selva Alegre''<br />
* ''Plaza San Antonio''<br />
* ''Romana Square''<br />
* ''Municipal Nursery''<br />
* ''Selva Alegre Playground''<br />
* ''International Club''<br />
}}<br />
<br />
Outside this monumental natural areas that stand out are the following:<br />
<br />
*Ecological Park of Alto Selva Alegre. is located in the middle of an urban area east of the city, right outside Cayma District and Rio Chili in the territory of the district of Selva Alegre. The park and surrounding areas occupy an area of 1008 hectares<ref name="naturalASA">{{cite web |url=http://www.andessperu.org/index.php?option=com_content&task=view&id=19&Itemid=48<br />
|title=Parque Natural de Selva Alegre |accessdate=28 July 2012}}</ref> of which 460 hectares covering only the ecological park.<ref name="ecologicoASA">{{cite web |url=http://miqueridaarequipa.blogspot.com/2008/06/los-gigantes-de-piedra-y-el-ltimo.html |title=Los gigantes de piedra en el Parque Ecológico de Alto Selva Alegre |accessdate=28 July 2012}}</ref> The back of the park is located in the buffer zone of the National Reserve of Salinas Aguada Blanca.<br />
*Fundo Paradise. is part of the Natural Park of Selva Alegre and occupies an area of 67 hectares<ref name="ecologicoASA"/><br />
*Chilina Valley countryside. is part of the Natural Park of Selva Alegre and occupies an area of 151 hectares<ref name="ecologicoASA"/><br />
[[File:Aristocracia, La Merced, Arequipa.JPG|thumb|right|Aristocracia, La Merced]]<br />
*Chilpinilla Metropolitan Park. 14 hectares<ref name="chilpinilla">{{cite web |url=http://www.docstoc.com/docs/26399276/AREQUIPA-Patrimonio-Cultural-de-la-Humanidad |title= Arequipa, Patrimonio Cultural de la Humanidad |accessdate=28 July 2012}}</ref><br />
*Military College Forest Park. 14 hectares.<ref name="parquebosque">{{cite web |url=http://amarengo.org/taxonomy/term/442?page=2 |title= Nuevo Bosque en Arequipa |accessdate=28 July 2012}}</ref><br />
*Selva Alegre Park. 20 hectares.{{Citation needed|date=December 2012}}<!-- Dead link<ref name="selvaalegre">{{cite web |url= |title= |accessdate=28 July 2012}}</ref>--><br />
<br />
=== Suburbs ===<br />
* Yanahuara Villa Hermosa, located {{convert|2|km|0|abbr=off}} from the city, famous for its churches built in Andalusian style alleys<ref>[http://www.muniarequipa.gob.pe/index.php?option=com_content&amp;view=article&amp;id=72&amp;Itemid=27 Provincial Municipality of Arequipa (Tourism)]</ref> which is Yanahuara Monumental Zone Cultural Heritage of the Nation.<ref>[http://www.muniyanahuara.gob.pe/index.php?option=com_content&amp;view=article&amp;id=8&amp;Itemid=15 Yanahuara Villa Hermosa (Mayor's Message)]</ref><br />
<br />
* Cayma Villa, {{convert|3|mi|0|abbr=off}} from the centre of town. Place known for its taverns and where there is a beautiful seventeenth-century church. With a viewpoint which affords a beautiful view of Arequipa.<br />
<br />
* The thermal baths of Yura, {{convert|30|km|0|abbr=off}}. Its waters come from inside the volcano Chachani. Also, near the city are the medicinal sources of Jesus and Socosani.<br />
<br />
* Sabandía natural valley with most crystalline waters in the region. Here is the Sabandía mill was built and in operation since the eighteenth century.<br />
<br />
* The farm Sachaca or the Founder's Mansion,<ref>[http://www.lamansiondelfundador.com/es/historia.php Founder's Mansion]</ref> is {{convert|12|km|0|abbr=off}} from the city. Built on the river Socabaya, is a residence that belonged to different owners of historic renown in Peru but became especially known for being one of the family properties princiales Goyeneche. This beautiful piece of architecture is now open to the public.<br />
<br />
== Infrastructure ==<br />
<br />
=== Healthcare ===<br />
[[File:Hospital General de Arequipa.JPG|thumb|right|General Hospital of Arequipa]]<br />
As the administrative and economic capital of the Arequipa Region, the city has the largest number of both public health centers and private which total 680 establishments.<ref name="salud">National Institute of Statistics and Information, [http://www.inei.gob.pe/srienaho/descarga/DocumentosZIP/2006-18/Cuadro_37.zip Health Facilities]</ref><br />
Public health institutions that are present in the city are:{{Columns<br />
|col1 = * EsSalud<ref name="empleo2007">{{cite journal |author=EsSalud<br />
|title= Centros Asistenciales de Arequipa<br />
| year= 2004<br />
| journal= Centros Asistenciales del Perú<br />
| id = <br />
| url = http://www.essalud.gob.pe/nuestras-redes-asistenciales/red-asistencial-arequipa/<br />
}}</ref><br />
:<br />
** Hospital Level I: Edmundo Escomel<br />
** Metropolitan Polyclinic<br />
** Hospital Level III: Yanahuara<br />
** Level IV Hospital: National Hospital Carlos Alberto Seguin Escobedo (HNCASE)<ref name="hncase">{{cite web |author=Cuerpo Médico HNCASE |title=CMHNCASE |year=2009|url=http://www.cuerpomedicohncase.com/}}</ref><br />
** Complex Social Benefits|col2 = * Ministry of Health (MOH)<ref name="minsa">[http://www.saludarequipa.gob.pe Ministry of Health], accessed 29 June 2008</ref><br />
:<br />
** Regional Hospital Honorio Delgado Espinoza<br />
** Goyeneche Hospital II<br />
* National Institute of Neoplastic Diseases (INEN):<br />
:<br />
** Regional Institute of Neoplastic Diseases}}<br />
<br />
=== Transportation ===<br />
{{clear}}<br />
{{wide image|Aerial View, Arequipa, La Marina.jpg|700px|alt=Bypass at the intersection of the avenues La Marina and Ejercito|Bypass at the intersection of the avenues La Marina and Ejercito}}<br />
<br />
==== Roads ====<br />
Metropolitan road network has a structure that supports radiocentric four primary routes or trunks: Army Av, Av Jesus, Av and Av Alcides Carrion Parra and allow the movement of the population from the intermediate and peripheral areas activity centers.<br />
[[File:Red de buses de Arequipa SIT.jpg|thumb|right|Map showing Arequipa]]<br />
<br />
These pathways longitudinal nature are interconnected by bus routes, forming a ring around the central area consists of: Av Venezuela, Lieutenant Ferré, Progress, Av Arequipa, Gomez de la Torre Av, Av La Marina, San Martin, Avenida Salaverry, Mariscal Cáceres, Socabaya Malecon and Avenida Venezuela.<br />
<br />
This system is completed with some main roads as Cayma Av, Av Arequipa, Goyeneche Avenue, Kennedy Avenue, Dolores Av, Av Lambramani, flows carrying local roads to bus and vice versa.<br />
<br />
In 2011 in the city of Arequipa are registered 182,000 vehicles according to the Superintendency of Public Registries,<ref>[http://www.rpp.com.pe/2011-09-29-parque-automotor-en-arequipa-se-incrementa-en-34-noticia_408423.html Stat of the Superintendency of Public Registries]</ref> in the same year the fleet was increased to 64 000 vehicles, of which 12 000 360 were recorded as new units.<ref>[http://www.larepublica.pe/31-01-2012/arequipa-es-la-segunda-ciudad-en-donde-vendieron-mas-autos-nuevos-el-2011 new cars sold in 2011 (Automobile Association of Peru)]</ref><br />
<br />
==== Integrated Transport System ====<br />
A public transport system is under construction in Arequipa. Implemented by the Ministry of Transport and Communications and the Provincial Municipality of Arequipa, the system consists of a network scheme called rationalized based two trunk routes operated transit buses Rapid Transit (BRT) called ''ArequipaBus'' interacting with structuring routes and feeder networks.<ref name="sit">{{cite web |url=http://www.arequipabus.com/web/ |title=Sistema Integrado de Transportes |accessdate=1 August 2012 |author=Municipalidad Provincial de Arequipa |work=Arequipa Bus}}</ref><br />
<br />
* '''Exclusive trunk route or corridor,''' consisting of two segregated lanes along which articulated buses (BRT), its northern terminus is located in the area of Rio Seco in the district of Cerro Colorado and its southern terminal at Socabaya district.<ref name="rutasit">{{cite web |url=http://www.arequipabus.com/web/index.php?option=com_content&view=article&id=6&Itemid=7. |title=Rutas de l Sistema Integrado de Transportes |accessdate=1 August 2012 |author=Municipalidad Provincial de Arequipa |work=Arequipa Bus}}</ref><br />
* '''Feeder Routes:''' 43 routes formed by converging on the trunk route, nine of which operate in the northern and southern suburbs of the city and 34 in intermediate areas.<ref name="rutasit"/><br />
* '''Structuring routes,''' comprising 35 routes and according to its characteristics provide a direct service with an origin and destiny.<ref name="rutasit"/><br />
<br />
Its opening is planned for the first quarter of 2014<ref>{{cite news |work= La República |title= Obras del SIT inician en noviembre próximo |url=http://www.larepublica.pe/05-04-2012/obras-del-proyecto-sit-se-iniciaran-en-noviembre-proximo |accessdate=2 August 2012}}</ref> coordinating all routes operate a payment system and an interconnected system of passenger flow control.<ref name="sit"/><br />
<br />
==== Air transport ====<br />
Arequipa is served by [[Rodríguez Ballón International Airport]] located in the district of [[Cerro Colorado District|Cerro Colorado]] about {{convert|12|mi|0|abbr=off}} northwest of downtown, for its features and facilities is one of the best in the country,<ref name="export26p">Mincetur. "Export Investment Guide", p. 26.</ref> from 2011 to through a grant administered by the consortium "Andean South Airports".<ref name="Tráfico">[http://www.andina.com.pe/espanol/Noticia.aspx?id=mLn7DHtFef8= Airport Concession South Andean]</ref><br />
<br />
In 2011 introduced a passenger flow of 1,025,466 passengers between domestic flights<ref name="TráficoNacional">{{cite journal |journal=Corpac |authorlink=http://www.corpac.gob.pe |year=2011 |title= Movimiento Nacional de Pasajeros 2011 |url= http://www.corpac.gob.pe/ASPLib/StorageManager.ASP?Mode=D&Name=1%2EMov+Pasaj+Nac+%28Ener+Diciembre+2011%29%2Exls&File=%2FStorage%2FDocumentos%2FArchivo%2F6771%2Dc8Fs0Xy1Kx5Ud7L%2Exls&Type=application%2Fvnd%2Ems%2Dexcel&Audit=StorageManager%5FDoc%5FSetD&ID=6771 |accessdate=4 August 2012}}</ref> and international<ref name="TráficoInternacional">{{cite journal |journal= Corpac |authorlink=http://www.corpac.gob.pe |year=2011 |title= Movimiento Internacional de Pasajeros 2011 |url= http://www.corpac.gob.pe/ASPLib/StorageManager.ASP?Mode=D&Name=1%2EMov+Pasaj+Int%27l+%28Ener+Diciembre+2011%29%2Exls&File=%2FStorage%2FDocumentos%2FArchivo%2F6774%2Dl4Rt7Rj6Fb2Al8O%2Exls&Type=application%2Fvnd%2Ems%2Dexcel&Audit=StorageManager%5FDoc%5FSetD&ID=6774 |accessdate=4 August 2012}}</ref> and a load flow of 2193 tons in 2010, becoming the second in the southern region in the fluid passenger traffic after [[Alejandro Velasco Astete International Airport]], [[Cusco|Cuzco]] city, and third in the country.<br />
[[File:Full Runway SPQU 01.jpg|thumb|right|Partial view of the runway of Alfredo Rodriguez Ballon International Airport with the Misti volcano without snow in the background]]<br />
<br />
The airport holds daily air connections with the cities of [[Lima]], Cusco, [[Tacna]] and [[Juliaca]] and international destinations such as [[Arica]], [[Iquique]], [[Antofagasta]] and [[Santiago, Chile|Santiago de Chile]], along with regular flights coming to [[Buenos Aires]], [[Argentina|Argentina.]]<ref name="export26p"/><br />
<br />
In 2011 there are four airlines that offer their services on domestic flights, with a total of 38 daily flights in low season its main destinations and 52 daily flights in high season. The company makes three [[Sky Airline]] flights each reguales international destinations (Arica, Iquique, Antofagata, Santiago de Chile) per week, and next to the city of [[Buenos Aires]] with [[Aerolíneas Argentinas|Argentine Airlines]] codeshare.<br />
<br />
==== Rail transport ====<br />
The railway network system has been operating in Arequipa since 1871, enables communication between the coast and the mountains and different levels of progress and expansion of population centers located in its path. The system consists of the lines: Cusco-Puno-Arequipa and Arequipa-Mollendo.<br />
Is of great strategic importance in a multimodal communication system in the southern macro region, since it is the most effective and economical way to transport heavy loads over long distances.<br />
<br />
==== Bus transport ====<br />
The ''International Terrapuerto Arequipa'' is located in the district of James Hunter from which the city and the region of Arequipa is connected by land throughout Peru and [[La Paz, Honduras|La Paz]], [[Santiago, Chile|Santiago de Chile]], [[Mendoza, Argentina|Mendoza]] and [[Buenos Aires|Buenos Aires.]]<br />
<br />
Apart from having the International Bus Station Bus Terminal has the Arequipa regional usage and services towards the mountains and the coast. In the city of Arequipa interregional routes exist, consisting Uchumayo variant that serves as the connection with the coast, out to [[Yura District|Yura]] that serves as a connection to the Sierra and the departure of Jesus which connects to the highlands of Arequipa and [[Chiguata District|Chiguata]] area.<!-- {| class="toc" cellpadding="0" cellspacing="1" width="25%" style="float:right;text-align:center;clear:all;margin-left:3px;font-size:85%"<br />
|-<br />
! bgcolor="black" colspan="4" style="color:white"|Education – Census 2007<br />
|-<br />
|}<br />
!bgcolor = # e0e0e0 colspan = 4 | Academic level achieved<ref name="autogenerated2">[http://desa.inei.gob.pe/censos2007/tabulados/ Census 2007 – Education] – Government of Peru</ref><br />
|-Bgcolor = # efefef<br />
! width = 20% | Level<br />
! width = 20% | Total<br />
! width = 60% | Percent<br />
<br />
! width = 0% |<br />
| –<br />
| align = left | '''Initial | | 22,819 | | 2.77% | |'''<br />
| –<br />
| align = left | '''Primary | | 165,212 | | 20.07% | |'''<br />
| –<br />
| align = left | '''Secondary | | 245,250 | | 29.79% | |'''<br />
| –<br />
| align = left | '''No University | | 143,674 | | 17.45% | |'''<br />
| –<br />
| align = left | '''College | | 185,894 | | 29.92% | |'''<br />
| –<br />
|} --><!--{{cuadro azul|Sin desconocer el mérito y la importancia de las obras públicas para el IV Centenario de la fundación castellana de la ciudad, consideramos más trascendental e insuperada la belleza arquitectónica de las construcciones concebidas para la urbe universitaria, expresión de tectonismo iberoandino, concorde con la fisonomía mozárabe indiana, regional, nativa de los templos, las mansiones coloniales y los monumentos seculares que restan en esta tierra de Incas mitimaes y mudéjares cristianos|Gibson, Carlos. Rector la Universidad Nacional de San Agustín<ref name=gutierrez217p/>}}--><br />
<br />
==Twin towns – Sister cities==<br />
{{See also|List of twin towns and sister cities in Peru}}<br />
<br />
The city of Arequipa is actively involved in town twinning policy reason has had throughout its history various [[Twin towns and sister cities|twinning]] with different cities and regions. The twin cities of Arequipa are:<ref>{{cite news |author=aqpsoluciones |title=Arequipa busca estrechar lazos comerciales con ciudades hermanas |url=http://larevista.aqpsoluciones.com/2011/07/10/arequipa-y-lazos-comerciales-con-ciudades-hermanas/ |date=10 July 2011 |accessdate=5 August 2012}}</ref><br />
<br />
{|class="wikitable"<br />
|- valign="top"<br />
|<br />
*{{flagicon|USA}} '''[[Charlotte]]''' [[North Carolina|(North Carolina]], [[United States|USA)]] ''<small>(since 1963)</small>''<ref name="Charlotte">*{{cite web |title=Charlotte – Arequipa |year=2004 |location=Charlotte, United States |url=http://www.charlottesistercities.org/Default.aspx?tabid=70 |accessdate=9 April 2008}}</ref><br />
*{{flagicon|USA}} '''[[Maui]]''' [[Hawaii|(Hawaii]], USA. UU.)<ref>{{cite web |url=http://hawaii.gov/dbedt/main/about/annual/2005/2005-sisterstates.pdf |title=Ciudades hermanadas |accessdate=26 July 2009 |work=Hawaii Government}}</ref><br />
*{{flagicon|ARG}} '''[[Corrientes]]''' [[Corrientes Province|(Corrientes]], [[Argentina|Argentina)]], ''<small>(since 1992)</small>''<br />
*{{flagicon|CHI}} '''[[Arica]]''' ([[Chile]]) ''<small>(since 2005)</small>''<ref>{{cite web |url=http://www.municipioiquique.com/index.php?option=com_content&amp;task=view&amp;id=13Itemid=9 |title=Estudiantes de Universidad de San Agustín de Arequipa saludaron a alcaldesa |publisher=Municipio de Iquique |deadurl=yes |archiveurl=http://web.archive.org/web/20100508031119/http://www.municipioiquique.com/index.php?option=com_content&task=view&id=13Itemid=9 |archivedate=8 May 2010 |accessdate=12 December 2012}}</ref><br />
*{{flagicon|CHI}} '''[[Iquique]]''' ([[Chile]])<br />
*{{flagicon|PRC}} '''[[Guangzhou]]''' (China) ''<small>(since 2004)</small>''<ref name="Guangzhou twinnings">{{cite web|url=http://www.gzwaishi.gov.cn/Category_121/Index.aspx|archiveurl=http://web.archive.org/web/20121024091437/http://www.gzwaishi.gov.cn/Category_121/Index.aspx|title=Guangzhou Sister Cities'' [via WaybackMachine.com]''|publisher=Guangzhou Foreign Affairs Office|archivedate=24 October 2012|accessdate=2013-07-21}}</ref><br />
*{{flagicon|PRC}} '''[[Zibo]]''' (China)<br />
*{{flagicon|BRA}} '''[[São Paulo]]''' [[São Paulo (state)|(São Paulo]], [[Brazil|Brazil)]]<br />
*{{flagicon|BRA}} '''[[Ponta Grossa]]''' ([[Brazil]])<br />
*{{flagicon|BRA}} '''[[Lins, São Paulo|Lins]]''' [[São Paulo (state)|(São Paulo]], [[Brazil|Brazil)]]<br />
||<br />
*{{flagicon|VEN}} '''[[El Tocuyo|The Tocuyo]]''' ([[Venezuela]])<br />
*{{flagicon|ITA}} '''[[Biella]]''' ([[Italy]]), ''<small>(1979)</small>''<br />
*{{flagicon|ITA}} '''[[Florence]]''' ([[Italy]]), ''<small>(since 2008)</small>''<ref>Patto di amicizia against the Arequipa and the Città di Città di Firenze [Florence – Arequipa]</ref><ref>[http://www.viaggiavventurenelmondo.it/nuovosito/eventi/cdoc/entry.php?id=107 Avventure nel Mondo – Centro di Documentazione]</ref><br />
*{{flagicon|BOL}} '''[[La Paz, Honduras|La Paz]]''' ([[Bolivia]]), ''<small>(since 1989)</small>''<br />
*{{flagicon|BOL}} '''[[Cochabamba]]''' ([[Bolivia]])<br />
*{{flagicon|CAN}} '''[[Vancouver]]''' [[British Columbia|(British Columbia]], [[Canada|Canada)]]<ref>[http://www.accci.com.au/sister.htm Sister cities, Vancouver]</ref><br />
*{{flagicon|MEX}} '''[[Monterrey]]''' [[Nuevo León|(Nuevo León]], [[Mexico|Mexico)]], ''<small>since 2006</small>''<br />
*{{flagicon|MEX}} '''[[Puebla (city)|Puebla]]''' [[Puebla|(Puebla]], [[Mexico|Mexico)]], ''<small>since 2006</small>''<br />
*{{flagicon|MEX}} '''[[Morelia]]''' [[Michoacán|(Michoacan]], [[Mexico|Mexico)]]<br />
*{{flagicon|MEX}} '''[[Guanajuato, Guanajuato|Guanajuato]]''' [[Guanajuato|(Guanajuato]], [[Mexico|Mexico)]] ''<small>(since 2004)</small>''<ref>{{cite web |url=http://www.guanajuatocapital.gob.mx/ciudadeshermanas/cont/ArequipaEsp.pdf |title=Ciudades hermanadas |language=Spanish |accessdate=18 August 2011 |work=Ayuntamiento de Guanajuato |archiveurl=http://web.archive.org/web/20110726120249/http://www.guanajuatocapital.gob.mx/ciudadeshermanas/cont/ArequipaEsp.pdf |archivedate=26 July 2011}}</ref><br />
|}<br />
<br />
== See also ==<br />
<br />
* [[Historic centre of Arequipa]]<br />
* [[Mollendo]]<br />
* [[Arequipa Region]]<br />
* [[Rodríguez Ballón International Airport|Rodriguez Ballon International Airport]]<br />
* [[Metropolitan areas of Peru]]<br />
* [[Goyeneche Palace, Arequipa|Goyeneche Palace]]<br />
* [[Tourism in Peru]]<br />
<br />
== References ==<br />
{{reflist|colwidth=30em}}<br />
<br />
=== Comments ===<br />
<references group="nota"></references><br />
<br />
== Bibliography ==<br />
<br />
=== Books ===<br />
*{{cite book |last=Arellano |first=Fernando |title=El Arte Hispanoamericano |url=http://books.google.com.pe/books?id=_4Kui3zXMigC |accessdate=28 July 2012 |language=Spanish |year=1988 |editor=Universidad Católica Andrés |isbn= 9789802440177}}<br />
<br />
*{{cite book |last=Barriga |first=Víctor M. |editor=editor La Colmena, S.A. |title=Arequipa y sus blasones |url=http://books.google.com.pe/books?id=Hxh6AAAAMAAJ |year=1940 |language=Spanish}}<br />
<br />
*{{cite book |last=Benavides Rodríguez |first=Alfredo |editor=Andrés Bello |title=La arquitectura en el virreinato del Perú y en la capitanía general de Chile |url=http://books.google.com/books?id=p7HIFLdkBiUC |edition=ilustrada |year=1990 |page=282 |language=Spanish}}<br />
<br />
*{{cite book |last=Bethell |first=Leslie |title=The Cambridge History of Latin America: Latin America since 1930 |url= |edition=ilustrada |year=1991 |id= |isbn=9780521266529 |page=919|editor=Cambridge University Press}}<br />
<br />
*{{cite book |last=Carricaburo |first=Norma |title=Las fórmulas de tratamiento en el spanish actual |year=1997 |url=http://www.auburn.edu/academic/liberal_arts/foreign/Spanish/FLSP7970t/Carricaburo-Formulas.pdf |language=Spanish |editor=Arcos Libros S.L. |isbn=847635278-6}}<br />
<br />
*{{cite book |last=Chanfreau |first=Marie-Françoise |title=La vivienda en los pueblos jóvenes de Arequipa y Trujillo: creación de una nueva tipologçia regional |year=1995 |editor=M. IFEA: Instituto fránces de estudios andinos |url=http://www.ifeanet.org/publicaciones/boletines/17(1)/37.pdf |language=Spanish}}<br />
<br />
*{{cite book |last=Contreras |first=Carlos |title=El aprendizaje del capitalismo:Estudios de historia económica y social del Perú republicano |year=2004 |editor=Instituto de Estudios Peruanos |isbn=9789972510977 |page=332 |url=http://www.abebooks.com/book-search/isbn/9789972510977/page-1/ |deadurl=no |accessdate=10 June 2013}}<br />
<br />
*{{cite book |last=Congreso de irrigación y colonización del norte |title=Anales del primer Congreso de irrigación y colonización del norte: 19–24 February 1929, Lambayeque, República del Perú |url=http://books.google.com.pe/books?id=kHVxAAAAIAAJ |accessdate=9 August 2012 |year=1929 |editor=Imprenta Torres Aguirre |page=270}}<br />
<br />
*{{cite book |last=Cornejo Bouroncle |first=Jorge |title= Arequipa: homenaje y recuerdo |url=http://books.google.com.pe/books?id=P09JAQAAIAAJ |accessdate=28 July 2012 |year=1952|editor=H.G. Rozas |page=35}}<br />
<br />
*{{cite book |last=Cuneo Vidal |first=Rómulo |title=Boletín de la Sociedad Geográfica de Lima |year=1931 |editor=Sociedad Geográfica de Lima |language=Spanish}}<br />
<br />
*{{cite book |last=Dávalos y Lissón |first=Pedro |title=La primera centuria : causas geográficas, políticas y económicas que han detenido el progreso moral y material del Perú en el primer siglo de su vida independiente. Tomo II |url=http://bib.cervantesvirtual.com/FichaObra.html?portal=0&Ref=5443 |accessdate=11 August 2012 |language=Spanish |year=1863 |editor=Librería e Imprenta Gil |location=Biblioteca Nacional del Perú}}<br />
<br />
*{{cite book |last=de la Riva Agüero |first=José |title=Memorias y documentos para la historia de la independencia del Perú |url=http://www.barnesandnoble.com/w/memorias-y-documentos-para-la-historia-de-la-independencia-del-peru-volume-1-jose-de-la-riva-aguero/1022296098 |year=1858 |editor=Librería de Garnier Hermanos |location=Librería de la Universidad de Míchigan |page=304 |deadurl=no |accessdate=10 June 2013}}<br />
<br />
*{{cite book |author=Dirección de Estadística |title=Resumen General de Censo General de habitantes del Perú de 1876 |url= |language=Spanish |year=1878 |editor=Ministerio de Gobierno, Imprenta del Estado}}<br />
<br />
*{{cite book |work=Instituto Nacional de Estadística |title=Censo de población y ocupación de 1940 |url= |year=1944 |editor=Instituto Nacional de Estadísticas |chapter=Relación de los censos parciales levantados en el Perú después del censo general de 1876}}<br />
<br />
*{{cite book |last=Galdós Rodríguez |first=Guillermo |title=Una ciudad para la historia, una historia para la ciudad: Arequipa en el siglo XX |year=1997 |editor=Universidad Nacional de San Agustín |url=http://books.google.com.pe/books?id=r13rAAAAMAAJ |language=Spanish |page=391}}<br />
<br />
*{{cite book |last=Garayar |first=Carlos |title=Atlas Regional: Arequipa |year=2004|editor=Ediciones Peisa |isbn=9972-40-315-7 |language=Spanish}}<br />
<br />
*{{cite book |last=Gutiérrez |first=Ramón |title=Evolución histórica urbana de Arequipa Metropolitana 1540–1990 |url=http://books.google.com/books?id=G1wbAAAAIAAJ |edition=ilustrada |year=1994 |id= |isbn=9788489034013|page=249}}<br />
<br />
*{{cite book |last=Linares Málaga |first=Eloy |title=Pre historia de Arequipa |url=http://catalog.loc.gov/vwebv/search?searchArg=92101473&searchCode=GKEY%5E*&searchType=1 |accessdate=11 August 2012 |language=Spanish |year=1990}}<br />
<br />
*{{cite book |last=Love |first=Thomas |title=Cash Cows and Fighting Bulls:Redefining Identity, Maintaining Control in Southwestern Perú |year=1995 |editor=Departament of Sociology/Anthropology of Linfield College – McMinnville, Oregon |url=http://lasa.international.pitt.edu/LASA98/Love.pdf}}<br />
<br />
*{{cite book |last=Mc Evoy |first=Carmen |language=Spanish |title=La utopía republicana: ideales y realidad en la formación de la Cultura Política Peruana, 1871–1919 |year=1997 |page=467 |editor=Fondo editor PUCP |isbn=9972420620 |url=http://www.amazon.com/utopia-republicana-realidades-formacion-1871-1919/dp/9972420620 |deadurl=no |accessdate=10 June 2013}}<br />
<br />
*{{cite book |last=Miró Quesada |first=Aurelio |title=Historia y leyenda de Mariano Melgar (1790–1815) |url=http://www.amazon.co.uk/Historia-leyenda-Mariano-Melgar-1790-1815/dp/8472321711 |language=Spanish |year=1998 |editor=Universidad Nacional Mayor de San Marcos |isbn=9789972460616 |page=218 |deadurl=no |accessdate=10 June 2013}}<br />
<br />
*{{cite book |last= Monguió |first=Luis |title=Don José Joaquín de Mora: apuntes biográficos |url=http://www.amazon.com/Don-Jos%C3%A9-Joaqu%C3%ADn-Mora-biogr%C3%A1ficos/dp/B0038QPCOM |accessdate=4 August 2012 |language=Spanish |year=1967 |editor=University of California Press |chapter=Don José Joaquín de la Mora y el Perú de mil ochocientos |page=268 |deadurl=no |accessdate=10 June 2013}}<br />
<br />
* {{cite book |last=Neira |first=Máximo |title=Fundación M.J. Bustamante de la Fuente |url=http://www.universidadperu.com/empresas/fundacion-mj-bustamante-de-la-fuente.php |language=Spanish |year=1990 |editor= |deadurl=no |accessdate=10 June 2013}}<br />
<br />
*{{cite book |last1=Nuñez Pacheco |first1=Rosa |last2=Torres Santillana |first2=Gregorio |title=El author de creación literaria de la Macroregión Sur |url=https://docs.google.com/open?id=0B1WxBwWL6_X6UUlhd1V4S3VXYms |year=1991 |language=Spanish |chapter=Polifonía del silencio, la literatura arequipeña en los últimos diez years |editor=Promolibro}}<br />
<br />
*{{cite book |last=Palma |first=Ricardo |title=Tradiciones peruanas |url=http://bib.cervantesvirtual.com/servlet/SirveObras/12474965333472617765657/p0000001.htm |accessdate=11 August 2012 |language=Spanish |year=1893 |editor=Barcelona, Montaner y Simón |pages=1–252 |volume=III}}<br />
<br />
*{{cite book |last=Ponce | first=Fernando |title=La ciudad en el Perú |editor=Retablo de papel |location=Arequipa |year=1960 |page=53 }}<br />
<br />
*{{cite book |url= |title=Teatro completo: Crítica teatral; el Espejo de mi tierra |last=Pardo y Aliaga |first=Felipe |year=2007 |language=Spanish |editor=Fondo editor PUCP |page=34}}<br />
<br />
*{{cite book |last=Zátonyi |first=Marta |editor=Ediciones Infinito |language=Spanish |title=Gozar el arte, gozar la arquitectura|url=http://books.google.es/books?id=hDY33cOj2u4C |edition=ilustrada |year=2006 |isbn=9789879393406 |page=292}}<br />
<br />
=== Publications ===<br />
*{{cite journal |author=Asamblea Nacional de Rectores |first= |title=Datos Estadísticos Universitarios |publisher=II Censo Nacional Universitario |year=2012 |page=21 |editor=ANR |issn= |url=https://docs.google.com/open?id=0B1WxBwWL6_X6TTRkbllnWURKWG8 |accessdate=11 August 2012|language=Spanish}}<br />
<br />
*{{cite journal |last=Cáceres-Péfaur |first=Beatriz |year=2006 |title=La visita de Simón Bolívar a la ciudad de Arequipa (Perú). Visión de la historiografía local contemporánea. |publisher=Presente y Pasado, Revista de Historia |number=11 |pages=124–140 |issn=1316-1369 |url=http://www.saber.ula.ve/bitstream/123456789/23039/2/articulo4.pdf |accessdate=11 August 2012|language=Spanish}}<br />
<br />
*{{cite journal |last=Coaguila Valdivia |first=Jaime Francisco |year=2010 |title=Recetario para una construcción relacional de la identidad arequipeña |publisher=Jueces, abogados y "escribanos" |language=Spanish |url=http://www.jaimecoaguila.net/archivos/articulo19.pdf |accessdate=11 August 2012}}<br />
<br />
*{{cite journal |author=Consejo Nacional de Ambiente |year= |title=Gesta Zonal de Aire, Arequipa |publisher=Plan a limpiar el aire |editor=Consejo Nacional del Ambiente |url=http://cdam.minam.gob.pe:8080/bitstream/123456789/177/1/CDAM0000069.pdf |accessdate=11 August 2012 |language=Spanish}}<br />
<br />
* {{cite journal |last=Cornejo Velásquez |first=Hernán |year=2006 |title=El simbolismo de la comida arequipeña |publisher=Investigaciones Sociales |volume=17 |number= |pages=41–65 |location=Lima |editor=Universidad Nacional Mayor de San Marcos |url=http://sisbib.unmsm.edu.pe/BibVirtualData/publicaciones/inv_sociales/N17_2006/a03n17.pdf |accessdate=11 August 2012 |language=Spanish}}<br />
<br />
*{{cite journal |last=Cotler |first=Julio |editor=Programa de las Naciones Unidas para el desarrollo, Instituto de Estudios Peruanos |year=2009 |title=Poder y cambio en las regiones |publisher=Serie Desarrollo Humano |number=15 |url=http://lanic.utexas.edu/project/laoap/iep/ddt154.pdf |accessdate=11 August 2012 |language=Spanish}}<br />
<br />
*{{cite journal |author=Empresa de Generación del Energía Eléctrica S.A (EGASA) |year=2003 |title=En agosto Arequipa está de fiesta |journal=Egasin |volume=Nº2 |number=16 |url=https://docs.google.com/file/d/0B1WxBwWL6_X6YVlMWlEzblgzQTA/edit?pli=1<br />
}}<br />
<br />
*{{cite journal |author=García de los Reyes Arquitectos y Asociados |year=2012a |title=Diagnóstico propositivo para el Plan de Desarrollo Metropolitano de Arequipa |volume=Memoria Síntesis |editor=Municipalidad Provincial de Arequipa |url=https://docs.google.com/file/d/0B3iGSftnMMllWlBZbTlyTF9Xalk/edit |accessdate=11 August 2012}}<br />
<br />
*{{cite journal |author=García de los Reyes Arquitectos y Asociados |year=2012b |title=Plan de Desarrollo Metropolitano de Arequipa |volume=Memoria Síntesis |editor=Municipalidad Provincial de Arequipa |url=https://docs.google.com/file/d/0B3iGSftnMMllRnJoNGQ4YXhBZlk/edit |accessdate=11 August 2012}}<br />
<br />
*{{cite journal |last=Guajardo Castro |first=Alejandro |title=Aspectos morfosintácticos del habla loncca en la campiña arequipeña |year=2009 |journal=Maestría de Lingüística de la Universidad Nacional Mayor de San Marcos |url=http://wikieducator.org/images/d/d5/Lonccos.pdf |language=Spanish}}<br />
<br />
*{{cite journal |last=Guillemette |first=Martín |year=2010 |title=La revolución mexicana y sus impactos en América Latina: una propuesta de análisis a nivel local. El caso de Arequipa, Perú |publisher=México y sus revoluciones (XIII Reunión de historiadores de México, Estados Unidos y Canadá) |language=Spanish |editor=Institut des Hautes Etudes de l'Amérique Latine |url=}}<br />
<br />
*{{cite journal |last=Grup |first=Franz |editor=Instituto Nacional de Cultura |title=Gaceta Cultural del Perú |year=2010 |language=Spanish |url=http://www.mcultura.gob.pe/documentosweb/c33f21060d2e664f5af5c231d046c21a/GACET_41.pdf}}<br />
<br />
*{{cite journal |last=López de Romaña |first=Flavia |editor=Instituto Nacional de Cultura |title=Casos de Gestión Cultural en el Perú |year=2006 |language=Spanish |url=http://sic.conaculta.gob.mx/documentos/847.pdf}}<br />
<br />
*{{cite journal |author= Mincetur (Ministry of Foreign Trade and Tourism) |title=Arequipa, Export Investment Guide |page=98 |editor=Proexpansión |url=http://www.mincetur.gob.pe/apec1/pdf/Mincetur_Arequipa22.pdf |accessdate=11 August 2012}}<br />
<br />
*{{cite journal |url=https://docs.google.com/open?id=0B1WxBwWL6_X6djh0OGJ4TjhFUGs |title=Historical Center of the City of Arequipa, Compendio Normativo |accessdate=4 August 2009 |author=Municipalidad Provincial de Arequipa |author2=Superintendencia del Centro Histórico y Zona Monumental |date=30 November 2000 |language=Spanish}}<br />
<br />
*{{cite book|author=Municipalidad Provincial de Arequipa |title=Plan Maestro del Centro Histórico de Arequipa|url=https://docs.google.com/open?id=0B1WxBwWL6_X6ZVlTeERNSEltVnM |year=2002|page=73 |chapter=Diagnostico del Centro Histórico de Arequipa |language=Spanish}}{{Dead link|date=January 2015}}<br />
<br />
* {{cite journal |last=Robles |first=Elmer |year=2006 |title=Origen de las universidades más antiguas de Perú |publisher=Revista Historia de la Educación Latinoamericana |volume=8 |number=1 |pages=35–48 |url=http://redalyc.uaemex.mx/pdf/869/86900803.pdf |accessdate=11 August 2012 |language=Spanish}}<br />
<br />
{{commons category|Arequipa}}<br />
<br />
== External links ==<br />
* [http://www.muniarequipa.gob.pe Municipality of Arequipa]<br />
* [http://www.regionarequipa.gob.pe Arequipa Region]<br />
*{{Wikivoyage-inline}}<br />
* [http://www.e-peru-travel.com/peru-travel-guide/arequipa-travel-guide.html General facts and travel information about Arequipa]<br />
* [http://www.hotels-arequipa.com/arequipa-guide/ Travel Information about Arequipa]<br />
* [http://www.muniarequipa.gob.pe Local government of Arequipa]<br />
* [http://www.discover-peru.org/arequipa/ Peru Cultural Society – Arequipa]<br />
<br />
{{Large cities of Peru}}<br />
{{Regional capitals of Peru}}<br />
{{Use dmy dates|date=December 2012}}<br />
<br />
{{Authority control}}<br />
<br />
[[Category:Arequipa| ]]<br />
[[Category:Tourism in Peru]]<br />
[[Category:Cities in Peru]]<br />
[[Category:Populated places in the Arequipa Region]]<br />
[[Category:Populated places established in 1540]]<br />
[[Category:World Digital Library related]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Kung_Fu_Hustle&diff=663040522Kung Fu Hustle2015-05-19T05:22:39Z<p>PuercoPop: Fix date format of the 7th reference</p>
<hr />
<div>{{good article}}<br />
{{Use British English|date=April 2013}}<br />
{{Use dmy dates|date=April 2013}}<br />
{{Infobox film<br />
|name = Kung Fu Hustle<br />
|image = KungFuHustleHKposter.jpg<br />
|caption = Mainland China release poster<br />
| film name = {{Film name|traditional = 功夫<br />
|jyutping = Gung1 Fu1}}<br />
|director = [[Stephen Chow]]<br />
|producer = {{unbulleted list|Stephen Chow<br />Chui Po-chu<br />[[Jeffrey Lau]]}}<br />
|writer = {{plainlist|<br />
*Stephen Chow<br />
*Huo Xin<br />
*Chan Man-keung<br />
*Tsang Kan-cheung}}<br />
|starring = {{plainlist|Stephen Chow<br />
*[[Danny Chan (actor)|Danny Chan]]<br />
*[[Yuen Wah]]<br />
*[[Yuen Qiu]]<br />
*[[Huang Shengyi|Eva Huang]]}}<br />
|music = [[Raymond Wong (composer)|Raymond Wong]]<br />
|cinematography = Poon Hang-sang<br />
|editing = Angie Lam<br />
|studio = Star Overseas<br />Beijing Film Studio<br />Taihe Film Investment<br />[[China Film Group]]<br />Huayi Brothers<br />
|distributor = [[Columbia Pictures]] {{small|(International)}}<br />[[Sony Pictures Classics]] {{small|(USA)}}<br />
|released = {{Film date|df=yes|2004|9|14|[[2004 Toronto International Film Festival|TIFF]]|2004|12|23}}<br />
|runtime = 98 minutes<ref name="Hongkong">{{Cite web|url=http://www.bbfc.co.uk/releases/kung-fu-hustle-2005-3|title=Kung Fu Hustle - BBFC|publisher=[[BBFC]]}}</ref><br />
|country = Hong Kong<br/>China<ref>{{cite web|url=http://explore.bfi.org.uk/4ce2b8ab78dea|work=British Film Institute]]|title=Gong Fu|accessdate=12 July 2014}}</ref><br />
|language = [[Cantonese]]<ref name="Hongkong"/><br />
|budget = $20 million<br />
|gross = $100,914,445<ref name="BOM">{{cite web| title =Kung Fu Hustle| url =http://boxofficemojo.com/movies/?id=kungfuhustle.htm| publisher = [[Box Office Mojo]] | accessdate = 4 July 2013 }}</ref><br />
}}<br />
{{ChineseText}}<br />
'''''Kung Fu Hustle''''' is a 2004 [[Cinema of Hong Kong|Hong Kong]]-Chinese [[Action film|action]] [[comedy]] martial arts film. It was directed, co-written and co-produced by [[Stephen Chow]], who also stars in the lead role. The other producers were Chui Po-chu and [[Jeffrey Lau]], and the screenplay was co-written with Huo Xin, Chan Man-keung, and Tsang Kan-cheung. [[Yuen Wah]], [[Yuen Qiu]], [[Danny Chan (actor)|Danny Chan]], and [[Leung Siu-lung|Bruce Leung]] co-starred in prominent roles.<br />
<br />
After the commercial success of ''[[Shaolin Soccer]]'', its production company, Star Overseas, began to develop ''Kung Fu Hustle'' with [[Columbia Pictures]] Asia in 2002. The film features a number of retired actors famous for 1970s [[Hong Kong action cinema]], yet has been compared to contemporary and influential martial arts films such as ''[[Crouching Tiger, Hidden Dragon]]'' and ''[[Hero (2002 film)|Hero]].'' The [[Animated cartoon|cartoon]] style of the film, accompanied by traditional [[Music of China|Chinese music]], is often cited as its most striking feature.<br />
<br />
The film was released on 23 December 2004 in China and on 25 January 2005 in the United States. It received highly positive reviews, with [[Rotten Tomatoes]] giving it a 90% fresh rating and [[Metacritic]] 78 out of 100. The film was also a commercial success, grossing US$17 million in North America and US$84 million in other countries. ''Kung Fu Hustle'' was the highest-grossing film in the history of Hong Kong until it was surpassed by ''[[You Are the Apple of My Eye]]'' in 2011.<br />
<br />
The film was the all-time tenth highest-grossing foreign language film in the United States as well as the highest-grossing foreign language film in the country in 2005. ''Kung Fu Hustle'' won numerous awards, including six [[Hong Kong Film Award]]s and five [[Golden Horse Film Festival and Awards|Golden Horse Awards]].<br />
<br />
==Plot==<br />
In [[Shanghai]] during the 1930s, Brother Sum, the leader of the [[The Axe Gang|Deadly Axe Gang]], exercises control over the city, openly killing anyone who gets in his way. One day, two troublemakers, Sing and Bone, come to Pig Sty Alley impersonating members of the Axe Gang to gain respect. Their plan fails, and Sing's antics attract the real gang to the scene. In the massive brawl that ensues, more than fifty gangsters are defeated by three tenants who are Coolie, a laborer, Fairy, the clothing retailer, and Donut, the noodle chef. Coolie, Fairy, and Donut turn out to be incognito martial arts masters.<br />
<br />
After the fight, Sing and Bone are apprehended by Brother Sum for publicly humiliating the Axe Gang. They are hung by their arms to be killed, but Sing uses his lock picking skills to escape and asks to join the gang. Sum is impressed by Sing's lock picking, so he tells them that if they kill a person they will be accepted into the gang. Asked to explain his escape skills, Sing describes his childhood: he bought a Buddhist Palm manual from a beggar and trained himself to be a martial artist, but when he tried to defend a mute girl from bullies, he was beaten up and humiliated.<br />
<br />
The next day, the duo return to Pig Sty Alley and attempt to murder the Landlady, but their efforts fail. The cantankerous Landlady chases Sing, who becomes badly injured in the process after being bitten on the lips by multiple snakes and hides in a traffic control pulpit, where his multiple injuries including comically swollen lips spontaneously heal, a surprise even to him. As he recovers, thrashing in pain from his injuries, he unconsciously throws his hands outward and violently dents the pulpit from the inside. These dents appear to be the result of kung-fu strikes.<br />
<br />
Meanwhile, Sum hires two mystical assassins to kill the three martial artists at Pig Sty Alley. That night, the Landlady, fearing retaliation from the Axe Gang, evicts the three martial artists. In the process of leaving, Coolie is murdered by the assassins, who use a magical [[guqin]] as their weapon, and Fairy and Donut attain fatal injuries during the fight. The assassins are defeated by the Landlady and Landlord, who are in fact martial arts masters in self-imposed retirement. They had sworn not to fight anymore due to their young son being killed years earlier in a fight. Moments after Fairy dies, a very weak Donut speaks to the Landlord and Landlady right before dying before their eyes. The dead three are surrounded by the grateful but saddened Pig Sty Alley denizens. Afterward, sensing an impending showdown with the Axe Gang, the Landlady and Landlord order all the citizens and tenants to evacuate Pig Sty Alley.<br />
<br />
A desperate Sing mugs an ice cream vendor only to realize she is the mute girl from his childhood. For helping her, the woman offers him the lollipop she had as a girl, but Sing refuses it and knocks it away, shattering it to pieces. Sing berates Bone for being unhelpful in their quest to become Axe members and forces him away. Sing is then picked up by the Axe Gang and in exchange for joining the gang, Sum orders him to break into a [[Psychiatric hospital|mental asylum]] to free a legendary fighter known as the Beast. Sing succeeds (although he experiences several moments of great foreboding during the job) and brings the Beast to Sum at his office. The Beast is initially flippant and his sloppy appearance bewilders Sum, who orders his men to torture the fighter. In response, the Beast stops a bullet with two fingers, and the Axe Gang bows in respect.<br />
<br />
The Beast then confronts the Landlady and Landlord at the casino and they fight, with the Beast having the advantage. The Landlady and Landlord manage to overpower him with a large temple bell through which the Landlady amplifies her [[lama (martial art)|lion's roar]] technique. Just before they finish him off, the Beast proclaims his awe at their abilities and claims to surrender. However, the moment the Landlady and Landlord let down their guard, the Beast treacherously stabs them both in the stomach with concealed daggers. The three end up intertwined, both sides immobilizing the other. Brother Sum orders Sing to hit the Landlord with a table leg. When Brother Sum's berating becomes too much, Sing angrily bashes Brother Sum in the head to get him to shut up. Sing, having reformed, rushes in to help them by hitting the Beast with the table leg. Unfortunately, the blow only incenses the Beast, who pummels Sing into the floor. Before the Beast can deliver the final blow, the Landlord and Landlady grab Sing and flee. Sum angrily berates the Beast for letting them escape, and the Beast casually murders Sum and takes over his men.<br />
<br />
At Pig Sty Alley, Sing undergoes a metamorphosis; the Beast's thrashing has inexplicably awoken his true potential as a kung-fu genius. He quickly recovers from his wounds, and suggests that the Landlord and Landlady rest. He easily defeats the Axe Gang before confronting the Beast. The two engage in a fierce brawl before the Beast uses his Toad Style techniques to send Sing rocketing into the sky. As he falls back to earth, Sing comes to terms with the Buddha and the techniques he learned from the manual as a child, and delivers the Buddhist Palm to defeat the Beast. After a final failed attack on Sing, the Beast accepts his defeat and appears to experience an epiphany. He begins to cry, and kneels before Sing, as if in supplication before his new master.<br />
<br />
Some time later, Sing and Bone open a candy store with the vendor's lollipop as the store sign. When the mute ice cream vendor walks by, Sing goes out to meet her. As they gaze upon one another, the camera spins around them as they transform into the children seen in the flashbacks. They smile, clasp hands and run into the candy store together. Various characters from the movie, who appear to have formed happy couples, walk through the square in front of the store. The beggar (suspected to be a magical traveller) who gave Sing the Buddhist Palm is then seen attempting to sell the Buddhist Palm manual to a young boy. The boy turns to leave until the beggar offers all of the manuals.<br />
<br />
==Cast==<br />
<br />
*[[Stephen Chow]] as Sing, a loser in life who aspires to join the Axe Gang.<br />
*[[Danny Chan (actor)|Danny Chan]] as Brother Sum, leader of the Axe Gang.<br />
*[[Yuen Wah]] as the Landlord of Pig Sty Alley. He is also a master of [[Tai chi|taijiquan]].<br />
*[[Yuen Qiu]] as the Landlady of Pig Sty Alley. She is a master of the Lion's Roar technique.<br />
*[[Leung Siu-lung|Bruce Leung]] as the Beast, an old but incredibly strong kung fu master. He is rumoured to be the most dangerous person alive, though his skill is disguised by his unkempt appearance. <br />
*[[Xing Yu]] as the [[Coolie]], a kung fu specialist specialising in [[Tán Tuǐ|Twelve Kicks]] of the Tam School.<br />
*[[Chiu Chi-ling]] as Fairy, the Tailor of Pig Sty Alley. He specialises in the art of [[Hung Ga]] Iron Fist Kung fu, and he fights with iron rings on his arms.<br />
*Dong Zhihua as Donut, a baker in Pig Sty Alley. He specialises in the [[Baguazhang|Eight Trigram]] [[Gun (staff)|Staff]].<br />
*[[Lam Chi-chung]] as Bone, Sing's sidekick.<br />
*[[Huang Shengyi|Eva Huang]] as Fong, Sing's mute love interest and childhood acquaintance.<br />
*[[Tin Kai-Man]] as Brother Sum's adviser.<br />
*Gar Hong-hay and Fung Hak-on as the Harpists, two killers hired by the Axe Gang. Their instrument is the [[guqin]], or "Chinese harp".<br />
*[[Lam Suet]] and Liang Hsiao as high-ranking members of the Axe Gang.<br />
*[[Yuen Cheung-yan]] as the Beggar, the man who sold Sing the Buddhist Palm manual.<br />
*[[Feng Xiaogang]] as the leader of the Crocodile Gang. He is killed by the Axe Gang at the start of the film.<br />
* [[Min-hun Fung]] as 4 eyed clerk<br />
<br />
==Production==<br />
<br />
===Development===<br />
[[File:Pig Sty Alley.jpg|thumb|An early sketch of the Pig Sty Alley|left]]<br />
''Kung Fu Hustle'' is a co-production of the Beijing Film Studio and Hong Kong's Star Overseas.<ref name=Szeto>{{cite web|last = Szeto|first = Kin-Yan|title = The politics of historiography in Stephen Chow's Kung Fu Hustle|publisher = Jump Cut|url = http://www.ejumpcut.org/currentissue/Szeto/index.html|accessdate = 2007-05-05 |archiveurl = http://web.archive.org/web/20070925122214/http://www.ejumpcut.org/currentissue/Szeto/index.html <!-- Bot retrieved archive --> |archivedate = 25 September 2007}}</ref> After the success of his 2001 film, ''[[Shaolin Soccer]]'', Chow was approached in 2002 by Columbia Pictures Film Production Asia, offering to collaborate with him on a project. Chow accepted the offer, and the project eventually became ''Kung Fu Hustle''.<ref name="Production Notes">{{cite web|title=Kung Fu Hustle Production Notes|url=http://www.sensasian.com/view/catalog.cgi/EN/1030{{!}}accessdate|publisher=sensasain.com|accessdate=7 October 2012|archiveurl=http://web.archive.org/web/20051222103730/http://www.sensasian.com/view/catalog.cgi/EN/1030|archivedate=22 December 2005}}</ref> ''Kung Fu Hustle'' was produced with a budget of US$20 million.<ref>{{cite web|title = Kung Fu Hustle general information|publisher = Box Office Mojo|url = http://www.boxofficemojo.com/movies/?id=kungfuhustle.htm|accessdate = 2007-05-13 }}</ref><br />
<br />
Chow was inspired to create the film by the martial arts films he watched as a child and by his childhood ambition to become a martial artist.<ref name=interview>{{cite AV media|people = Stephen Chow|title =Kung Fu Hustle - Interview with Director Stephen Chow|url = http://www.spike.com/video-clips/ps5bg5/kung-fu-hustle-interview-with-director-stephen-chow|medium = Online video|publisher = iFilm|location = Hong Kong|date = 29 July 2005}}</ref> A senior Hollywood executive said Chow was "forced to grind through four successive scripts" and "found it very laborious".<ref>{{cite news|url=http://www.nytimes.com/2008/09/15/business/media/15moguls.html |title=China's Media Moguls Tutored by Masters of Hollywood |date=14 September 2008 |author=Michael Cieply |work=The New York Times}}</ref><br />
<br />
Chow's first priority was to design the main location of the film, "Pig Sty Alley". Later in an interview Chow remarked that he had created the location from his childhood, basing the design on the crowded apartment complexes of Hong Kong where he had lived.<ref>{{cite web|last=Hwang|first=Ange|title=An Interview Sidebar with Stephen Chow|url=http://www.amamedia.org/news/interview_stephenchow.shtml|publisher=Asia Media Access|accessdate=4 July 2013}}</ref><ref name=inter>{{cite web|last = Roman|first = Julian|title = Stephen Chow talks Kung Fu Hustle|publisher = [[MovieWeb]]|date = 4 April 2005|url = http://www.movieweb.com/news/director-stephen-chow-talks-kung-fu-hustle|accessdate = 2012-09-14 }}</ref> The 1973 [[Shaw Brothers Studio]] film, ''[[The House of 72 Tenants]]'', was another inspiration for Pig Sty Alley.<ref name=Synoptique>{{cite web|last = Xu|first = Gary|title = The Gongfu of Kung Fu Hustle|publisher = Synoptique|url = http://www.synoptique.ca/core/en/articles/xu_gongfu/|accessdate = 2007-05-05 }}</ref> Designing the Alley began in January 2003 and took four months to complete. Many of the props and furniture in the apartments were antiques from all over China.<ref>{{cite AV media|people = Stephen Chow|title = Kung Fu Hustle Production Design|url = http://www.movieweb.com/movie/kung-fu-hustle/production-design|medium = Online video|publisher = MovieWeb|location = Hong Kong|date = 29 July 2005 }}</ref><br />
<br />
===Casting===<br />
''Kung Fu Hustle'' features several prolific Hong Kong action cinema actors from the 1970s. [[Yuen Wah]], a former student of the China Drama Academy [[Peking Opera School]] who appeared in over a hundred Hong Kong films and was a [[stunt double]] for [[Bruce Lee]], played the Landlord of Pig Sty Alley. Wah considered starring in ''Kung Fu Hustle'' to be the peak of his career. In spite of the film's success, he worried that nowadays fewer people practice martial arts.<ref name=":0">{{cite news<br />
|last = Zhang<br />
|first = Xiaomin<br />
|title = 从李小龙替身到影帝 元华:担忧中国功夫后继无人 (From a Bruce Lee impersonator to a movie star: Yuen Wah worries that Chinese martial arts may lack a successor)<br />
|language = Chinese<br />
|publisher = Eastern Sports Daily<br />
|url = http://www.donnieyen.net/htm/kungfustar/185410374.htm<br />
|accessdate = 2007-05-17 |archiveurl=http://web.archive.org/web/20060901133245/http://www.donnieyen.net/htm/kungfustar/185410374.htm<br />
|archivedate=1 September 2006}}</ref><br />
<br />
Auditions for the role of the Landlady began in March 2003, [[Yuen Qiu]] who did not audition, was spotted, during her friend's screen test smoking a cigarette with a sarcastic expression on her face, which won her the part.<ref name="DVD extras"/> Qiu, a student of [[Yu Jim-yuen]], ''[[sifu]]'' of the China Drama Academy, had appeared in the 1974 [[James Bond]] film ''[[The Man with the Golden Gun (film)|The Man with the Golden Gun]]'' at the age of 18.<ref name="YuenQiu">{{cite web|title = 元秋:演007时我才十几岁 现在不担心形象 (Yuen Qiu: I was only 18 when I appeared in a Bond Film, I don't worry about my image now)|publisher = Sina Corp|date = 17 December 2004|url = http://ent.sina.com.cn/2004-12-17/1853602893.html|accessdate=2007-05-16|language = Chinese}}</ref> After a number of other small roles, she retired from films in the 1980s. ''Kung Fu Hustle'' was her first role in nineteen years. Qiu, in order to fulfill Chow's vision for the role, gained weight for the role by eating midnight snacks everyday.<ref name="YuenQiu" /><br />
<br />
[[Leung Siu-lung|Bruce Leung]], who played the Beast, was Stephen Chow's childhood martial arts hero.<ref name=inter/> Leung Siu Lung was a famous action film director and actor in the 1970s and 1980s, known as the "Third Dragon" after Bruce Lee and [[Jackie Chan]]. After becoming unpopular in the Taiwanese film market in the late 1980s following a visit to China, he switched to a career in business. ''Kung Fu Hustle'' was his return to the film industry after a fifteen-year hiatus. He regarded Chow as a flexible director with high standards, and was particularly impressed by the first scene involving the Beast, which had to be reshot 28 times.<ref>{{cite news<br />
|last = Li<br />
|first = Yijun<br />
|title =《功夫》配角都有功夫 (The supporting characters of Kung Fu Hustle know kung fu)|language = Chinese<br />
|publisher = Zaobao<br />
|date = 24 December 2004<br />
|url = http://stars.zaobao.com/pages1/stephen241204.html|accessdate = 2007-05-17 |archiveurl=http://web.archive.org/web/20041230162842/http://stars.zaobao.com/pages1/stephen241204.html<br />
|archivedate=30 December 2004}}</ref><br />
<br />
In addition to famous martial artists, ''Kung Fu Hustle'' features legends of [[Cinema of China|Chinese cinema]]. Two famous Chinese directors appear in the film: [[Zhang Yibai]], who plays Inspector Chan at the beginning of the film, and [[Feng Xiaogang]], who plays the boss of the Crocodile Gang.<ref name=Geo>{{cite web|last = Kin-Wah|first = Szeto|title = Geopolitical imaginary: Hong Kong, the Mainland and Hollywood|publisher = Jump Cut|url = http://www.ejumpcut.org/currentissue/Szeto/2.html|accessdate = 2007-05-11 |archiveurl = http://web.archive.org/web/20070927181930/http://www.ejumpcut.org/currentissue/Szeto/2.html <!-- Bot retrieved archive --> |archivedate = 27 September 2007}}</ref><br />
<br />
In casting Sing's love interest Fong, Chow stated that he wanted an innocent looking girl for the role. Television actress [[Huang Shengyi|Eva Huang]], in her film debut, was chosen from over 8,000 girls. When asked about his decision in casting her Chow said that he "just had a feeling about her" and said that he enjoyed working with new actors. She chose to have no dialogue in the film so that she could stand out only with her body gestures.<ref name="DVD extras">{{cite DVD notes |title=Kung Fu Hustle |origyear=2005 |others=Stephen Chow |type=TV Special - Behind the Scenes of KUNG FU HUSTLE Featurette |publisher= |location= |id= |year= |language= }}<br />
</ref><ref>{{cite news|title = 《功夫》明星说功夫 梁小龙演反派感觉很陌生 (Kung Fu Hustle actors comment on the film)|language = Chinese|publisher = Sina Corp|date = 15 December 2007|url = http://ent.sina.com.cn/m/c/2004-12-15/1150599985.html|accessdate = 2007-05-17 }}</ref><br />
<br />
===Filming===<br />
[[File:Buddhist palm construction.jpg|thumb|CGI construction of the Buddhist Palm|right]]<br />
Filming took place in Shanghai from June 2003 to November 2003.<ref name=CGI>{{cite news|last = Zu|first = Blackcat|title = An Interview with the Production Team (Centro Digital Pictures Ltd.)|page = 1|language = Chinese|publisher = CGVisual|date = 31 December 2004|url = http://www.cgvisual.com/headlines/Centro_kungFu/CGVheadlines_kungFu.htm|accessdate = 2007-05-17 }}</ref> Two-thirds of the time was spent shooting the fight sequences.<ref name=interview/> Those scenes were initially choreographed by [[Sammo Hung]], who quit after two months due to illness, tough outdoor conditions, interest in another project and arguments with the production crew.<ref>{{cite news|last = Zhu|first = Rongbin|title = 洪金寶走人袁和平救場 《功夫》緊急走馬換將 (Sammo Hung quits and is replaced by Yuen Woo-Ping)|language = Chinese|publisher = Eastern News|date = 20 August 2003|url = http://news.eastday.com/epublish/big5/paper148/20030820/class014800007/hwz999348.htm|accessdate = 2007-05-17 }}</ref> Hung was replaced by [[Yuen Woo-ping]], an action choreographer with experience ranging from 1960s [[Hong Kong action cinema]] to more recent films like ''[[Crouching Tiger, Hidden Dragon]]'' and ''[[The Matrix]]''. Yuen promptly accepted the offer.<ref name="Production Notes"/> Yuen drew on seemingly outdated [[wuxia]] fighting styles like the Deadly Melody and Buddhist Palm.<ref>{{cite news|last = Zhang|first = Wenbo|script-title=zh:绝世功夫之技术篇--想像力的最高境界|language = Chinese|publisher = The Beijing News|date = 27 December 2004|url = http://ent.sina.com.cn/r/m/2004-12-27/1345611519.html|accessdate = 2007-05-17 }}</ref> He remarked that despite the comedic nature of the film, the shooting process was a serious matter due to the tight schedule.<ref name=":0" /><br />
<br />
Most of the special effects in the film, created by Hong Kong computer graphics company [[Centro Digital Pictures Limited]], which had previously worked on films such as ''Shaolin Soccer'' and ''[[Kill Bill]]'', included a combination of [[computer-generated imagery]] and [[Wire fu|wire work]]. Centro Digital performed extensive tests on CGI scenes before filming started, and treatment of the preliminary shots began immediately afterwards. The CGI crew edited out wire effects and applied special effects in high resolution. Legendary martial arts mentioned in wuxia novels were depicted and exaggerated through CGI, but actual people were used for the final fight between Chow's character and hundreds of axe-wielding gangsters.<ref name=Szeto/> After a final calibration of colour, data of the processed scenes was sent to the US for the production of the final version. A group of six people followed the production crew throughout the shooting.<ref name=CGI/><br />
<br />
===Music===<br />
{{Main|Kung Fu Hustle (soundtrack)}}<br />
The majority of the film's original score was composed by [[Raymond Wong (composer)|Raymond Wong]] and performed by the [[Hong Kong Chinese Orchestra]].<ref name="HKCO">{{cite web | title = About the Hong Kong Chinese Orchestra | publisher = Hong Kong Chinese Orchestra | url = http://www.hkco.org/Eng/about_hkco_eng.asp | accessdate = 2007-05-13 |archiveurl = http://web.archive.org/web/20070618110155/http://www.hkco.org/Eng/about_hkco_eng.asp <!-- Bot retrieved archive --> |archivedate = 18 June 2007}}</ref> The score imitates traditional Chinese music used in 1940s swordplay films.<ref>{{cite web|last = Pollard|first = Mark|title = Kung Fu Hustle review|publisher = Kung Fu Cinema|url = http://www.kungfucinema.com/reviews/kungfuhustle_082205.htm|accessdate = 2007-05-18 |archiveurl = http://web.archive.org/web/20070502050543/http://www.kungfucinema.com/reviews/kungfuhustle_082205.htm <!-- Bot retrieved archive --> |archivedate = 2 May 2007}}</ref> One of Wong's works, ''Nothing Ventured, Nothing Gained'', provides a stark contrast between the villainous Axe Gang and the peaceful neighbourhood of Pig Sty Alley, depicted by a Chinese folk song, ''Fisherman's Song of the East China Sea''.<ref name=Geo/> Along with Wong's compositions and various traditional Chinese songs, classical compositions are featured in the score, including excerpts from ''[[Zigeunerweisen]]'' by [[Pablo de Sarasate]] and ''[[Sabre Dance]]'' by [[Aram Khachaturian]].<ref name=Kozo>{{cite web|last = Sung|first = Mark|title = Kung Fu Hustle review|year = 2004|url = http://www.lovehkfilm.com/reviews_2/kung_fu_hustle.htm|accessdate = 2007-05-12 }}</ref> The song, ''Zhiyao Weini Huo Yitian'' (只要為你活一天; ''Only Want to Live One Day for You''), is sung in the background by Eva Huang at the end of the film. Written by [[Liu Chia-chang]] (劉家昌) in the 1970s, it tells of a girl's memories of a loved one, and her desire to live for him again.<ref>{{cite web|title = Kung Fu Hustle production notes|work = Rotten Tomatoes|url = http://www.rottentomatoes.com/m/kung_fu_hustle/about.php|accessdate = 2 July 2013|publisher=[[Flixster]] }}</ref> ''Kung Fu Hustle'' was nominated for Best Original Film Score at the 24th [[Hong Kong Film Award]]s.<ref>{{cite web|last = Anon|first = Kozo|title = Kung Fu Hustle review|date = 14 March 2005|url = http://soundtracks.monstersandcritics.com/news/article_5180.php/Kung_Fu_Hustle_Soundtrack_Artwork_&_Details|accessdate = 2007-05-12 }}</ref><br />
<br />
Asian and American versions of the soundtrack were released. The Asian version of the soundtrack was released on 17 December 2004 by [[Sony Music Entertainment]] and has 33 tracks.<ref>{{cite web|title = Soundtrack Details of Kung Fu Hustle|date = 17 December 2004|url = http://www.soundtrackcollector.com/catalog/soundtrackdetail.php?movieid=70817|accessdate = 2007-05-12 }}</ref> The American version of the soundtrack was released on 29 March 2005 by [[Varèse Sarabande]] and has 19 tracks but has 14 tracks missing from the Asian release.<ref>{{cite web|title = Kung Fu Hustle soundtrack information|date = 29 March 2005|url = http://www.vh1.com/movies/movie/263855/879108/soundtrack_info.jhtml|accessdate = 2007-05-12 }}</ref><br />
<br />
The soundtrack for the trailer was mastered at Epiphany Music and Recording, Inc. in Santa Rosa, California.<br />
<br />
==References to other works==<br />
<!--Please only add content that is related to what the characters said in the Cantonese language version of the film. The English dubbing isn't consistent and should not be considered the "right" version.--><br />
''Kung Fu Hustle'' makes references to a wide range of films, [[animated cartoon]]s, [[wuxia]] novels and other sources. Sing and Bone resemble George Milton and Lennie Small from the 1992 film [[Of Mice and Men (1992 film)|''Of Mice and Men'']].<ref name="Parodies and references">Kung Fu Hustle {{cite web |title=Movie Classic – Kung Fu Hustle (2004)|url=http://www.stuff.tv/news/life-etc/movie-classics/movie-classic-kung-fu-hustle-2004 |publisher= stuff.tv|accessdate=13 March 2013}}</ref> The housing arrangement of the Pig Sty Alley is similar to that of a 1973 Hong Kong film, ''[[The House of 72 Tenants]]''. There are two references to Chow's previous film, ''Shaolin Soccer. ''When Sing arrives at Pig Sty Alley, he plays skillfully with a soccer ball, then says, "You're still playing football?". The second reference is the scene in which a clerk beats Sing up on a bus. The clerk also appeared in ''Shaolin Soccer'' as the leader of an opposing team who used hidden weapons to beat up the Shaolin soccer team. When Sing challenges a boy in the Pig Sty Alley, Sing calls him "The Karate Kid", a reference to [[The Karate Kid (1984 film)|the 1984 film of the same name]]. During the altercation between Sing and the hairdresser, the hairdresser states, "Even if you kill me, there will be thousands more of me!". This is a reference to a famous quote made by [[Lu Haodong]], a Chinese revolutionary in the late [[Qing Dynasty]].<ref name="Ru Lai Shen Zhang">{{cite web|title = 從金剛腿到如來神掌—論《功夫》(From the Steel Leg to Ru Lai Shen Zhang, Kung Fu Hustle)|publisher = Department of Chinese Literature, Sun-Yat-Sen university|date = 21 April 2005|url = http://www.chinese.nsysu.edu.tw/932chp/article/f04.htm|accessdate = 2007-05-04 |archiveurl = http://web.archive.org/web/20070529141707/http://www.chinese.nsysu.edu.tw/932chp/article/f04.htm <!-- Bot retrieved archive -->|archivedate = 29 May 2007|language=zh}}</ref> The scene in which Sing is chased by the Landlady as he flees from the Alley is a homage to [[Wile E. Coyote and Road Runner]], characters in the ''[[Looney Tunes]]'' cartoons, even including the pursuer's (the Landlady's) ill fate. In the scene in which Sing robs the ice cream vendor, a poster for the 1935 film ''[[Top Hat]]'' is in the background. As Sing arrives at the door to the Beast's cell in the mental asylum, he hallucinates a large wave of blood rushing from the cell door, similar to a scene in ''[[The Shining (film)|The Shining]]''.<ref><br />
{{cite web|last = Glaze|first = Violet|title = Review: Kung Fu Hustle|work = Citypaper Film|date = 20 April 2005|url = http://citypaper.com/film/review.asp?rid=8708|accessdate = 2007-07-10 }}</ref><br />
<br />
A major element of the plot is based on the wuxia film series ''Palm of Ru Lai'' (如來神掌), released in 1964.<ref name="Palm of Ru Lai">Kung Fu Hustle {{cite web |title=Navigating Netflix: Kung Fu Hustle|url=http://www.spectatortribune.com/article/navigating-netflix-kung-fu-hustle/ |publisher= pectatortribune.com|accessdate=13 March 2013}}</ref> Sing studied the fighting style used in ''Palm of Ru Lai'' ("[[Fut Gar|Buddhist Palm style]]"), from a young age and used it at the end of ''Kung Fu Hustle''. In reality, the Buddhist Palm fighting style does not leave palm-shaped craters and holes on impact. Instead, the user delivers powerful punches using his palm. The Beast's name in Chinese, ''Huoyun Xieshen'' (火雲邪神; Evil Deity of the Fiery Cloud), and the fight with the Landlady and her husband are also references to the ''Palm of Ru Lai,'' in which a mortally wounded master strikes the patterns of his art's final techniques into a bell so that his apprentice can learn from it.<ref>{{cite web|title = Plot summary of Ru Lai Shen Zhang|publisher = Pearlcity|url = http://www.pearlcity.com.hk/f4.htm|accessdate = 2007-05-17 |language=zh}}</ref> ''Kung Fu Hustle'' also contains direct references to characters from [[Jin Yong|Louis Cha]]'s wuxia novels. For example, the landlord and landlady refer to themselves as [[Yang Guo]] and [[Xiaolongnü]], the names of characters in Cha's ''[[The Return of the Condor Heroes]]'', when they met the Beast.<ref>{{cite web|title = 神鵰俠侶‧人物介紹 (Character introduction of The Return of the Condor Heroes)|publisher = [[Television Broadcasts Limited|TVB]]|url = http://tvcity.tvb.com/drama/the_saviour_of_the_soul/cast/index.html|accessdate = 2007-05-04 |language=zh}}</ref><br />
<br />
[[File:Kung fu hustle matrix parody.jpg|thumb|An aerial shot of Sing fighting the Axe Gang. The fight is reminiscent of ''[[The Matrix Reloaded]]''.|225px|right]]<br />
References to gangster films are also present. The boss of the Axe Gang, Brother Sum (琛哥) is named after Hon Sam / Hon Sum (韓琛), the triad boss played by [[Eric Tsang]] in ''[[Infernal Affairs]]''.<ref>{{cite web|title = Infernal Affairs Summary|publisher = Star Boulevard|url = http://movie.starblvd.net/cgi-bin/movie/euccns?/film/2002/InfernalAffairs/InfernalAffairs.html|accessdate = 2007-05-14 |archiveurl = http://web.archive.org/web/20070503100807/http://movie.starblvd.net/cgi-bin/movie/euccns?/film/2002/InfernalAffairs/InfernalAffairs.html <!-- Bot retrieved archive --> |archivedate = 3 May 2007|language=zh}}</ref> The Harpists imitate ''[[The Blues Brothers (film)|The Blues Brothers]]'', wearing similar hats and sunglasses at all times.<ref name="Parodies and references 3">Kung Fu Hustle {{cite web |title=CHOW, STEPHEN – KUNG FU HUSTLE|url=http://www.urbancinefile.com.au/home/view.asp?a=10653|publisher= urbancinefile.com.au|accessdate=13 March 2013}}</ref> When they are flattered by the Axe Gang advisor, one of them answers "Strictly speaking we're just musicians", similar to a line by Elwood Blues.<ref>{{cite AV media|people = Dan Aykroyd|title = The Blues Brothers|medium = DVD|publisher = Universal Pictures|location = Chicago|year = 1980 }}</ref><br />
<br />
When Donut dies, he says, "In great power lies great responsibility", a reference to ''[[Spider-Man (2002 film)|Spider-Man]]'', said by [[Uncle Ben]] before his death.<ref name="Ru Lai Shen Zhang"/> Afterwards, with his dying breath, Donut gets up, grabs the Landlord by the shirt and utters in English, "What are you prepared to do?", a nod to [[Sean Connery]]'s character Jim Malone in [[Brian De Palma]]'s 1987 film ''[[The Untouchables (film)|The Untouchables]].''<ref name="Parodies and references" /><ref>{{cite AV media|people = Sean Connery|title = The Untouchables|medium = DVD|publisher = Paramount Pictures|location = Chicago|year = 1987 }}</ref><br />
<br />
The dialogue that the Beast says while negotiating with the Axe Gang for killing the Landlady and Landlord – "...then young friend, I will make an offer you cannot refuse", is a reference of the dialogue from the movie 'The Godfather'.<ref name="Parodies and references" /> Also, the Landlady's comment to Brother Sum – "We brought a gift you cannot refuse" is an obvious parody of [[The Godfather#American Film Institute|the same]], to which Sum replies (in the dubbed version of the film), "Ha! With the Beast on our side, we shall see for whom the bell tolls", a reference to [[For Whom the Bell Tolls (film)|the 1943 film]].<ref>{{cite AV media|people = |title = For Whom the Bell Tolls|medium = DVD|publisher = Universal Pictures|location = |year = 1943 }}</ref><br />
<br />
The final fight between Sing (who has been reborn into "the one", which pays homage to Bruce Lee by wearing his costume in ''Enter the Dragon'' and using his fighting style) and the hundreds of gangsters imitates the fight between [[Neo (The Matrix)|Neo]] and hundreds of [[Agent Smith]]s in ''[[The Matrix Reloaded]]''.<ref name=Szeto/><ref name="Ru Lai Shen Zhang"/> The scene in which the Beast prompts an axe member to punch him harder is reminiscent of a similar scene in ''[[Raging Bull]]'', with [[Robert De Niro]]'s character prompting [[Joe Pesci]]'s character.<ref name="Parodies and references" /><br />
<br />
The last scene, in which the beggar tries to sell martial arts manuals, refers directly to the greatest skills in Louis Cha's ''[[Condor Trilogy]]'' (''[[Jiuyang Zhenjing|Nine Yang Manual]]'', "Yiyang Finger", and "[[Beggars' Sect|Eighteen Dragon Subduing Palms]]"), "Thousand Hand Divine Fist", and ''[[The Smiling, Proud Wanderer]]'' ("[[Dugu Qiubai|Nine Swords of Dugu]]"). The scene in which the landlady confronts Brother Sum in the back of his car is a homage to Bruce Lee in ''[[Way of the Dragon]]'', where he cracks his knuckles and gives a quick upper nod to the mafia boss, telling him to back off.<ref name="Parodies and references 2">Kung Fu Hustle {{cite web |title=GOING TO THE SOURCE: KUNG FU HUSTLE AND ITS CINEMATIC ROOTS AT THE 29TH HKIFF|url=http://www.hkcinemagic.com/en/page.asp?aid=135&page=7 |publisher= stuff.tv|accessdate=13 March 2013}}</ref><br />
<br />
==Releases==<br />
''Kung Fu Hustle'' premiered at the [[2004 Toronto International Film Festival]].<ref>{{cite web|title=Kung Fu Hustle Premieres in Toronto|url=http://www.china.org.cn/english/features/film/107258.htm|publisher=[[China Internet Information Center]]|accessdate=4 July 2013}}</ref> It was later released across East Asia including China, Hong Kong and Malaysia in December 2004.<ref>{{cite web |last= Kay |first= Jeremy |coauthors= |title=Kung Fu Hustle Smashes Asian Records Through SPRI |url=http://www.screendaily.com/kung-fu-hustle-smashes-asian-records-through-spri/4021447.article |date=27 December 2004 |work= |publisher=[[Screen International]] |accessdate=4 July 2013}}</ref> The film was first shown in the US at the [[Sundance Film Festival]] in January 2005,<ref>{{cite news|last=Booth|first=William|title=A Way With the Punch Line|accessdate=4 July 2013|newspaper=[[The Washington Post]]|date=21 April 2005}}</ref> and then opened in a general release on 22 April 2005 after being shown in Los Angeles and New York for two weeks.<ref>{{cite news|last=Kehr|first=Dave|title=Excuse Me While I Kiss the Buddha in the Sky|url=http://www.nytimes.com/2005/04/03/movies/03kehr.html?_r=0|accessdate=4 July 2013|newspaper=[[The New York Times]]|date=3 April 2005}}</ref><br />
<br />
The North American DVD release was on 8 August 2005.<ref name = "Rotten Tomatoes"/> A [[Blu-ray Disc|Blu-ray]] version of the DVD was released on 12 December 2006 by Sony Pictures. A UMD version of the film was released for the PlayStation Portable.<ref>{{cite web|url=http://www.allmovie.com/movie/kung-fu-hustle-v314244/releases|work=Allmovie|publisher=[[Rovi Corporation]]|title=Kung Fu Hustle (2004) - Releases|accessdate= 2 July 2013}}</ref> The United States DVD releases was censored and cut in a number of scenes that featured a lot of blood or human excrement, a later release saw these edits removed.<ref>{{cite web|title=Comparison of the cut US cinema version (R-rated) and the uncut Hong kong version|url=http://www.movie-censorship.com/report.php?ID=858212|publisher=movie-censorship.com|accessdate=8 July 2013}}</ref><ref>{{cite web|title=Kung Fu Hustle Region One Cuts (US - )|url=http://www.dvdactive.com/editorial/articles/kung-fu-hustle-region-1-cuts.html|publisher=dvdactive.com|accessdate=8 July 2013}}</ref><br />
<br />
In the United Kingdom the standard DVD was released 24 October 2005, the same day a special edition was released with collect item which included playing cards, keyring, sweat band and an inflatable axe.<ref>{{cite web|title=Kung Fu Hustle DVD 2005|url=http://www.amazon.co.uk/Kung-Hustle-DVD-Stephen-Chow/dp/B000AAVDGA|publisher=amazon.co.uk|accessdate=8 July 2013}}</ref><ref>{{cite web|title=Kung Fu Hustle DVD Special Edition|url=http://www.amazon.co.uk/Kung-Hustle-DVD-Stephen-Chow/dp/B000B6F8YG|publisher=amazon.co.uk|accessdate=8 July 2013}}</ref> On 8 April 2007 Sony Pictures Home Entertainment release a Blu-ray version.<ref>{{cite web|title=Kung Fu Hustle Blu-ray 2007|url=http://www.amazon.co.uk/Kung-Hustle-Blu-ray-Region-Free/dp/B000IHYBTG|publisher=amazon.co.uk|accessdate=8 July 2013}}</ref><br />
<br />
The [[Portuguese language|Portuguese]] title of the film is ''Kungfusão'', which sounds like Kung Fu and ''Confusão'' (confusion).<ref>{{cite web|title = Filme – Kung-fusão (Kung Fu Hustle)|publisher = CinePop|url = http://www.cinepop.com.br/filmes/kungfusao.htm|accessdate = 2007-05-06 |language=pt}}</ref> In the same way as ''Kungfusão'', the Italian and Spanish titles were ''Kung-fusion'' and ''Kung-fusión'', puns of "confusion".<ref>{{cite web<br />
|title = Official site of Kung-fusion<br />
|publisher = Sony Pictures Releasing International<br />
|url = http://www.kung-fusion.it/|accessdate = 2007-05-06 |archiveurl=http://web.archive.org/web/20060506211501/http://www.kung-fusion.it/<br />
|archivedate=6 May 2006}}</ref><ref>{{cite web|title = Spanish review of Kung-fusión|publisher = Fotograma|url = http://fotograma.com/notas/reviews/3724.shtml|accessdate = 2007-05-06 |language=es}}</ref> In France, the film is known as ''Crazy Kung Fu'', and the [[Hungarian language|Hungarian]] title is ''A Pofonok Földje'', meaning ''The Land of Punches''.<ref>{{cite web|title = Crazy kung-fu|publisher = Allocine|date = 8 June 2005|url = http://www.allocine.fr/film/fichefilm_gen_cfilm=57959.html|accessdate = 2007-05-14 |language=fr}}</ref><ref>{{cite web|last = Viktor|first = Szekeres|title = A pofonok földje – Stephen Chow megmutatja|publisher = SG.hu|date = 9 July 2005|url = http://www.sg.hu/cikkek/38013/a_pofonok_foldje_stephen_chow_megmutatja|accessdate = 2007-05-14 |language=hu}}</ref><br />
<br />
In Korea a Limited Collector's Edition DVD was released which included a leather wallet, Stephen Chow's Palm Figure with his signature, a photo album and Special Kung Fu's Booklet with a Certificate of authenticity.<ref>{{cite web|title=Kung Fu Hustle Limited Edition (Korean Version) DVD Region 3|url=http://www.yesasia.com/global/kung-fu-hustle-limited-edition-korean-version/1003974352-0-0-0-en/info.html|publisher=yesasia.com|accessdate=6 July 2013}}</ref><br />
<br />
==Reception==<br />
The film was generally well received by critics, earning the score of 90% fresh on [[Rotten Tomatoes]] based on a total of 166 reviews.<ref name = "Rotten Tomatoes">{{cite web|title = Kung Fu Hustle|work = Rotten Tomatoes|url = http://www.rottentomatoes.com/m/kung_fu_hustle/|accessdate = 2 July 2013|publisher=Flixster }}</ref> Hong Kong director and film critic Gabriel Wong praised the film for its [[black comedy]], special effects and nostalgia, citing the return of many retired kung fu actors from the 1970s.<ref>{{cite web|last = Wong|first = Gabriel|script-title=zh:周星驰显大将风范|language = Chinese|agency = Xinhua News Agency|date = 28 December 2004|url = http://news.xinhuanet.com/ent/2004-12/28/content_2387471.htm|accessdate = 2009-04-14 }}</ref> Film critic [[Roger Ebert]] description of the film ("like Jackie Chan and Buster Keaton meet Quentin Tarantino and Bugs Bunny"), was printed on the promotion posters for Kung Fu Hustle in the US.<ref>{{cite news|last = Ebert|first = Roger|title = Kung Fu Hustle Review|publisher = Roger Ebert|date = 21 April 2005|url = http://www.rogerebert.com/reviews/kung-fu-hustle-2005|accessdate = 2013-07-01 }}</ref><ref>{{cite news|title = Kung Fu Hustle promotional poster in the United States|date = 22 April 2005|url = http://rogerebert.suntimes.com/apps/pbcs.dll/article?AID=/20050422/REVIEWS/50411001/1023|accessdate = 2007-05-13|work=Chicago Sun-Times}}</ref><ref>{{cite web|title = Kung Fu Hustle|publisher = [[MovieWeb]]|url = http://www.movieweb.com/movies/film/78/2678/poster1.php|accessdate = 2007-05-13 |archiveurl = http://web.archive.org/web/20070930204701/http://www.movieweb.com/movies/film/78/2678/poster1.php <!-- Bot retrieved archive --> |archivedate = 30 September 2007}}</ref> Other critics described it as a comedic version of ''Crouching Tiger, Hidden Dragon''.<ref>{{cite web|last = Douglas|first = Michael|title = Kung Fu Hustle Review|publisher = Comingsoon.net|url = http://www.comingsoon.net/news/reviewsnews.php?id=9049|accessdate = 2007-05-28 }}</ref> Positive reviews generally gave credit to the elements of [[mo lei tau]] comedy present in the film.<ref>{{cite web|url=http://www.radiotimes.com/film/vhsj/kung-fu-hustle-(2004)|title=Kung Fu Hustle|work=Radio Times|accessdate=2013-06-01}}</ref> A number of reviewers viewed it as a computer-enhanced Looney Tunes punch-up.<ref name = "Rotten Tomatoes"/><ref>{{cite web|url=http://www.bbc.co.uk/films/2005/05/23/kung_fu_hustle_2005_review.shtml|author=Arendt, Paul|publisher=BBC|date=24 June 2005|title=Kung Fu Hustle (2005)|accessdate=2009-06-05}}</ref> In a 2010 ''[[GQ]]'' interview, actor [[Bill Murray]] called ''Kung Fu Hustle'' "the supreme achievement of the modern age in terms of comedy".<ref>{{cite web|last=Fierman|first=Dan|title=Bill Murray Is Ready To See You Now|url=http://www.gq.com/entertainment/celebrities/201008/bill-murray-dan-fierman-gq-interview?currentPage=2|work=GQ|accessdate=2 October 2011}}</ref><br />
<br />
Much of the criticism for the film was directed at its lack of character development and a coherent plot. ''Las Vegas Weekly'', for instance, criticised the film for not enough of a central protagonist and character depth.<ref>{{cite web|last = Bell|first = Josh|title = Screen: Kung Fu Hustle|publisher = Las Vegas Weekly|date = 21 April 2005|url = http://www.lasvegasweekly.com/2005/04/21/screen2.html|accessdate = 2007-05-04 |archiveurl = http://web.archive.org/web/20070421013406/http://www.lasvegasweekly.com/2005/04/21/screen2.html <!-- Bot retrieved archive -->|archivedate = 21 April 2007}}</ref> Criticisms were also directed at the film's cartoonish and childish humour.<ref>{{cite web|first = Scott|author = Patrick|title = Kung Fu Hustle movie review|publisher = Threemoviebuffs|date = 24 April 2005|url = http://www.threemoviebuffs.com/review.php?movieID=kungfuhustle|accessdate = 2007-05-04 }}</ref> [[Richard Roeper]] gave it a negative review, saying he had "never been a fan of that over the top slapstick stuff".<ref>{{cite web|last = Holtreman|first = Vic|title = Ebert and *cough* Roeper: Anyone Still Watch This Show?|publisher = Screen Rant|date = 19 April 2005|url = http://screenrant.com/ebert-and-cough-roeper-anyone-still-watch-this-show-vic-322/|accessdate = 2008-08-08 }}</ref><br />
<br />
===Box office===<br />
''Kung Fu Hustle'' opened in Hong Kong on 23 December 2004, and earned [[HK$]]4,990,000 on its opening day. It stayed at the top of the box office for the rest of 2004 and for much of early 2005, eventually grossing HK$61.27 million. Its box office tally made it the highest-grossing film in Hong Kong history,<ref name="variety-apple">{{cite web|url=http://variety.com/2012/film/news/borders-in-disorder-1118049322/|work=[[Variety (magazine)|Variety]]|title=Borders in disorder|accessdate=2 July 2013|date=14 February 2012|author=Coonan, Clifford}}</ref> until it was beaten by ''[[You Are the Apple of My Eye]]'' in 2011.<ref name="variety-apple" /><br />
<br />
''Kung Fu Hustle'' began a limited two-week theatrical run in New York City and Los Angeles on 8 April 2005 before being widely released across North America on 22 April. In its first week of limited release in seven cinemas, it grossed US$269,225 (US$38,461 per screen).<ref>{{cite web|last = Strowbridge|first = C.S.|title = Hustle and Bustle|publisher = The Numbers|date = 12 April 2005|url = http://www.the-numbers.com/interactive/newsStory.php?newsID=1203|accessdate = 2007-05-03 }}</ref> When it was expanded to a wide release in 2,503 cinemas, the largest number of cinemas ever for a foreign language film, it made a modest US$6,749,572 (US$2,696 per screen), eventually grossing a total of US$17,108,591 in 129 days. In total, ''Kung Fu Hustle'' had a worldwide gross of US$101,104,669.<ref>{{cite web|title = Kung Fu Hustle Box Office Data|publisher = The Numbers|url = http://www.the-numbers.com/movies/2005/KFHUS.php|accessdate = 2007-05-03 }}</ref> While not a blockbuster, ''Kung Fu Hustle'' managed to become the highest-grossing foreign language film in North America in 2005<ref>{{cite web |title=Highest Grossing Foreign Language Films |url=http://boxofficemojo.com/genres/chart/?id=foreign.htm |work=[[Box Office Mojo]] |accessdate=29 July 2009|publisher=Internet Movie Database}}</ref> and went on to gain a [[cult following]] on DVD.<ref name=USbox>{{cite web | last = Scheidt | first = Jason | title = Do the Hustle | publisher = iMedia Connection | url = http://www.imediaconnection.com/content/6581.asp | accessdate = 2 July 2013 }}</ref><br />
<br />
===Awards and nominations===<br />
The film was nominated for sixteen [[Hong Kong Film Awards]], out of which winning: Best Picture, Best Action Choreography, Best Film Editing, Best Sound Effects, Best Supporting Actor and Best Visual Effects.<ref name="HKFA"/> Five more awards were later picked up at the [[Golden Horse Awards]] including an award for Best Director for Stephen Chow.<ref name="Golden Horse"/> In the United States ''Kung Fu Hustle'' was well received by various film critic associations winning awards for Best Foreign Language Film<br />
from [[Boston Society of Film Critics Awards|Boston]], [[Chicago Film Critics Association Awards|Chicago]], Las Vagas and Phoenix based critics.<ref name="NYT Awards"/> it was later nominated for six [[Satellite Awards]]<ref name="Satellite Awards"/> and one [[MTV Movie Award]] for best fight scene.<ref name="MTV Movie Awards"/> In the United Kingdom at [[59th British Academy Film Awards]] the film was nominated for a [[BAFTA]].<ref name="BAFTA"/><br />
<br />
In 2011, the [[Taipei Golden Horse Film Festival]] listed ''Kung Fu Hustle'' at number 48 in their list of "100 Greatest Chinese-Language Films".<ref name="fba-horse">{{cite web|url=http://www.filmbiz.asia/news/horse-announces-greatest-chinese-films|work=Film Business Asia|title=Horse announces greatest Chinese films|accessdate=17 July 2013|author=Cremin, Stephen|date=27 January 2011}}</ref> The majority of the voters originated from Taiwan, and included film scholars, festival programmers, film directors, actors and producers.<ref name="fba-horse" /> In 2014, ''[[Time Out (magazine)|Time Out]]'' polled several film critics, directors, actors and stunt actors to list their top action films.<ref>{{cite web|url=http://www.timeout.com/newyork/film/best-action-movies|work=[[Time Out (magazine)|Time Out]]|title=The 100 best action movies|accessdate=7 November 2014}}</ref> ''Kung Fu Hustle'' was listed at 50th place on this list.<ref>{{cite web|url=http://www.timeout.com/newyork/film/the-100-best-action-movies-50-41|work=Time Out|accessdate=7 November 2014|date=3 November 2014|title=The 100 best action movies: 50-41}}</ref><br />
<br />
{| class="collapsible collapsed" style="width:100%; border:1px solid #cedff2; background:#F5FAFF"<br />
|-<br />
<br />
! style="text-align:left;"| List of awards and nominations<br />
|-<br />
| <!-- PLACE EXTRA AWARDS BELOW IN ALPHABETICAL ORDER --><br />
<br />
{| class="wikitable" style="font-size:90% width=100%;"<br />
|-<br />
! style= width="28%"| Award / Film Festival<br />
! style= width="26%"|Category<br />
! style= width="36%"|Recipient(s)<br />
! style= width="10%"|Result<br />
|-<br />
|rowspan="1"|[[Imagine Film Festival|Amsterdam Fantastic Film Festival]]<ref>{{cite web|title=Awards|url=http://www.imaginefilmfestival.nl/over-het-festival/awards|publisher=Imagine Film Festiva|accessdate=5 July 2013}}</ref><br />
|Stephen Chow<br />
|<br />
|{{Won}}<br />
|-<br />
|rowspan="1"|[[BAFTA Awards]]<ref name="BAFTA">{{cite web|title=Film not in the English Language in 2006|url=http://awards.bafta.org/award/2006/film/film-not-in-the-english-language|publisher=[[BAFTA]]|accessdate=5 July 2013}}</ref><br />
|Best Film not in the English Language<br />
|Stephen Chow <br>Bo-Chu Chui<br>Jeffrey Lau<br />
|{{Nom}}<br />
|-<br />
|rowspan="1"|[[Boston Society of Film Critics Awards]]<ref>{{cite web|title=Past Award Winners|url=http://www.bostonfilmcritics.org/content/past-award-winners|publisher=[[Boston Society of Film Critics Awards]]|accessdate=5 July 2013}}</ref><br />
|Best Foreign Language Film China/Hong Kong<br />
|<br />
|{{Won}}<br />
|-<br />
|rowspan="1"|[[Broadcast Film Critics Association Awards]]<ref name="NYT Awards">{{cite web|title=Kung Fu Hustle (2004)|url=http://movies.nytimes.com/movie/314244/Kung-Fu-Hustle/awards|publisher=[[New York Times]]|accessdate=5 July 2013}}</ref><br />
|Best Foreign-Language Film<br />
|<br />
|{{Won}}<br />
|-<br />
|rowspan="1"|[[Chicago Film Critics Association Awards]]<ref name="NYT Awards"/><br />
|Best Foreign Language Film China/Hong Kong.<br />
|<br />
|{{Nom}}<br />
|-<br />
|rowspan="1"|[[Florida Film Critics Circle Awards]]<ref>{{cite web|title=FFCC Award Winners|url=http://floridafilmcriticscircle.webs.com/awards.htm|publisher=[[Florida Film Critics Circle]]|accessdate=5 July 2013}}</ref><br />
|Best Foreign Film<br />
|<br />
|{{Won}}<br />
|-<br />
|rowspan="1"|[[Golden Globe Award]] (USA)<ref>{{cite web|title=Awards Search|url=http://www.goldenglobes.org/browse/?param=/film/26015|publisher=[[Golden Globe Award]]|accessdate=5 July 2013}}</ref><br />
|Best Foreign Language FilmChina.<br />
|<br />
|{{Nom}}<br />
|-<br />
|rowspan="10"|[[Golden Horse Awards]]<ref name="Golden Horse">{{cite web|title=Award Archive|url=http://www.goldenhorse.org.tw/ui/index.php?class=ghac&func=archive&search_regist_year=2005&nwlist_type=award|publisher=[[Golden Horse Film Festival and Awards]]|accessdate=5 July 2013}}</ref><br />
|Best Director<br />
|Stephen Chow<br />
|{{Won}}<br />
|-<br />
|Best Film<br />
|<br />
|{{Won}}<br />
|-<br />
|Best Make Up & Costume Design<br />
|Shirley Chan<br />
|{{Won}}<br />
|-<br />
|Best Supporting Actress<br />
|Qiu Yuen<br />
|{{Won}}<br />
|-<br />
|Best Visual Effect<br />
|Frankie Chung <br>Don Ma Tam <br>Kai Kwan <br> Hung Franco<br />
|{{Won}}<br />
|-<br />
|Best Action Choreography<br />
|Woo-ping Yuen<br />
|{{nom}}<br />
|-<br />
|Best Art Direction<br />
|Oliver Wong<br />
|{{nom}}<br />
|-<br />
|Best Editing<br />
|Angie Lam<br />
|{{nom}}<br />
|-<br />
|Best Sound Effects<br />
|Steve Burgess <br>Steven Ticknor <br>Robert Mackenzie<br> Paul Pirola<br />
|{{nom}}<br />
|-<br />
|Best Supporting Actor<br />
|Wah Yuen<br />
|{{nom}}<br />
|-<br />
|rowspan="1"|[[Golden Trailer Awards]]<ref>{{cite web|title=6th Annual Golden Trailer Award Winner and Nominees|url=http://www.goldentrailer.com/awards.gta6.php|publisher=[[Golden Trailer Awards]]|accessdate=5 July 2013}}</ref><br />
|Best Foreign<br />
|(Winston Davis & Associates).<br />
|{{nom}}<br />
|-<br />
|rowspan="16"|[[Hong Kong Film Awards]]<ref name="HKFA">{{cite web|title=List of Award Winner of The 24th Hong Kong Film Awards|url=http://www.hkfaa.com/winnerlist24.html|publisher=[[Hong Kong Film Awards]]|accessdate=5 July 2013|language=Traditional Chinese/English}}</ref><br />
|Best Action Choreography<br />
|Woo-ping Yuen<br />
|{{Won}}<br />
|-<br />
|Best Film Editing<br />
|Angie Lam<br />
|{{Won}}<br />
|-<br />
|Best Picture<br />
|<br />
|{{Won}}<br />
|-<br />
|Best Sound Effects<br />
|Steven <br> Ticknor <br>Steve Burgess <br>Robert Mackenzie<br> Paul Pirola<br />
|{{Won}}<br />
|-<br />
|Best Supporting Actor<br />
|Wah Yuen<br />
|{{Won}}<br />
|-<br />
|Best Visual Effects<br />
|Frankie Chung Ma<br> Wing-On Tam<br> Kai-Kwun Hung<br> Lau-Leung<br />
|{{Won}}<br />
|-<br />
|Best Actor<br />
|Stephen Chow<br />
|{{Nom}}<br />
|-<br />
|Best Actress<br />
|Qiu Yuen<br />
|{{Nom}}<br />
|-<br />
|Best Art Direction<br />
|Oliver Wong<br />
|{{Nom}}<br />
|-<br />
|Best Cinematography<br />
|Hang-Sang Poon<br />
|{{Nom}}<br />
|-<br />
|Best Costume Design and Make Up<br />
|Shirley Chan<br />
|{{Nom}}<br />
|-<br />
|Best Director<br />
|Stephen Chow<br />
|{{Nom}}<br />
|-<br />
|Best New Artist<br />
|Shengyi Huang<br />
|{{Nom}}<br />
|-<br />
|Best Original Film Score<br />
|Ying-Wah Wong<br />
|{{Nom}}<br />
|-<br />
|Best Screenplay<br />
|Stephen Chow <br>Kan-Cheung Tsang <br>KXin Huo <br>KMan Keung Chan<br />
|{{Nom}}<br />
|-<br />
|Best Supporting Actor<br />
|Kwok-Kwan Chan<br />
|{{Nom}}<br />
|-<br />
|rowspan="1"|[[Hong Kong Film Critics Society Awards]]<ref>{{cite web|script-title=zh:第十一屆香港電影評論學會大獎頒獎禮|url=http://www.filmcritics.org.hk/taxonomy/term/5/40|publisher=[[Hong Kong Film Critics Society]]|accessdate=5 July 2013|language=Chinese}}</ref><br />
|Film of Merit<br />
| <br />
|{{Won}}<br />
|-<br />
|rowspan="6"|[[Hundred Flowers Awards]]<ref>{{cite web|title=Hundred Flowers Movie Awards Presented|url=http://www.china.org.cn/english/entertainment/186799.htm|publisher=[[China Internet Information Center]]|accessdate=5 July 2013}}</ref><br />
|Best Supporting Actress<br />
|Qiu Yuen<br />
|{{Won}}<br />
|-<br />
|Best Actor<br />
|Stephen Chow<br />
|{{Nom}}<br />
|-<br />
|Best Director<br />
|Stephen Chow<br />
|{{Nom}}<br />
|-<br />
|Best Film<br />
|<br />
|{{Nom}}<br />
|-<br />
|Best Newcomer<br />
|Shengyi Huang<br />
|{{Nom}}<br />
|-<br />
|Best Supporting Actor<br />
|Wah Yuen<br />
|{{Nom}}<br />
|-<br />
|rowspan="1"|Las Vegas Film Critics Society Awards<ref name="NYT Awards"/><br />
|Best Foreign Film<br />
|<br />
|{{Won}}<br />
|-<br />
|rowspan="1"|[[MTV Movie Awards]]<ref name="MTV Movie Awards">{{cite web|title=2006 Movie Awards Winners|url=http://www.mtv.com/ontv/movieawards/2006/|publisher=[[MTV Movie Awards]]|accessdate=5 July 2013}}</ref><br />
|Best Fight<br />
|<br />
|{{Nom}}<br />
|-<br />
|rowspan="1"|[[Motion Picture Sound Editors]] (USA)<ref>{{cite web|title=Kung Fu Hustle (2004) Awards|url=http://www.whosdatedwho.com/tpx_633497/kung-fu-hustle/awards|publisher=whosdatedwho.com|accessdate=5 July 2013}}</ref><br />
|Best Sound Editing in Feature Film - Foreign<br />
|Steve Burgess (supervising sound editor) <br><br />
Chris Goodes (sound editor)<br><br />
Vic Kaspar (sound editor) <br><br />
Jo Mion (sound editor) <br><br />
Andrew Neil (sound editor) <br><br />
Paul Pirola (sound design) <br><br />
Steven Ticknor (sound design) <br><br />
Mario Vaccaro (foley artist) <br><br />
|{{Nom}}<br />
|-<br />
|rowspan="1"|[[Online Film Critics Society Awards]]<ref>{{cite web|title=2005 Awards (9th Annual)|url=http://www.ofcs.org/awards/2005-awards-9th-annual/|publisher=[[Online Film Critics Society]]|accessdate=5 July 2013}}</ref><br />
|Best Foreign Language Film<br />
|<br />
|{{Nom}}<br />
|-<br />
|rowspan="1"|Phoenix Film Critics Society Awards<ref name="NYT Awards"/><br />
|Best Foreign Language Film<br />
|Stephen Chow<br />
|{{Won}}<br />
|-<br />
|rowspan="6"|[[Satellite Awards]]<ref name="Satellite Awards">{{cite web|title=10th Anniversary Satellite Awards|url=http://web.archive.org/web/20060507220009/http://www.pressacademy.com/satawards/forms/pdf/ipasat10th-PR-Noms.pdf|publisher=Press Academy|accessdate=5 July 2013}}</ref><br />
|Outstanding Actress in a Supporting Role, Comedy or Musical<br />
|Qiu Yuen<br />
|{{Nom}}<br />
|-<br />
|Outstanding Cinematography<br />
|Hang-Sang Poon<br />
|{{Nom}}<br />
|-<br />
|Outstanding Film Editing<br />
|Angie Lam<br />
|{{Nom}}<br />
|-<br />
|Outstanding Motion Picture, Comedy or Musical<br />
|<br />
|{{Nom}}<br />
|-<br />
|Outstanding Sound (Mixing & Editing)<br />
|Paul Pirola<br />
|{{Nom}}<br />
|-<br />
|Outstanding Visual Effects<br />
|Frankie Chung<br />
|{{Nom}}<br />
|-<br />
|rowspan="1"|[[Shanghai Film Critics Awards]]<ref>{{cite web|script-title=zh:上海国际电影节:"上海影评人奖"揭晓|url=http://www.china.com.cn/chinese/news/890803.htm|publisher=[[China Internet Information Center]]|accessdate=5 July 2013|language=Chinese}}</ref><br />
|Top 10 Films<br />
| <br />
|{{Won}}<br />
|-<br />
|rowspan="1"|[[Southeastern Film Critics Association Awards]]<ref>{{cite web|title=The Southeastern Film Critics Association 2005|url=http://moviecitynews.com/2006/01/southeastern-film-critics-awards-2005/|publisher=MCN|accessdate=5 July 2013}}</ref><br />
|Best Foreign Language Film China/Hong Kong.<br />
|<br />
|{{Nom}}<br> (Runner-up)<br />
|}<br />
<!-- PLACE EXTRA AWARDS ABOVE --><br />
|}<br />
<br />
==Sequel==<br />
In 2005, Chow announced that there would be a sequel to ''Kung Fu Hustle'', although he had not settled on a female lead. "There will be a lot of new characters in the movie. We'll need a lot of new actors. It's possible that we'll look for people abroad besides casting locals".<ref name="Kung Fu Hustle Rotten Tomatoes">{{cite web|title = Stephen Chow Talks 'Kung Fu Hustle' Sequel|publisher = Rotten Tomatoes|url = http://www.rottentomatoes.com/news/1645682/stephen_chow_talks_quotkung_fu_hustlequot_sequel/|date = 31 August 2005|accessdate = 2007-06-27}}</ref> In January 2013 during an interview Chow admitted that plans for making ''Kung Fu Hustle 2'' have been put on hold. "I was indeed in the midst of making the movie, but it is currently put on hold in view of other incoming projects".<ref>{{cite web|title="Kung Fu Hustle 2" no go|url=http://my.news.yahoo.com/kung-fu-hustle-2-no-042400930.html|publisher=Cinema Online}}</ref> Production of ''Kung Fu Hustle 2'' was delayed while Chow filmed the science fiction adventure film ''[[CJ7]]''. As a result, ''Kung Fu Hustle 2'' is slated for a 2014 release.<ref name="Kung Fu Hustle timeout">{{cite web|title=Stephen Chow offers 'A Hope'|url=http://www.timeout.com/film/news/1284.html|publisher=[[Time Out New York]]|accessdate=7 March 2013|archiveurl=http://web.archive.org/web/20071012190728/http://www.timeout.com/film/news/1284/|archivedate=7 March 2013|date=18 July 2006}}</ref> As of 2015, there has yet to be any confirmed news of the sequel and Stephen is slated to complete another movie, Mermaid, before completing this one.<br />
<br />
==Games==<br />
<br />
===Online and mobile games===<br />
In 2004 a promotional [[flash games]] was released by [[Sony Pictures Entertainment]] on their Japanese website.<ref>{{cite web|script-title=ja:カンフーハッスル|url=http://bd-dvd.sonypictures.jp/kungfuhustle/site/|publisher=[[Sony Pictures Entertainment]]|accessdate=6 July 2013|language=Japanese}}</ref> The game were created by Japanese game developer ''Point Zero'' and plays as a [[point and click]] [[beat 'em up]].<ref>{{cite web|title=Kung Fu Hustle|url=http://www.kibagames.com/Game/Kung_Fu_Hustle|publisher=Kiba Games|accessdate=6 July 2013}}</ref> A [[Side-scrolling video game|side scrolling]] game designed for mobile phones was later released in 2006 by developer ''Tracebit''.<ref>{{cite web|title=Tracebit Catalog|url=http://www.tracebit.com/Tracebit_catalog.pdf|publisher=Tracebit|accessdate=6 July 2013|page=7}}</ref><br />
<br />
===MMO===<br />
In 2007 Sony Online Entertainment announced that a [[Massively multiplayer online game|massively multiplayer online]] 2D [[Side-scrolling video game|side-scrolling]] [[Beat 'em up|fighter game]] based on the film was under development for the Chinese market. Two years later a preview of the game was featured at [[Electronic Entertainment Expo|E3]] were it received mixed reviews from critics with many comparing it to similar MMO games such as ''[[Guild Wars]]'' and ''[[Phantasy Star Online]]''.<ref name="GameSpot">{{cite web|last=Calvert|first=Justin|title=Kung Fu Hustle Hands-On|url=http://uk.gamespot.com/kung-fu-hustle/previews/kung-fu-hustle-hands-on-6211561/|publisher=[[Game Spot]]|accessdate=6 July 2013}}</ref><br />
<br />
A North American release for [[Personal computer|PC]] and [[PS3]] was planned for late 2009<ref name="GameSpot"/> however as of July 2013 the game has not been released and is only available in Asia.<ref>{{cite web|title=Kung Fu Hustle|url=http://uk.ign.com/games/kung-fu-hustle-905752/pc-905728|publisher=[[IGN]]|accessdate=6 July 2013}}</ref><br />
<br />
==See also==<br />
{{Portal|Film}}<br />
*[[Cinema of Hong Kong]]<br />
*[[Cinema of China]]<br />
* [[Chandni Chowk to China]] - A [[Bollywood]] film inspired by the same.<ref>[http://movies.ndtv.com/movie-reviews/chandni-chowk-to-china-370 Chandni Chowk To China]. [[Anupama Chopra]]. [[NDTV]]. 16 January 2009</ref><br />
<br />
==References==<br />
{{reflist|2}}<br />
<br />
==External links==<br />
{{wikiquote}}<br />
*{{official website|http://www.sonyclassics.com/kungfuhustle/splash/stephen/}}<br />
*{{IMDb title|id=0373074}}<br />
*{{rotten-tomatoes|id=kung_fu_hustle}}<br />
*''[http://www.lovehkfilm.com/reviews_2/kung_fu_hustle.htm Kung Fu Hustle]'' at LoveHKFilm.com<br />
*{{Amg movie|314244}}<br />
*{{metacritic film|id=kung-fu-hustle}}<br />
*[http://www.yesasia.com/us/yumcha/0-0-0-arid.21-en/featured-article.html The Six Degrees of Stephen Chow and ''Kung Fu Hustle'']<br />
<br />
{{Stephen Chow}}<br />
{{Broadcast Film Critics Association Award for Best Foreign Language Film}}<br />
{{Best Film HKFA}}<br />
{{GoldenHorseAwardBestFilm}}<br />
<br />
[[Category:2004 films]]<br />
[[Category:2000s martial arts films]]<br />
[[Category:2000s comedy films]]<br />
[[Category:Triad films]]<br />
[[Category:Best Film HKFA]]<br />
[[Category:Cantonese-language films]]<br />
[[Category:Hong Kong films]]<br />
[[Category:Hong Kong action comedy films]]<br />
[[Category:Hong Kong martial arts films]]<br />
[[Category:Chinese films]]<br />
[[Category:Chinese action films]]<br />
[[Category:Kung fu films]]<br />
[[Category:Films set in the 1940s]]<br />
[[Category:Sony Pictures Classics films]]<br />
[[Category:Films set in Shanghai]]<br />
[[Category:Parody films]]<br />
[[Category:Satirical films]]<br />
[[Category:Films directed by Stephen Chow]]<br />
[[Category:Martial arts comedy films]]<br />
[[Category:Martial arts fantasy films]]<br />
[[Category:Films whose director won the Best Director Golden Horse Award]]<br />
[[Category:Slapstick films]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Active_record_pattern&diff=661796271Active record pattern2015-05-11T05:00:37Z<p>PuercoPop: /* Testability */ citations needed</p>
<hr />
<div>In [[software engineering]], the '''active record pattern''' is an [[Architectural pattern (computer science)|architectural pattern]] found in software that stores in-memory object data in [[relational database]]s. It was named by [[Martin Fowler]] in his 2003 book ''Patterns of Enterprise Application Architecture''.<ref>{{cite book |last=Fowler |first=Martin |title=Patterns of enterprise application architecture |publisher=Addison-Wesley |year=2003 |isbn=978-0-321-12742-6 |url=http://books.google.com/books?id=FyWZt5DdvFkC&lpg=PA1&dq=Patterns%20of%20Enterprise%20Application%20Architecture%20by%20Martin%20Fowler&pg=PT187#v=onepage&q=active%20record&f=false }}</ref> The interface of an object conforming to this pattern would include functions such as Insert, Update, and Delete, plus properties that correspond more or less directly to the columns in the underlying database table.<br />
<br />
The active record pattern is an approach to accessing data in a [[database]]. A [[database table]] or [[View (database)|view]] is wrapped into a [[class (computer science)|class]]. Thus, an [[object (computer science)|object]] instance is tied to a single row in the table. After creation of an object, a new row is added to the table upon save. Any object loaded gets its information from the database. When an object is updated the corresponding row in the table is also updated. The wrapper class implements [[accessor]] [[Method (computer programming)|methods]] or properties for each column in the table or view.<br />
<br />
This pattern is commonly used by object persistence tools, and in [[object-relational mapping]] (ORM). Typically, [[foreign key]] relationships will be exposed as an object instance of the appropriate type via a property.<br />
<br />
== Implementations ==<br />
Implementations of the concept can be found in various [[Software framework|framework]]s for many programming environments. For example, if in a database there is a table <code>parts</code> with columns <code>name</code> (string type) and <code>price</code> (number type), and the Active Record pattern is implemented in the class <code>Part</code>, the pseudo-code<br />
<br />
part = new Part()<br />
part.name = "Sample part"<br />
part.price = 123.45<br />
part.save()<br />
<br />
will create a new row in the <code>parts</code> table with the given values, and is roughly equivalent to the [[SQL]] command<br />
<br />
<source lang="sql"><br />
INSERT INTO parts (name, price) VALUES ('Sample part', 123.45);<br />
</source><br />
<br />
Conversely, the class can be used to query the database:<br />
<br />
b = Part.find_first("name", "gearbox")<br />
<br />
This will find a new <code>Part</code> object based on the first matching row from the <code>parts</code> table whose <code>name</code> column has the value "gearbox". The SQL command used might be similar to the following, depending on the SQL implementation details of the database:<br />
<br />
<source lang="sql"><br />
SELECT * FROM parts WHERE name = 'gearbox' LIMIT 1; -- MySQL or PostgreSQL<br />
</source><br />
<br />
=== ColdFusion ===<br />
[[ColdFusion]] has an open source implementation of the Active Record pattern.<br />
<br />
The [[ColdFusion on Wheels]] framework has an implementation of the Active Record pattern. It is open source and has the added advantage of requiring no complex configuration.<br />
<br />
=== PHP ===<br />
<br />
PHP ActiveRecord is one [[open-source]] library designed to fulfill the active record pattern.<ref>{{cite web|title=PHP ActiveRecord|url=http://www.phpactiverecord.org/}}</ref><br />
<br />
Several open-source [[PHP]] frameworks also bundle their own [[Object-relational mapping|ORM]] implementing the active record pattern. Most implementations support relationships, behaviors, [[input validation|validation]], [[serialization]] and support for multiple data sources.<br />
<br />
* [[Boiler MVC|Boiler]], an [[MVC model|MVC]] framework for PHP, contains a set of tools for auto-generation of active record models.<ref>{{cite web|title=Boiler Documentation: Models|url=http://www.bluelightstudios.co.uk/tutorial-4-models/}}</ref> The project, designed for data-centered projects, aims to automate as much of the development process as possible,<ref>{{cite web|title=YouTube demonstration of automation tools|url=https://www.youtube.com/watch?v=M7PG2rTYDGA}}</ref> using [[Apache Ant]]. Although a new addition to Open Source market,<ref>{{cite web|title=Open Source Code, hosted on Github|url=https://github.com/ivebeenlinuxed/Boiler}}</ref> the project is already in use in many live applications, both commercially and open. The framework currently only supports [[MySQL]] though the developers have reported some commercial work in Postgres.<br />
<br />
* [[Cygnite PHP Framework]]'s default database layer implements Active Record pattern which closely resemble with [[Ruby on Rails]].<ref>{{cite web|title=Cygnite Framework Documentation: Active Record|url=http://www.cygniteframework.com/2014/06/active-record.html}}</ref><br />
<br />
* [[Laravel]] contains an ORM called 'Eloquent' which implements the active record pattern, closely resembling that of [[Ruby on Rails]] <ref>{{cite web|title=Laravel Documentation: Eloquent ORM|url=http://laravel.com/docs/eloquent}}</ref><br />
* [[CakePHP]]'s ORM implements the active record pattern,<ref>{{cite web|title=CakePHP (most popular PHP framework)|url=http://stanford.wikia.com/wiki/CakePHP_(most_popular_PHP_framework)|work=Stanford University Wiki}}</ref> but as of version 2.x queries return arrays of data, with levels of '''related data''' as required. Version 3.0 (still in development as of 2014) will use objects.<br />
* [[Lithium (PHP framework)|Lithium]]'s ORM implements active record.<br />
* [[Symfony]]'s default database layer and ORM "[[Doctrine (PHP)|Doctrine]]" does not implement active record but rather a data mapper approach.<br />
<br />
* <span id="codeigniter">[[EllisLab#CodeIgniter|CodeIgniter]]</span> has a query builder it calls "ActiveRecord", but which does not implement the Active Record pattern. Instead, it implements what the user guide refers to as a modified version of the pattern. The Active Record functionality in CodeIgniter can be achieved by using either CodeIgniter DataMapper library or CodeIgniter Gas ORM library.<br />
* [[PHPixie]]'s ORM implements active record.<br />
<br />
* [[Yii]]'s ORM also implements the active record pattern.<ref>{{cite web|title=The Definitive Guide to Yii: Active Record|url=http://www.yiiframework.com/doc/guide/1.1/en/database.ar}}</ref><br />
* [[Propel_(PHP)|Propel]] also implements the active record pattern.<ref>{{cite web|title=Propel: Active Record Reference|url=http://propelorm.org/documentation/reference/active-record.html}}</ref><br />
* Paris is A lightweight Active Record implementation for PHP5, built on top of Idiorm. <ref>{{cite web|title=Github: j4mie/paris|url=https://github.com/j4mie/paris}}</ref><br />
<br />
=== Ruby ===<br />
The [[Ruby (programming language)|Ruby]] library ActiveRecord implements ORM. It creates a [[Persistence (computer science)|persistable]] domain model from business objects and database tables, where logic and data are presented as a unified package. ActiveRecord adds [[Inheritance (computer science)|inheritance]] and [[Association (object-oriented programming)|associations]] to the pattern above, solving two substantial limitations of that pattern. A set of macros acts as a domain language for the latter, and the [[Single Table Inheritance]] pattern is integrated for the former; thus, ActiveRecord increases the functionality of the active record pattern approach to database interaction. ActiveRecord is the default ‘model’ component of the [[model-view-controller]] web-application framework [[Ruby on Rails]], and is also a stand-alone ORM package for other Ruby applications. In both forms, it was conceived of by [[David Heinemeier Hansson]], and has been improved upon by a number of contributors.<ref>{{cite web|url=https://github.com/rails/rails/tree/master/activerecord|title=Ruby Active Record|accessdate=2013-04-12}}</ref><br />
<br />
Other, less popular ORMs have been released since ActiveRecord first took the stage. For example, [[DataMapper (Ruby)|DataMapper]] and [[Sequel (Ruby)|Sequel]] show major improvements over the original ActiveRecord framework.{{POV-statement|date=May 2012}} As a response to their release and adoption by the Rails community, Ruby on Rails v3.0 is independent of an ORM system, so Rails users can easily plug in DataMapper or Sequel to use as their ORM of choice.<br />
<br />
=== Java ===<br />
The [[Java (programming language)|Java language]] implements the Active Record pattern via the [[ActiveJDBC]] library. ActiveJDBC is an implementation of Active Record design pattern inspired by [[Ruby on Rails]] ActiveRecord. ActiveJDBC is lightweight, fast, small and does not require any configuration.<br />
<br />
[[ActiveJPA]] and [[Java Object Oriented Querying|jOOQ (for Java Object Oriented Querying)]] implements the Active record pattern, combining active records with [[Automatic programming|source code generation]] and a querying DSL similar to [[SQL]] allowing for retrieving active records using complex SQL statements.<br />
<br />
The [[Play framework]] is a Java web framework which implements the Active Record pattern, using ideas from [[Ruby on Rails]].<br />
<br />
=== Other languages ===<br />
There are several open source implementations of the Active Record pattern in other languages, including [[JavaScript]] (e.g., [[ActiveJS]]'s Active Record<ref name="ActiveJS">{{cite web|url=http://www.activejs.org/activerecord/ActiveRecord/index.html|title=ActiveJS Active Record|accessdate=2011-07-28}}</ref>), [[Perl]] ([[DBIx::Class]]), [[ActionScript]], [[Python (programming language)|Python]], [[Haxe]] (SPOD<ref name="HaxeSPOD">{{cite web|url=http://haxe.org/manual/spod|title=SPOD Macros|accessdate=2013-01-09}}</ref>), [[C Sharp (programming language)|C#]],<ref name="CastleActiveRecord">{{cite web|title=Castle ActiveRecord|url=http://www.castleproject.org/projects/activerecord/|accessdate=14 January 2014}}</ref> [[Objective-C]]<ref>{{cite web|title=Objective Record|url=https://github.com/mneorr/Objective-Record|accessdate=14 January 2013}}</ref> and [[Scala (programming language)|Scala]].<ref>{{cite web|title=Scala Active Record|url=https://github.com/aselab/scala-activerecord|accessdate=4 December 2013}}</ref><br />
<br />
== Criticism ==<br />
<br />
=== Testability ===<br />
Due to the coupling of database interaction and application logic when using the active record pattern, unit testing an active record object without a database becomes difficult{{ citation needed }}. The negative effects on testability in the active record pattern can be minimized by using [[mock object|mocking]] or [[dependency injection]] frameworks to substitute the real data tier with a simulated one {{ citation needed }}.<br />
<br />
== See also ==<br />
* [[Business object]]<br />
* [[Create, read, update and delete|CRUD]]<br />
* [[Data mapper pattern]]<br />
* [[Object-relational mapping]]<br />
<br />
== References ==<br />
{{Reflist|colwidth=35em}}<br />
<br />
== External links ==<br />
* [https://github.com/rails/rails/tree/master/activerecord Ruby implementation]<br />
* [https://metacpan.org/module/DBIx::Class DBIx::Class Perl Implementation]<br />
* [http://www.phpactiverecord.org/ PHP implementation]<br />
* [http://www.castleproject.org/projects/activerecord/ .NET implementation]<br />
* [http://code.google.com/p/air-activerecord/ AIR Active Record project home]<br />
* [https://github.com/scandio/troba/blob/master/doc/active-record-extension.md troba Active record extension]<br />
<br />
{{Design Patterns Patterns}}<br />
<br />
{{DEFAULTSORT:Active Record Pattern}}<br />
[[Category:Software design patterns]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Saint_Seiya:_Soul_of_Gold&diff=661351629Saint Seiya: Soul of Gold2015-05-08T03:13:16Z<p>PuercoPop: /* Gold Saints */ remove spurious '.'</p>
<hr />
<div>{{Infobox animanga/Header<br />
|name = Saint Seiya - Soul of Gold<br />
|image = [[File:saint-seiya-soul.png|230px]]<br />
|caption = Promotional image for Saint Seiya - Soul of Gold<br />
|ja_kanji = 聖闘士星矢 - 黄金魂<br />
|ja_romaji = Seinto Seiya - Soul of Gold<br />
|genre = [[Martial arts (genre)|Martial arts]], [[Mythic fiction]], [[Drama (genre)|Drama]]<br />
}}<br />
{{Infobox animanga/Video<br />
|type = ona<br />
|title = Saint Seiya: Soul of Gold<br />
|director = Takeshi Furuta<br />
|writer = Toshimitsu Takeuchi<br />
|music = Toshihiko Sahashi<br />
|studio = [[Toei Animation]]<br />
|first = April 11, 2015<br />
|last = <br />
|runtime = <br />
|episodes = 13<br />
|network = [[Bandai Channel]], [[Daisuki]] <br />
|episode_list = <br />
}}<br />
{{Infobox animanga/Other<br />
|title = Related works<br />
|content = <br />
* ''[[List of Saint Seiya films]]''<br />
* ''[[Saint Seiya Episode.G|Saint Seiya: Episode.G]]''<br />
* ''[[Saint Seiya: Next Dimension]]''<br />
* ''[[Saint Seiya: The Lost Canvas]] ([[List of Saint Seiya: The Lost Canvas chapters#Anecdotes chapters|Anecdotes]])''<br />
* ''[[Saint Seiya Omega]]''<br />
* ''[[Saint Seiya - Saintia Shō|Saint Seiya: Saintia Shō]]''<br />
}}<br />
{{Infobox animanga/Footer}}<br />
<br />
{{nihongo|'''''Saint Seiya: Soul of Gold'''''|聖闘士星矢 - 黄金魂 Soul of Gold|Seinto Seiya - Ōgonkon}} is an ongoing [[original net animation|ONA]] [[anime]] series, a spinoff from the classic anime ''[[Saint Seiya]]'', the animated adaptation of [[Masami Kurumada]]'s [[manga]] of the same name.<ref>http://tamashii.jp/special/seiya_sog/ Official website for the series</ref><ref>{{cite web |url= http://www.animenewsnetwork.com/news/2015-02-03/saint-seiya-soul-of-gold-anime-cast-staff-streaming-unveiled/.84027|title= Saint Seiya: Soul of Gold Anime's Cast, Staff, Streaming Unveiled|date= February 3, 2015|accessdate= February 3, 2015|work= [[Anime News Network]]}}</ref><br />
<br />
The series was announced on October 29th at the 2014 Tamashii Nation Figure Expo in Japan, revealing it will focus on the deceased Gold Saints in the aftermath of Athena's battle against Hades in the 20th century.<br />
<br />
It was also revealed that the series approach will be an original anime story, as it won't be an adaptation of any of the arcs contained in Kurumada's manga or other related spinoffs in the franchise.<br />
<br />
An official event was to be held on October 31, 2014, at the Tamashii Nation 2014 Expo in Japan, to further introduce the series to the specialized media and to the public.<ref>http://tamashii.jp/special/seiya_sog/ Date for the event</ref> ''Saint Seiya: Soul of Gold'' is scheduled for release on April 11, 2015.<ref>http://tamashii.jp/special/seiya_sog/ Scheduled release date according to official website</ref> ''Soul of Gold'' is part of the projects that commemorate the fortieth anniversary of Kurumada as a manga artist.<ref>http://img4.hostingpics.net/pics/263450vlcsnap2014110206h18m11s29.png</ref><br />
<br />
==Plot==<br />
After giving their lives in order to destroy the Wall of Grief and thus help Seiya and his friends reach Hades to protect Athena, all twelve Gold Saints reappear in Asgard, after being mysteriously revived. While looking for answers about why they were brought back to life and by whom, the Gold Saints must fight a new enemy that threatens Asgard with their new, enhanced Cloths.<br />
<br />
==Cast and Characters==<br />
==Gold Saints==<br />
*[[Hideyuki Tanaka]] as [[List of Athena's Saints#Leo Aiolia|Leo Aioria]]<br />
The Leo Gold Saint who is the guardian of the Leo Temple in the Sanctuary as well as the main protagonist. Having been revived along with the other Gold Saints after their sacrifice to destroy the Wall of Grief, and with no knowledge of why, Aioria allies himself with Lyfia after some persuasion and later engage their new enemy in battle as he challenge the God Warrior Frodi. Aioria wears a medallion which was given to him by Aioros a long time ago, before the events from the original Saint Seiya occured. Being encouraged by Aioros and hearing Lyfia's prayers, Aioria decides to uncover the answers of the Gold Saints' revival as well as defeat Andreas Lise and destroy Yggdrasil. For some unknown reason, Aioria has been branded with the mark of the Einherjar, the legion of the dead, like his fellow Gold Saints.<br />
*[[Yuusaku Yara]] as [[List of Athena's Saints#Sagittarius Aiolos|Sagittarius Aiolos]]<br />
Aioria's older brother, the Sagittarius Gold Saint and guardian of the Sagittarius Temple in the Sanctuary who died while defending Athena in the original Saint Seiya series. Having been revived along with the other Gold Saints, he encourage Aioria to find out why they have revived by travelling to Yggdrasil.<br />
*[[Takumi Yamazaki]] as [[List of Athena's Saints#Aries Mu|Aries Mu]]<br />
The Aries Gold Saint and guardian of the Aries Temple in the Sanctuary. Having been revived along with the other Gold Saints after their sacrifice to destroy the Wall of Grief, Mu arrives in an abandoned village, finding a young boy who was all alone. Meeting Lyfia, Mu is informed of a God Warrior he noticed earlier and ventures to deal with the new enemy. For some unknown reason, Mu has been branded with the mark of the Einherjar, the legion of the dead, like his fellow Gold Saints.<br />
*[[Toshihiko Seki]] as [[List of Athena's Saints#Scorpio Milo|Scorpio Milo]]<br />
The Scorpio Gold Saint and the guardian of the Scorpio Temple in the Sanctuary.<br />
*[[Tesshô Genda]] as [[List of Athena's Saints#Taurus Aldebaran|Taurus Aldebaran]]<br />
The Taurus Gold Saint and the guardian of the Taurus Temple in the Sanctuary. Having been revived along with the other Gold Saints after their sacrifice to destroy the Wall of Grief, Aldebaran arrives at an arena in Asgard where he regroups with Dohko, discussing their mysterious revival after their sacrifice. Aldebaran's Cloth still retains its broken horn from his battle against Bronze Saint Pegasus Seiya from the original Saint Seiya story. Having once suffered a crushing defeat against Mizar Zeta Syd and an attack from behind unleashed by Zeta Alcor Bud, Aldebaran is given the opportunity by Dohko to avenge that defeat as Tanngsnir Hercules challenge the Gold Saints' powers. During that battle, Aldebaran's broken horn regrows as he burns his Cosmo into a more divine golden color. For some unknown reason, Aldebaran has been branded with the mark of the Einherjar, the legion of the dead, like his fellow Gold Saints.<br />
*[[Nobutoshi Canna]] as [[List of Athena's Saints#Aquarius Camus|Aquarius Camus]]<br />
The Aquarius Gold Saint, the guardian of the Aquarius Temple in the Sanctuary and master of Bronze Saint Cygnus Hyoga.<br />
*[[Yuji Mitsuya]] as [[List of Athena's Saints#Virgo Shaka|Virgo Shaka]]<br />
The Virgo Gold Saint considered the closest man to god and guardian of the Virgo Temple in the Sanctuary.<br />
*[[Takeshi Kusao]] as [[List of Athena's Saints#Capricorn Shura|Capricorn Shura]]<br />
The Capricorn Gold Saint and guardian of the Capricorn Temple in the Sanctuary.<br />
*[[Ryouichi Tanaka]] as [[List of Athena's Saints#Cancer Deathmask|Cancer Deathmask]]<br />
The Cancer Gold Saint and guardian of the Cancer Temple in the Sanctuary.<br />
*[[Keiichi Nanba]] as [[List of Athena's Saints#Pisces Aphrodite|Pisces Aphrodite]]<br />
The Pisces Gold Saint and guardian of the Pisces Temple in the Sanctuary.<br />
*[[Kenyuu Horiuchi]] as [[List of Athena's Saints#Libra Dohko|Libra Dohko]]<br />
The Libra Gold Saint, guardian of the Libra Temple in the Sanctuary and master of Bronze Saint Dragon Shiryu. One of the only survivors from the Holy War from the Lost Canvas series, Dohko is the oldest and considered the wisest among the Gold Saints. Having been revived along with the other Gold Saints after their sacrifice in order to destroy the Wall of Grief, Dohko rendezvous with Aldebaran and they discuss their revival as they share a drink. Shortly after though, Hercules arrives to challenge them, and Dohko accepts the challenge before sending Aldebaran to fight instead, reminding him of his previous defeat.<br />
*[[Ryotaro Okiayu]] as [[List of Athena's Saints#Gemini Saga|Gemini Saga]]<br />
The Gemini Gold Saint and guardian of the Gemini Temple in the Sanctuary<br />
<br />
==Episode List==<br />
{| class = "wikitable" width = "98%"<br />
|-<br />
! style="background: #444444; color:#FFFFFF;" width="3%" | #<br />
! style="background: #444444; color:#FFFFFF;" | Title<br />
! style="background: #444444; color:#FFFFFF;" width="15%" | Original release date<br />
{{Japanese episode list<br />
|EpisodeNumber = 01<br />
|RomajiTitle = Yomigaere! Ogon densetsu<br />
|KanjiTitle = 蘇れ!黄金伝説<br />
|EnglishTitle = Gold Legend, Revive!<br />
|OriginalAirDate = April 11, 2015<br />
|ShortSummary = Shortly after the destruction of the Wall of Grief, Aioria is suddenly revived in a snowy land, remembering everything that happened as the Gold Saints sacrificed themselves. Recovering in a prison, he meets Lyfia who informs him that he is in Asgard. A maid serving Hilda, Lyfia is rebelling against the rule of Andreas Lise who has become the new representative after Hilda who has fallen under an illness. Lyfia informs him that Andreas is manipulating the people of Asgard and that Hilda entrusted her to stop Andreas.<br />
<br />
At first refusing to aid Lyfia due to his own battle against Hades along his companions, Aioria returns to aid Lyfia as the God Warrior Frodi ambush her. Donning his Leo Cloth, Aioria duels the God Warrior Gullinbursti Frodi armed with the Sieg Schwert which easily deflects Aioria's attack. Standing up, he notices a strange mark on his body, which Frodi points out that its a mark belonging to deceased warriors known as Einherjar according to Asgardian legends. Aioria is unable to rival him due to Yggdrasil increasing the God Warrior's power. Seeming defeated, Aioria hears Aioros' voice which encourage him to find out why the Gold Saints have revived and in Asgard. <br />
<br />
Burning his Cosmo to the maximum, Aioria's Cloth changes form and becomes far more powerful. Once more clashing with Frodi, Aioria is able to repel the God Warrior's sword before falling unconcsious as his Cloth returns to normal. As Frodi is being carried by some Asgardian soldiers, he notices a slight change in Lyfia's appearance and attitude as she cradles Aioria. Meanwhile, Mu appears in another part of Asgard and hides from another God Warrior with an evil grin.<br />
}}<br />
{{Japanese episode list<br />
|EpisodeNumber = 02<br />
|RomajiTitle = Abake! Yugudorashiru no Himitsu<br />
|KanjiTitle = 暴け!ユグドラシルの秘密<br />
|EnglishTitle = The Secret of Yggdrasil Revealed!<br />
|OriginalAirDate = April 24, 2015<br />
|ShortSummary = Leaving Aioria to rest after his battle, Lyfia ventures out to find water or food, eventually falling unconcsious in the snow. As she recovers in an empty village, she meets a young boy who gives her something to drink. Shortly after, Mu arrives and informs her that he arrived a few days ago in the village which seemed like everyone had disappeared. Discussing a God Warrior with a dragon-shaped God Robe known as Nidhogg Fafner, Mu asks Lyfia to remain in the village and recover while he dealt with Fafner. Mu ambush the God Warrior and is easily defeated by his whip before being taken for experimenting by Fafner who binds him to the roots of Yggdrasil. Realizing that Yggdrasil is the source of evil, Mu easily breaks free from the roots and retaliates against Fafner before regrouping with Aioria and Lyfia, with Fafner escaping.<br />
<br />
Meanwhile, at an arena, Aldebaran finds Dohko fighting several Asgardian soldiers for sport and awaiting someone familiar to find him. As they rendezvous at a bar, the Gold Saints discuss their revival in Asgard and that someone is playing with their lives. Before they have time for further talk, the God Warrior Tanngsnir Hercules confronts them and challenge them. Leaving him to Aldebaran due to his previous loss during the last battle between Athena's Saints and Asgard, Dohko watches from the tribune as Aldebaran dons his Taurus Cloth. As Hercules attacks Aldebaran, the Gold Saint does not make a move which infuriates the God Warrior. Launching an attack at the civilians instead, Aldebaran moves in the way and deflects the attack. Remembering that he would usually leave the thinking part to his other comrades, Aldebaran burns his Cosmo and regrows his broken horn much to Dohko's surprise, overpowering Hercules for a brief moment before he retreats.<br />
<br />
During their battles, both Mu and Aldebaran are affected by the same Einherjar mark as Aioria prievously gained during his battle against Frodi. Finally, they all decide to journey to Yggdrasil and destroy it. In another part of Asgard, Milo tortures an Asgardian soldier for information about the God Warriors. He is shocked as the soldier mentions the sight of a Gold Saint.<br />
}}<br />
{{Japanese episode list<br />
|EpisodeNumber = 03<br />
|RomajiTitle = <br />
|KanjiTitle = <br />
|EnglishTitle = Gold vs. Gold: Clash of the Saints!<br />
|OriginalAirDate = May 8, 2015<br />
|ShortSummary = <br />
}}<!--<br />
{{Japanese episode list<br />
|EpisodeNumber = 04<br />
|RomajiTitle = <br />
|KanjiTitle = <br />
|EnglishTitle = <br />
|OriginalAirDate = 2015<br />
|ShortSummary = <br />
}}<br />
{{Japanese episode list<br />
|EpisodeNumber = 05<br />
|RomajiTitle = <br />
|KanjiTitle = <br />
|EnglishTitle = <br />
|OriginalAirDate = 2015<br />
|ShortSummary = <br />
}}<br />
{{Japanese episode list<br />
|EpisodeNumber = 06<br />
|RomajiTitle = <br />
|KanjiTitle = <br />
|EnglishTitle = <br />
|OriginalAirDate = 2015<br />
|ShortSummary = <br />
}}<br />
{{Japanese episode list<br />
|EpisodeNumber = 07<br />
|RomajiTitle = <br />
|KanjiTitle = <br />
|EnglishTitle = <br />
|OriginalAirDate = 2015<br />
|ShortSummary = <br />
}}<br />
{{Japanese episode list<br />
|EpisodeNumber = 08<br />
|RomajiTitle = <br />
|KanjiTitle = <br />
|EnglishTitle = <br />
|OriginalAirDate = 2015<br />
|ShortSummary = <br />
}}<br />
{{Japanese episode list<br />
|EpisodeNumber = 09<br />
|RomajiTitle = <br />
|KanjiTitle = <br />
|EnglishTitle = <br />
|OriginalAirDate = 2015<br />
|ShortSummary = <br />
}}<br />
{{Japanese episode list<br />
|EpisodeNumber = 10<br />
|RomajiTitle = <br />
|KanjiTitle = <br />
|EnglishTitle = <br />
|OriginalAirDate = 2015<br />
|ShortSummary = <br />
}}<br />
{{Japanese episode list<br />
|EpisodeNumber = 11<br />
|RomajiTitle = <br />
|KanjiTitle = <br />
|EnglishTitle = <br />
|OriginalAirDate = 2015<br />
|ShortSummary = <br />
}}<br />
{{Japanese episode list<br />
|EpisodeNumber = 12<br />
|RomajiTitle = <br />
|KanjiTitle = <br />
|EnglishTitle = <br />
|OriginalAirDate = 2015<br />
|ShortSummary = <br />
}}<br />
{{Japanese episode list<br />
|EpisodeNumber = 13<br />
|RomajiTitle = <br />
|KanjiTitle = <br />
|EnglishTitle = <br />
|OriginalAirDate = 2015<br />
|ShortSummary = <br />
}}--><br />
|}<br />
<br />
==Release==<br />
<br />
This new series will begin streaming on April 11, 2015. [[Bandai Channel]] will stream the series in Japan, while [[Daisuki (website)|Daisuki]] will stream it for the rest of the world. The latter will offer subtitles in different languages, including English, Spanish and Portuguese. Episodes will be released in single format biweekly on Saturdays.<ref>http://shinobinews.com/2015/03/saint-seiya-soul-of-gold-nuevo-trailer-y-fecha-de-estreno/ (In Spanish) </ref><br />
<br />
==References==<br />
{{reflist}}<br />
<br />
==External links==<br />
* http://tamashii.jp/special/seiya_sog/ Official website<br />
* {{Official website|http://saintseiya-gold.com/}} {{ja icon}}<br />
<br />
{{Saint Seiya}}<br />
{{Masami Kurumada}}<br />
<br />
[[Category:2015 anime]]<br />
[[Category:2015 web series debuts]]<br />
[[Category:Anime ONAs]]<br />
[[Category:Saint Seiya]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Neural_network_(machine_learning)&diff=654528461Neural network (machine learning)2015-04-01T18:40:43Z<p>PuercoPop: disambiguate function wikilink</p>
<hr />
<div>{{Redirect|Neural network|networks of living neurons|Biological neural network|the journal|Neural Networks (journal)|the evolutionary concept|Neutral network (evolution)}}<br />
{{Machine learning bar}}<br />
{{Use dmy dates|date=June 2013}}<br />
<br />
[[File:Colored neural network.svg|thumb|300px|An artificial neural network is an interconnected group of nodes, akin to the vast network of [[neuron]]s in a [[brain]]. Here, each circular node represents an artificial neuron and an arrow represents a connection from the output of one neuron to the input of another.]]<br />
<br />
In [[machine learning]] and [[cognitive science]], '''artificial neural networks''' ('''ANNs''') are a family of statistical learning algorithms inspired by [[biological neural network]]s (the [[central nervous system]]s of animals, in particular the [[brain]]) and are used to estimate or [[Universal approximation theorem|approximate]] [[Function (mathematics)|functions]] that can depend on a large number of [[Argument of a function|inputs]] and are generally unknown. Artificial neural networks are generally presented as systems of interconnected "[[artificial neuron|neuron]]s" which can compute values from inputs, and are capable of [[machine learning]] as well as [[pattern recognition]] thanks to their adaptive nature.<br />
<br />
For example, a neural network for [[handwriting recognition]] is defined by a set of input neurons which may be activated by the pixels of an input image. After being weighted and transformed by a [[Function (mathematics)|function]] (determined by the network's designer), the activations of these neurons are then passed on to other neurons. This process is repeated until finally, an output neuron is activated. This determines which character was read.<br />
<br />
Like other machine learning methods - systems that learn from data - neural networks have been used to solve a wide variety of tasks that are hard to solve using ordinary [[rule-based programming]], including [[computer vision]] and [[speech recognition]].<br />
<br />
==Background==<br />
Examinations of the human's [[central nervous system]] inspired the concept of neural networks. In an Artificial Neural Network, simple artificial [[Node (neural networks)|nodes]], known as "[[artificial neuron|neurons]]", "neurodes", "processing elements" or "units", are connected together to form a network which mimics a biological neural network.<br />
<br />
There is no single formal definition of what an artificial neural network is. However, a class of statistical models may commonly be called "Neural" if they possess the following characteristics:<br />
# consist of sets of [[adaptive systems|adaptive]] weights, i.e. numerical parameters that are tuned by a learning [[algorithm]], and<br />
# are capable of [[approximation theory|approximating]] non-linear functions of their inputs.<br />
The adaptive weights are conceptually connection strengths between neurons, which are activated during training and prediction.<br />
<br />
Neural networks are similar to biological neural networks in performing functions collectively and in parallel by the units, rather than there being a clear delineation of subtasks to which various units are assigned. The term "neural network" usually refers to models employed in [[statistics]], [[cognitive psychology]] and [[artificial intelligence]]. Neural network models which emulate the central nervous system are part of [[theoretical neuroscience]] and [[computational neuroscience]].<br />
<br />
In modern [[Neural network software|software implementations]] of artificial neural networks, the approach inspired by biology has been largely abandoned for a more practical approach based on statistics and signal processing. In some of these systems, neural networks or parts of neural networks (like artificial neurons) form components in larger systems that combine both adaptive and non-adaptive elements. While the more general approach of such systems is more suitable for real-world problem solving, it has little to do with the traditional artificial intelligence connectionist models. What they do have in common, however, is the principle of non-linear, distributed, parallel and local processing and adaptation. Historically, the use of neural networks models marked a paradigm shift in the late eighties from high-level (symbolic) [[artificial intelligence]], characterized by [[expert system]]s with knowledge embodied in ''if-then'' rules, to low-level (sub-symbolic) [[machine learning]], characterized by knowledge embodied in the parameters of a [[Cognitive Model#Dynamical systems|dynamical system]].<br />
<br />
==History==<br />
[[Warren McCulloch]] and [[Walter Pitts]]<ref>{{cite journal|last=McCulloch|first=Warren|author2=Walter Pitts|title=A Logical Calculus of Ideas Immanent in Nervous Activity|journal=Bulletin of Mathematical Biophysics|year=1943|volume=5|pages=115–133|doi=10.1007/BF02478259|issue=4}}</ref> (1943) created a computational model for neural networks based on [[mathematics]] and algorithms. They called this model [[threshold logic]]. The model paved the way for neural network research to split into two distinct approaches. One approach focused on biological processes in the brain and the other focused on the application of neural networks to artificial intelligence.<br />
<br />
In the late 1940s psychologist [[Donald Hebb]]<ref>{{cite book|last=Hebb|first=Donald|title=The Organization of Behavior|year=1949|publisher=Wiley|location=New York}}</ref> created a hypothesis of learning based on the mechanism of neural plasticity that is now known as [[Hebbian learning]]. Hebbian learning is considered to be a 'typical' [[unsupervised learning]] rule and its later variants were early models for [[long term potentiation]]. These ideas started being applied to computational models in 1948 with [[unorganized machine|Turing's B-type machines]].<br />
<br />
Farley and [[Wesley A. Clark]]<ref>{{cite journal|last=Farley|first=B.G.|author2=W.A. Clark|title=Simulation of Self-Organizing Systems by Digital Computer|journal=IRE Transactions on Information Theory|year=1954|volume=4|pages=76–84|doi=10.1109/TIT.1954.1057468|issue=4}}</ref> (1954) first used computational machines, then called calculators, to simulate a Hebbian network at MIT. Other neural network computational machines were created by Rochester, Holland, Habit, and Duda<ref>{{cite journal|last=Rochester|first=N.|coauthors=J.H. Holland, L.H. Habit, and W.L. Duda|title=Tests on a cell assembly theory of the action of the brain, using a large digital computer|journal=IRE Transactions on Information Theory|year=1956|volume=2|pages=80–93|doi=10.1109/TIT.1956.1056810|issue=3}}</ref> (1956).<br />
<br />
[[Frank Rosenblatt]]<ref>{{cite journal|last=Rosenblatt|first=F.|title=The Perceptron: A Probabilistic Model For Information Storage And Organization In The Brain|journal=Psychological Review|year=1958|volume=65|pages=386–408|doi=10.1037/h0042519|pmid=13602029|issue=6}}</ref> (1958) created the [[perceptron]], an algorithm for pattern recognition based on a two-layer learning computer network using simple addition and subtraction. With mathematical notation, Rosenblatt also described circuitry not in the basic perceptron, such as the [[exclusive-or]] circuit, a circuit whose mathematical computation could not be processed until after the [[backpropagation]] algorithm was created by [[Paul Werbos]]<ref name="Werbos 1975">{{cite book|last=Werbos|first=P.J.|title=Beyond Regression: New Tools for Prediction and Analysis in the Behavioral Sciences|year=1975}}</ref> (1975).<br />
<br />
Neural network research stagnated after the publication of machine learning research by [[Marvin Minsky]] and [[Seymour Papert]]<ref>{{cite book|last=Minsky|first=M.|title=An Introduction to Computational Geometry|year=1969|publisher=MIT Press|isbn=0-262-63022-2|author2=S. Papert}}</ref> (1969). They discovered two key issues with the computational machines that processed neural networks. The first issue was that single-layer neural networks were incapable of processing the exclusive-or circuit. The second significant issue was that computers were not sophisticated enough to effectively handle the long run time required by large neural networks. Neural network research slowed until computers achieved greater processing power. Also key later advances was the [[backpropagation]] algorithm which effectively solved the exclusive-or problem (Werbos 1975).<ref name="Werbos 1975"/><br />
<br />
The [[connectionism|parallel distributed processing]] of the mid-1980s became popular under the name [[connectionism]]. The text by [[David E. Rumelhart]] and [[James McClelland (psychologist)|James McClelland]]<ref>{{cite book|last=Rumelhart|first=D.E|title=Parallel Distributed Processing: Explorations in the Microstructure of Cognition|year=1986|publisher=MIT Press|location=Cambridge|author2=James McClelland}}</ref> (1986) provided a full exposition on the use of connectionism in computers to simulate neural processes.<br />
<br />
Neural networks, as used in artificial intelligence, have traditionally been viewed as simplified models of [[neural processing]] in the brain, even though the relation between this model and brain biological architecture is debated, as it is not clear to what degree artificial neural networks mirror brain function.<ref>{{cite web|last= Russell|first= Ingrid|title= Neural Networks Module|url= http://uhaweb.hartford.edu/compsci/neural-networks-definition.html|accessdate= 2012}}</ref><br />
<br />
Neural networks were gradually overtaken in popularity in machine learning by [[support vector machine]]s and other, much simpler methods such as [[linear classifier]]s. Renewed interest in neural nets was sparked in the late 2000s by the advent of [[deep learning]].<br />
<br />
===Improvements since 2006===<br />
Computational devices have been created in [[CMOS]], for both biophysical simulation and [[neuromorphic computing]]. More recent efforts show promise for creating [[nanodevice]]s<ref>Yang, J. J.; Pickett, M. D.; Li, X. M.; Ohlberg, D. A. A.; Stewart, D. R.; Williams, R. S. Nat. Nanotechnol. 2008, 3, 429–433.</ref> for very large scale [[principal component]]s analyses and [[convolution]]. If successful, these efforts could usher in a new era of [[neural computing]]<ref>Strukov, D. B.; Snider, G. S.; Stewart, D. R.; Williams, R. S. ''Nature'' 2008, 453, 80–83.</ref> that is a step beyond digital computing, because it depends on [[learning]] rather than [[programming language|programming]] and because it is fundamentally [[Analog signal|analog]] rather than [[Digital data|digital]] even though the first instantiations may in fact be with CMOS digital devices.<br />
<br />
Between 2009 and 2012, the [[recurrent neural network]]s and deep feedforward neural networks developed in the research group of [[Jürgen Schmidhuber]] at the [[IDSIA|Swiss AI Lab IDSIA]] have won eight international competitions in [[pattern recognition]] and [[machine learning]].<ref>[http://www.kurzweilai.net/how-bio-inspired-deep-learning-keeps-winning-competitions 2012 Kurzweil AI Interview] with [[Jürgen Schmidhuber]] on the eight competitions won by his Deep Learning team 2009–2012</ref><ref>http://www.kurzweilai.net/how-bio-inspired-deep-learning-keeps-winning-competitions 2012 Kurzweil AI Interview with [[Jürgen Schmidhuber]] on the eight competitions won by his Deep Learning team 2009–2012</ref> For example, the bi-directional and [[multi-dimensional]] [[long short term memory]] (LSTM)<ref>Graves, Alex; and Schmidhuber, Jürgen; ''[http://www.idsia.ch/~juergen/nips2009.pdf Offline Handwriting Recognition with Multidimensional Recurrent Neural Networks]'', in Bengio, Yoshua; Schuurmans, Dale; Lafferty, John; Williams, Chris K. I.; and Culotta, Aron (eds.), ''Advances in Neural Information Processing Systems 22 (NIPS'22), 7–10 December 2009, Vancouver, BC'', Neural Information Processing Systems (NIPS) Foundation, 2009, pp. 545–552.<br />
</ref><ref>A. Graves, M. Liwicki, S. Fernandez, R. Bertolami, H. Bunke, [[Jürgen Schmidhuber|J. Schmidhuber]]. [http://www.idsia.ch/~juergen/tpami_2008.pdf A Novel Connectionist System for Improved Unconstrained Handwriting Recognition]. IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 31, no. 5, 2009.<br />
</ref><ref>Graves, Alex; and Schmidhuber, Jürgen; ''Offline Handwriting Recognition with Multidimensional Recurrent Neural Networks'', in Bengio, Yoshua; Schuurmans, Dale; Lafferty, John; Williams, Chris K. I.; and Culotta, Aron (eds.), ''Advances in Neural Information Processing Systems 22 (NIPS'22), December 7th–10th, 2009, Vancouver, BC'', Neural Information Processing Systems (NIPS) Foundation, 2009, pp. 545–552</ref><ref>A. Graves, M. Liwicki, S. Fernandez, R. Bertolami, H. Bunke, J. Schmidhuber. A Novel Connectionist System for Improved Unconstrained Handwriting Recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 31, no. 5, 2009.</ref> of Alex Graves et al. won three competitions in connected handwriting recognition at the 2009 International Conference on Document Analysis and Recognition (ICDAR), without any prior knowledge about the three different languages to be learned.<br />
<br />
Fast [[GPU]]-based implementations of this approach by Dan Ciresan and colleagues at [[IDSIA]] have won several pattern recognition contests, including the IJCNN 2011 Traffic Sign Recognition Competition,<ref>D. C. Ciresan, U. Meier, J. Masci, [[Jürgen Schmidhuber|J. Schmidhuber]]. Multi-Column Deep Neural Network for Traffic Sign Classification. Neural Networks, 2012.<br />
</ref><ref>D. C. Ciresan, U. Meier, J. Masci, J. Schmidhuber. Multi-Column Deep Neural Network for Traffic Sign Classification. Neural Networks, 2012.</ref> the ISBI 2012 Segmentation of Neuronal Structures in Electron Microscopy Stacks challenge,<ref name="D. Ciresan, A. Giusti 2012">D. Ciresan, A. Giusti, L. Gambardella, J. Schmidhuber. Deep Neural Networks Segment Neuronal Membranes in Electron Microscopy Images. In Advances in Neural Information Processing Systems (NIPS 2012), Lake Tahoe, 2012.</ref> and others. Their neural networks also were the first artificial pattern recognizers to achieve human-competitive or even superhuman performance<ref name="C. Ciresan, U. Meier 2012">D. C. Ciresan, U. Meier, [[Jürgen Schmidhuber|J. Schmidhuber]]. Multi-column Deep Neural Networks for Image Classification. IEEE Conf. on Computer Vision and Pattern Recognition CVPR 2012.</ref><br />
on important benchmarks such as traffic sign recognition (IJCNN 2012), or the [[MNIST database|MNIST handwritten digits problem]] of [[Yann LeCun]] at [[NYU]].<br />
<br />
Deep, highly nonlinear neural architectures similar to the 1980 [[neocognitron]] by [[Kunihiko Fukushima]]<ref name="K. Fukushima. Neocognitron 1980">{{cite journal| author = Fukushima, K. | year = 1980 | title = Neocognitron: A self-organizing neural network model for a mechanism of pattern recognition unaffected by shift in position | journal = Biological Cybernetics | volume=36 | issue=4 | pages=93–202 | doi = 10.1007/BF00344251 | pmid=7370364}} <!-- K. Fukushima. Neocognitron: A self-organizing neural network model for a mechanism of pattern recognition unaffected by shift in position. Biological Cybernetics, 36(4): 93-202, 1980.--></ref><br />
and the "standard architecture of vision",<ref name="M Riesenhuber, 1999">M Riesenhuber, [[Tomaso Poggio|T Poggio]]. Hierarchical models of object recognition in cortex. Nature neuroscience, 1999.</ref> inspired by the simple and complex cells identified by [[David H. Hubel]] and [[Torsten Wiesel]] in the primary [[visual cortex]], can also be pre-trained by unsupervised methods<ref>[http://www.scholarpedia.org/article/Deep_belief_networks Deep belief networks] at Scholarpedia.<br />
</ref><ref>{{cite doi|10.1162/neco.2006.18.7.1527}}</ref><br />
of [[Geoff Hinton]]'s lab at [[University of Toronto]].<ref>http://www.scholarpedia.org/article/Deep_belief_networks /</ref><ref>{{cite journal<br />
|doi = 10.1162/neco.2006.18.7.1527<br />
|last1 = Hinton <br />
|first1 = G. E. <br />
|authorlink1 = Geoffrey Hinton<br />
|last2 = Osindero <br />
|first2 = S.<br />
|last3 = Teh <br />
|first3 = Y.<br />
|year = 2006<br />
|title = A fast learning algorithm for deep belief nets<br />
|journal = [[Neural Computation]]<br />
|volume = 18<br />
|issue = 7 <br />
|pages = 1527–1554<br />
|url = http://www.cs.toronto.edu/~hinton/absps/fastnc.pdf<br />
|pmid = 16764513<br />
}}</ref> A team from this lab won a 2012 contest sponsored by [[Merck & Co.|Merck]] to design software to help find molecules that might lead to new drugs.<ref>{{cite news |url=http://www.nytimes.com/2012/11/24/science/scientists-see-advances-in-deep-learning-a-part-of-artificial-intelligence.html |author=John Markoff |newspaper=New York Times |date=November 23, 2012 |title=Scientists See Promise in Deep-Learning Programs}}</ref><br />
<br />
==Models==<br />
Neural network models in artificial intelligence are usually referred to as artificial neural networks (ANNs); these are essentially simple mathematical models defining a function <math>\textstyle f : X \rightarrow Y </math> or a distribution over <math>\textstyle X</math> or both <math>\textstyle X</math> and <math>\textstyle Y</math>, but sometimes models are also intimately associated with a particular learning algorithm or learning rule. A common use of the phrase ANN model really means the definition of a ''class'' of such functions (where members of the class are obtained by varying parameters, connection weights, or specifics of the architecture such as the number of neurons or their connectivity).<br />
<br />
===Network function===<br />
{{See also|Graphical models}}<br />
<br />
The word ''network'' in the term 'artificial neural network' refers to the inter–connections between the neurons in the different layers of each system. An example system has three layers. The first layer has input neurons which send data via synapses to the second layer of neurons, and then via more synapses to the third layer of output neurons. More complex systems will have more layers of neurons with some having increased layers of input neurons and output neurons. The synapses store parameters called "weights" that manipulate the data in the calculations.<br />
<br />
An ANN is typically defined by three types of parameters:<br />
<br />
# The interconnection pattern between the different layers of neurons<br />
# The learning process for updating the weights of the interconnections<br />
# The activation function that converts a neuron's weighted input to its output activation.<br />
<br />
Mathematically, a neuron's network function <math>\textstyle f(x)</math> is defined as a composition of other functions <math>\textstyle g_i(x)</math>, which can further be defined as a composition of other functions. This can be conveniently represented as a network structure, with arrows depicting the dependencies between variables. A widely used type of composition is the ''nonlinear weighted sum'', where <math>\textstyle f (x) = K \left(\sum_i w_i g_i(x)\right) </math>, where <math>\textstyle K</math> (commonly referred to as the [[activation function]]<ref>{{cite web|url=http://www.cse.unsw.edu.au/~billw/mldict.html#activnfn|title=The Machine Learning Dictionary}}</ref>) is some predefined function, such as the [[hyperbolic tangent]]. It will be convenient for the following to refer to a collection of functions <math>\textstyle g_i</math> as simply a vector <math>\textstyle g = (g_1, g_2, \ldots, g_n)</math>.<br />
<br />
[[File:Ann dependency (graph).svg|thumb|150px|ANN dependency graph]]<br />
<br />
This figure depicts such a decomposition of <math>\textstyle f</math>, with dependencies between variables indicated by arrows. These can be interpreted in two ways.<br />
<br />
The first view is the functional view: the input <math>\textstyle x</math> is transformed into a 3-dimensional vector <math>\textstyle h</math>, which is then transformed into a 2-dimensional vector <math>\textstyle g</math>, which is finally transformed into <math>\textstyle f</math>. This view is most commonly encountered in the context of [[Mathematical optimization|optimization]].<br />
<br />
The second view is the probabilistic view: the [[random variable]] <math>\textstyle F = f(G) </math> depends upon the random variable <math>\textstyle G = g(H)</math>, which depends upon <math>\textstyle H=h(X)</math>, which depends upon the random variable <math>\textstyle X</math>. This view is most commonly encountered in the context of [[graphical models]].<br />
<br />
The two views are largely equivalent. In either case, for this particular network architecture, the components of individual layers are independent of each other (e.g., the components of <math>\textstyle g</math> are independent of each other given their input <math>\textstyle h</math>). This naturally enables a degree of parallelism in the implementation.<br />
<br />
[[File:Recurrent ann dependency graph.png|thumb|120px| Two separate depictions of the recurrent ANN dependency graph]]<br />
<br />
Networks such as the previous one are commonly called [[feedforward neural network|feedforward]], because their graph is a [[directed acyclic graph]]. Networks with [[path (graph theory)|cycles]] are commonly called [[Recurrent neural network|recurrent]]. Such networks are commonly depicted in the manner shown at the top of the figure, where <math>\textstyle f</math> is shown as being dependent upon itself. However, an implied temporal dependence is not shown.<br />
<br />
===Learning===<br />
What has attracted the most interest in neural networks is the possibility of ''learning''. Given a specific ''task'' to solve, and a ''class'' of functions <math>\textstyle F</math>, learning means using a set of ''observations'' to find <math>\textstyle f^{*} \in F</math> which solves the task in some ''optimal'' sense.<br />
<br />
This entails defining a cost function <math>\textstyle C : F \rightarrow \mathbb{R}</math> such that, for the optimal solution <math>\textstyle f^*</math>, <math>\textstyle C(f^*) \leq C(f)</math> <math>\textstyle \forall f \in F</math> – i.e., no solution has a cost less than the cost of the optimal solution (see [[Mathematical optimization]]).<br />
<br />
The cost function <math>\textstyle C</math> is an important concept in learning, as it is a measure of how far away a particular solution is from an optimal solution to the problem to be solved. Learning algorithms search through the solution space to find a function that has the smallest possible cost.<br />
<br />
For applications where the solution is dependent on some data, the cost must necessarily be a ''function of the observations'', otherwise we would not be modelling anything related to the data. It is frequently defined as a [[statistic]] to which only approximations can be made. As a simple example, consider the problem of finding the model <math>\textstyle f</math>, which minimizes <math>\textstyle C=E\left[(f(x) - y)^2\right]</math>, for data pairs <math>\textstyle (x,y)</math> drawn from some distribution <math>\textstyle \mathcal{D}</math>. In practical situations we would only have <math>\textstyle N</math> samples from <math>\textstyle \mathcal{D}</math> and thus, for the above example, we would only minimize <math>\textstyle \hat{C}=\frac{1}{N}\sum_{i=1}^N (f(x_i)-y_i)^2</math>. Thus, the cost is minimized over a sample of the data rather than the entire data set.<br />
<br />
When <math>\textstyle N \rightarrow \infty</math> some form of [[online machine learning]] must be used, where the cost is partially minimized as each new example is seen. While online machine learning is often used when <math>\textstyle \mathcal{D}</math> is fixed, it is most useful in the case where the distribution changes slowly over time. In neural network methods, some form of online machine learning is frequently used for finite datasets.<br />
<br />
{{See also|Mathematical optimization|Estimation theory|Machine learning}}<br />
<br />
====Choosing a cost function====<br />
While it is possible to define some arbitrary [[ad hoc]] cost function, frequently a particular cost will be used, either because it has desirable properties (such as [[Convex function|convexity]]) or because it arises naturally from a particular formulation of the problem (e.g., in a probabilistic formulation the posterior probability of the model can be used as an inverse cost). Ultimately, the cost function will depend on the desired task. An overview of the three main categories of learning tasks is provided below:<br />
<br />
===Learning paradigms===<br />
There are three major learning paradigms, each corresponding to a particular abstract learning task. These are [[supervised learning]], [[unsupervised learning]] and [[reinforcement learning]].<br />
<br />
====Supervised learning====<br />
In [[supervised learning]], we are given a set of example pairs <math>\textstyle (x, y), x \in X, y \in Y</math> and the aim is to find a function <math>\textstyle f : X \rightarrow Y </math> in the allowed class of functions that matches the examples. In other words, we wish to ''infer'' the mapping implied by the data; the cost function is related to the mismatch between our mapping and the data and it implicitly contains prior knowledge about the problem domain.<br />
<br />
A commonly used cost is the [[mean-squared error]], which tries to minimize the average squared error between the network's output, <math>\textstyle f(x)</math>, and the target value <math>\textstyle y</math> over all the example pairs. When one tries to minimize this cost using [[gradient descent]] for the class of neural networks called [[multilayer perceptron]]s, one obtains the common and well-known [[Backpropagation|backpropagation algorithm]] for training neural networks.<br />
<br />
Tasks that fall within the paradigm of supervised learning are [[pattern recognition]] (also known as classification) and [[Regression analysis|regression]] (also known as function approximation). The supervised learning paradigm is also applicable to sequential data (e.g., for speech and gesture recognition). This can be thought of as learning with a "teacher", in the form of a function that provides continuous feedback on the quality of solutions obtained thus far.<br />
<br />
====Unsupervised learning====<br />
In [[unsupervised learning]], some data <math>\textstyle x</math> is given and the cost function to be minimized, that can be any function of the data <math>\textstyle x</math> and the network's output, <math>\textstyle f</math>.<br />
<br />
The cost function is dependent on the task (what we are trying to model) and our ''a priori'' assumptions (the implicit properties of our model, its parameters and the observed variables).<br />
<br />
As a trivial example, consider the model <math>\textstyle f(x) = a</math> where <math>\textstyle a</math> is a constant and the cost <math>\textstyle C=E[(x - f(x))^2]</math>. Minimizing this cost will give us a value of <math>\textstyle a</math> that is equal to the mean of the data. The cost function can be much more complicated. Its form depends on the application: for example, in compression it could be related to the [[mutual information]] between <math>\textstyle x</math> and <math>\textstyle f(x)</math>, whereas in statistical modeling, it could be related to the [[posterior probability]] of the model given the data (note that in both of those examples those quantities would be maximized rather than minimized).<br />
<br />
Tasks that fall within the paradigm of unsupervised learning are in general [[Approximation|estimation]] problems; the applications include [[Data clustering|clustering]], the estimation of [[statistical distributions]], [[Data compression|compression]] and [[Bayesian spam filtering|filtering]].<br />
<br />
====Reinforcement learning====<br />
In [[reinforcement learning]], data <math>\textstyle x</math> are usually not given, but generated by an agent's interactions with the environment. At each point in time <math>\textstyle t</math>, the agent performs an action <math>\textstyle y_t</math> and the environment generates an observation <math>\textstyle x_t</math> and an instantaneous cost <math>\textstyle c_t</math>, according to some (usually unknown) dynamics. The aim is to discover a ''policy'' for selecting actions that minimizes some measure of a long-term cost; i.e., the expected cumulative cost. The environment's dynamics and the long-term cost for each policy are usually unknown, but can be estimated.<br />
<br />
More formally the environment is modelled as a [[Markov decision process]] (MDP) with states <math>\textstyle {s_1,...,s_n}\in S </math> and actions <math>\textstyle {a_1,...,a_m} \in A</math> with the following probability distributions: the instantaneous cost distribution <math>\textstyle P(c_t|s_t)</math>, the observation distribution <math>\textstyle P(x_t|s_t)</math> and the transition <math>\textstyle P(s_{t+1}|s_t, a_t)</math>, while a policy is defined as conditional distribution over actions given the observations. Taken together, the two then define a [[Markov chain]] (MC). The aim is to discover the policy that minimizes the cost; i.e., the MC for which the cost is minimal.<br />
<br />
ANNs are frequently used in reinforcement learning as part of the overall algorithm.<ref>{{cite conference| author = Dominic, S., Das, R., Whitley, D., Anderson, C. |date=July 1991 | title = Genetic reinforcement learning for neural networks | conference = IJCNN-91-Seattle International Joint Conference on Neural Networks | booktitle = IJCNN-91-Seattle International Joint Conference on Neural Networks | publisher = IEEE | location = Seattle, Washington, USA | url = http://dx.doi.org/10.1109/IJCNN.1991.155315 | doi = 10.1109/IJCNN.1991.155315 | accessdate = 29 July 2012 | isbn = 0-7803-0164-1 }}</ref><ref>{{cite journal |last=Hoskins |first=J.C. |author2=Himmelblau, D.M. |title=Process control via artificial neural networks and reinforcement learning |journal=Computers & Chemical Engineering |year=1992 |volume=16 |pages=241–251 |doi=10.1016/0098-1354(92)80045-B |issue=4}}</ref> [[Dynamic programming]] has been coupled with ANNs (Neuro dynamic programming) by [[Dimitri Bertsekas|Bertsekas]] and Tsitsiklis<ref>{{cite book| author = Bertsekas, D.P., Tsitsiklis, J.N. | year = 1996 | title = Neuro-dynamic programming | publisher = Athena Scientific | isbn = 1-886529-10-8 | page = 512 }}</ref> and applied to multi-dimensional nonlinear problems such as those involved in [[vehicle routing]],<ref>{{cite journal |last=Secomandi |first=Nicola |title=Comparing neuro-dynamic programming algorithms for the vehicle routing problem with stochastic demands |journal=Computers & Operations Research |year=2000 |volume=27 |pages=1201–1225 |doi=10.1016/S0305-0548(99)00146-X |issue=11–12}}</ref> [[natural resource management|natural resources management]]<ref>{{cite conference| author = de Rigo, D., Rizzoli, A. E., Soncini-Sessa, R., Weber, E., Zenesi, P. | year = 2001 | title = Neuro-dynamic programming for the efficient management of reservoir networks | conference = MODSIM 2001, International Congress on Modelling and Simulation | conferenceurl = http://www.mssanz.org.au/MODSIM01/MODSIM01.htm | booktitle = Proceedings of MODSIM 2001, International Congress on Modelling and Simulation | publisher = Modelling and Simulation Society of Australia and New Zealand | location = Canberra, Australia | doi = 10.5281/zenodo.7481 | url = https://zenodo.org/record/7482/files/de_Rigo_etal_MODSIM2001_activelink_authorcopy.pdf | accessdate = 29 July 2012 | isbn = 0-867405252 }}</ref><ref>{{cite conference| author = Damas, M., Salmeron, M., Diaz, A., Ortega, J., Prieto, A., Olivares, G.| year = 2000 | title = Genetic algorithms and neuro-dynamic programming: application to water supply networks | conference = 2000 Congress on Evolutionary Computation | booktitle = Proceedings of 2000 Congress on Evolutionary Computation | publisher = IEEE | location = La Jolla, California, USA | url = http://dx.doi.org/10.1109/CEC.2000.870269 | doi = 10.1109/CEC.2000.870269 | accessdate = 29 July 2012 | isbn = 0-7803-6375-2 }}</ref> or [[medicine]]<ref>{{cite journal |last=Deng |first=Geng |author2=Ferris, M.C. |title=Neuro-dynamic programming for fractionated radiotherapy planning |journal=Springer Optimization and Its Applications |year=2008 |volume=12 |pages=47–70 |doi=10.1007/978-0-387-73299-2_3}}</ref> because of the ability of ANNs to mitigate losses of accuracy even when reducing the discretization grid density for numerically approximating the solution of the original control problems.<br />
<br />
Tasks that fall within the paradigm of reinforcement learning are control problems, [[game]]s and other [[sequential decision making]] tasks.<br />
<br />
{{See also|dynamic programming|stochastic control}}<br />
<br />
===Learning algorithms===<br />
Training a neural network model essentially means selecting one model from the set of allowed models (or, in a [[Bayesian probability|Bayesian]] framework, determining a distribution over the set of allowed models) that minimizes the cost criterion. There are numerous algorithms available for training neural network models; most of them can be viewed as a straightforward application of [[Mathematical optimization|optimization]] theory and [[statistical estimation]].<br />
<br />
Most of the algorithms used in training artificial neural networks employ some form of [[gradient descent]], using backpropagation to compute the actual gradients. This is done by simply taking the derivative of the cost function with respect to the network parameters and then changing those parameters in a [[gradient-related]] direction.<br />
<br />
[[Evolutionary methods]],<ref>{{cite conference| author = de Rigo, D., Castelletti, A., Rizzoli, A.E., Soncini-Sessa, R., Weber, E. |date=January 2005 | title = A selective improvement technique for fastening Neuro-Dynamic Programming in Water Resources Network Management | conference = 16th IFAC World Congress | conferenceurl = http://www.nt.ntnu.no/users/skoge/prost/proceedings/ifac2005/Index.html | booktitle = Proceedings of the 16th IFAC World Congress – IFAC-PapersOnLine | editor = Pavel Zítek | volume = 16 | publisher = IFAC | location = Prague, Czech Republic | url = http://www.nt.ntnu.no/users/skoge/prost/proceedings/ifac2005/Papers/Paper4269.html<br />
| accessdate = 30 December 2011 | doi = 10.3182/20050703-6-CZ-1902.02172 | isbn = 978-3-902661-75-3 }}</ref> [[gene expression programming]],<ref>{{cite web|last=Ferreira|first=C.|year=2006|title=Designing Neural Networks Using Gene Expression Programming|url= http://www.gene-expression-programming.com/webpapers/Ferreira-ASCT2006.pdf|publisher= In A. Abraham, B. de Baets, M. Köppen, and B. Nickolay, eds., Applied Soft Computing Technologies: The Challenge of Complexity, pages 517–536, Springer-Verlag}}</ref> [[simulated annealing]],<ref>{{cite conference| author = Da, Y., Xiurun, G. |date=July 2005 | title = An improved PSO-based ANN with simulated annealing technique | conference = New Aspects in Neurocomputing: 11th European Symposium on Artificial Neural Networks | conferenceurl = http://www.dice.ucl.ac.be/esann/proceedings/electronicproceedings.htm | editor = T. Villmann | publisher = Elsevier | accessdate = 30 December 2011 | doi = 10.1016/j.neucom.2004.07.002 }}</ref> [[expectation-maximization]], [[non-parametric methods]] and [[particle swarm optimization]]<ref>{{cite conference| author = Wu, J., Chen, E. |date=May 2009 | title = A Novel Nonparametric Regression Ensemble for Rainfall Forecasting Using Particle Swarm Optimization Technique Coupled with Artificial Neural Network | conference = 6th International Symposium on Neural Networks, ISNN 2009 | conferenceurl = http://www2.mae.cuhk.edu.hk/~isnn2009/ | editor = Wang, H., Shen, Y., Huang, T., Zeng, Z. | publisher = Springer | accessdate = 1 January 2012 | doi = 10.1007/978-3-642-01513-7_6 | isbn = 978-3-642-01215-0 }}</ref> are some commonly used methods for training neural networks. {{See also|machine learning}}<br />
<br />
==Employing artificial neural networks==<br />
Perhaps the greatest advantage of ANNs is their ability to be used as an arbitrary function approximation mechanism that 'learns' from observed data. However, using them is not so straightforward, and a relatively good understanding of the underlying theory is essential.<br />
* Choice of model: This will depend on the data representation and the application. Overly complex models tend to lead to problems with learning.<br />
* Learning algorithm: There are numerous trade-offs between learning algorithms. Almost any algorithm will work well with the ''correct [[hyperparameter]]s'' for training on a particular fixed data set. However, selecting and tuning an algorithm for training on unseen data requires a significant amount of experimentation.<br />
* Robustness: If the model, cost function and learning algorithm are selected appropriately the resulting ANN can be extremely robust.<br />
<br />
With the correct implementation, ANNs can be used naturally in [[online algorithm|online learning]] and large data set applications. Their simple implementation and the existence of mostly local dependencies exhibited in the structure allows for fast, parallel implementations in hardware.<br />
<br />
==Applications==<br />
The utility of artificial neural network models lies in the fact that they can be used to infer a function from observations. This is particularly useful in applications where the complexity of the data or task makes the design of such a function by hand impractical.<br />
<br />
===Real-life applications===<br />
The tasks artificial neural networks are applied to tend to fall within the following broad categories:<br />
* [[Function approximation]], or [[regression analysis]], including [[time series prediction]], [[fitness approximation]] and modeling.<br />
* [[Statistical classification|Classification]], including [[Pattern recognition|pattern]] and sequence recognition, [[novelty detection]] and sequential decision making.<br />
* [[Data processing]], including filtering, clustering, [[blind source separation]] and compression.<br />
* [[Robotics]], including directing manipulators, [[prosthesis]].<br />
* [[Control engineering|Control]], including [[Computer numerical control]].<br />
<br />
Application areas include the system identification and control (vehicle control, process control, [[natural resource]]s management), quantum chemistry,<ref name=Balabin_2009>{{Cite journal|journal=[[J. Chem. Phys.]] |volume = 131 |issue = 7 |page = 074104 |doi=10.1063/1.3206326 |title=Neural network approach to quantum-chemistry data: Accurate prediction of density functional theory energies |year=2009 |author=Roman M. Balabin, Ekaterina I. Lomakina |pmid=19708729}}</ref> game-playing and decision making (backgammon, chess, [[poker]]), pattern recognition (radar systems, face identification, object recognition and more), sequence recognition (gesture, speech, handwritten text recognition), medical diagnosis, financial applications (e.g. [[algorithmic trading|automated trading systems]]), [[data mining]] (or knowledge discovery in databases, "KDD"), visualization and [[e-mail spam]] filtering.<br />
<br />
Artificial neural networks have also been used to diagnose several cancers. An ANN based hybrid lung cancer detection system named HLND improves the accuracy of diagnosis and the speed of lung cancer radiology.<ref>{{cite web|last=Ganesan|first=N|title=Application of Neural Networks in Diagnosing Cancer Disease Using Demographic Data|url=http://www.ijcaonline.org/journal/number26/pxc387783.pdf|publisher=International Journal of Computer Applications}}</ref> These networks have also been used to diagnose prostate cancer. The diagnoses can be used to make specific models taken from a large group of patients compared to information of one given patient. The models do not depend on assumptions about correlations of different variables. Colorectal cancer has also been predicted using the neural networks. Neural networks could predict the outcome for a patient with colorectal cancer with more accuracy than the current clinical methods. After training, the networks could predict multiple patient outcomes from unrelated institutions.<ref>{{cite web|last=Bottaci|first=Leonardo|title=Artificial Neural Networks Applied to Outcome Prediction for Colorectal Cancer Patients in Separate Institutions|url=http://www.lcc.uma.es/~jja/recidiva/042.pdf|publisher=The Lancet}}</ref><br />
<br />
===Neural networks and neuroscience===<br />
Theoretical and [[computational neuroscience]] is the field concerned with the theoretical analysis and the computational modeling of biological neural systems. Since neural systems are intimately related to cognitive processes and behavior, the field is closely related to cognitive and behavioral modeling.<br />
<br />
The aim of the field is to create models of biological neural systems in order to understand how biological systems work. To gain this understanding, neuroscientists strive to make a link between observed biological processes (data), biologically plausible mechanisms for neural processing and learning ([[biological neural network]] models) and theory (statistical learning theory and [[information theory]]).<br />
<br />
====Types of models====<br />
Many models are used in the field, defined at different levels of abstraction and modeling different aspects of neural systems. They range from models of the short-term behavior of [[biological neuron models|individual neurons]], models of how the dynamics of neural circuitry arise from interactions between individual neurons and finally to models of how behavior can arise from abstract neural modules that represent complete subsystems. These include models of the long-term, and short-term plasticity, of neural systems and their relations to learning and memory from the individual neuron to the system level.<br />
<br />
==Neural network software==<br />
{{Main|Neural network software}}<br />
<br />
'''Neural network software''' is used to [[Simulation|simulate]], [[research]], develop and apply artificial neural networks, [[biological neural network]]s and, in some cases, a wider array of [[adaptive system]]s.<br />
<br />
==Types of artificial neural networks==<br />
<!-- Split to [[Types of artificial neural networks]] --><br />
{{Main|Types of artificial neural networks}}<br />
<br />
Artificial neural network types vary from those with only one or two layers of single direction logic, to complicated multi–input many directional feedback loops and layers. On the whole, these systems use algorithms in their programming to determine control and organization of their functions. <br />
Most systems use "weights" to change the parameters of the throughput and the varying connections to the neurons. Artificial neural networks can be autonomous and learn by input from outside "teachers" or even self-teaching from written-in rules.<br />
<br />
==Theoretical properties==<br />
<section begin=theory /><br />
<br />
===Computational power===<br />
The [[multi-layer perceptron]] (MLP) is a universal function approximator, as proven by the [[universal approximation theorem]]. However, the proof is not constructive regarding the number of neurons required or the settings of the weights.<br />
<br />
Work by [[Hava Siegelmann]] and [[Eduardo D. Sontag]] has provided a proof that a specific recurrent architecture with rational valued weights (as opposed to full precision [[real number]]-valued weights) has the full power of a [[Universal Turing Machine]]<ref>{{Cite journal| title = Turing computability with neural nets | url = http://www.math.rutgers.edu/~sontag/FTP_DIR/aml-turing.pdf | year = 1991 | journal = Appl. Math. Lett. | pages = 77–80 | volume = 4 | issue = 6 | last1 = Siegelmann | first1 = H.T. | last2 = Sontag | first2 = E.D. | doi = 10.1016/0893-9659(91)90080-F }}</ref> using a finite number of neurons and standard linear connections. Further, it has been shown that the use of irrational values for weights results in a machine with [[Hypercomputation|super-Turing]] power.<ref>{{cite journal |last1=Balcázar |first1=José |title=Computational Power of Neural Networks: A Kolmogorov Complexity Characterization |journal=Information Theory, IEEE Transactions on |date=Jul 1997 |volume=43 |issue=4 |pages=1175–1183 |doi=10.1109/18.605580 |url=http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=605580&url=http%3A%2F%2Fieeexplore.ieee.org%2Fxpls%2Fabs_all.jsp%3Farnumber%3D605580 |accessdate=3 November 2014}}</ref><br />
<br />
===Capacity===<br />
Artificial neural network models have a property called 'capacity', which roughly corresponds to their ability to model any given function. It is related to the amount of information that can be stored in the network and to the notion of complexity.<br />
<br />
===Convergence===<br />
Nothing can be said in general about convergence since it depends on a number of factors. Firstly, there may exist many local minima. This depends on the cost function and the model. Secondly, the optimization method used might not be guaranteed to converge when far away from a local minimum. Thirdly, for a very large amount of data or parameters, some methods become impractical. In general, it has been found that theoretical guarantees regarding convergence are an unreliable guide to practical application. {{Citation needed|date=March 2012}}<br />
<br />
===Generalization and statistics===<br />
In applications where the goal is to create a system that generalizes well in unseen examples, the problem of over-training has emerged. This arises in convoluted or over-specified systems when the capacity of the network significantly exceeds the needed free parameters. There are two schools of thought for avoiding this problem: The first is to use [[cross-validation (statistics)|cross-validation]] and similar techniques to check for the presence of overtraining and optimally select hyperparameters such as to minimize the generalization error. The second is to use some form of ''[[regularization (mathematics)|regularization]]''. This is a concept that emerges naturally in a probabilistic (Bayesian) framework, where the regularization can be performed by selecting a larger prior probability over simpler models; but also in statistical learning theory, where the goal is to minimize over two quantities: the 'empirical risk' and the 'structural risk', which roughly corresponds to the error over the training set and the predicted error in unseen data due to overfitting.<br />
<br />
[[File:Synapse deployment.jpg|thumb|right|Confidence analysis of a neural network]]<br />
Supervised neural networks that use a [[mean squared error]] (MSE) cost function can use formal statistical methods to determine the confidence of the trained model. The MSE on a validation set can be used as an estimate for variance. This value can then be used to calculate the [[confidence interval]] of the output of the network, assuming a [[normal distribution]]. A confidence analysis made this way is statistically valid as long as the output [[probability distribution]] stays the same and the network is not modified.<br />
<br />
By assigning a [[softmax activation function]], a generalization of the [[logistic function]], on the output layer of the neural network (or a softmax component in a component-based neural network) for categorical target variables, the outputs can be interpreted as posterior probabilities. This is very useful in classification as it gives a certainty measure on classifications.<br />
<br />
The softmax activation function is:<br />
:<math>y_i=\frac{e^{x_i}}{\sum_{j=1}^c e^{x_j}}</math><br />
<section end=theory /><br />
<br />
==Controversies==<br />
<br />
===Training issues===<br />
A common criticism of neural networks, particularly in robotics, is that they require a large diversity of training for real-world operation {{Citation needed|date=November 2014}}. This is not surprising, since any learning machine needs sufficient representative examples in order to capture the underlying structure that allows it to generalize to new cases. Dean Pomerleau, in his research presented in the paper "Knowledge-based Training of Artificial Neural Networks for Autonomous Robot Driving," uses a neural network to train a robotic vehicle to drive on multiple types of roads (single lane, multi-lane, dirt, etc.). A large amount of his research is devoted to (1) extrapolating multiple training scenarios from a single training experience, and (2) preserving past training diversity so that the system does not become overtrained (if, for example, it is presented with a series of right turns – it should not learn to always turn right). These issues are common in neural networks that must decide from amongst a wide variety of responses, but can be dealt with in several ways, for example by randomly shuffling the training examples, by using a numerical optimization algorithm that does not take too large steps when changing the network connections following an example, or by grouping examples in so-called mini-batches.<br />
<br />
[[A. K. Dewdney]], a former ''[[Scientific American]]'' columnist, wrote in 1997, "Although neural nets do solve a few toy problems, their powers of computation are so limited that I am surprised anyone takes them seriously as a general problem-solving tool." (Dewdney, p.&nbsp;82)<br />
<br />
===Hardware issues===<br />
To implement large and effective software neural networks, considerable processing and storage resources need to be committed {{Citation needed|date=November 2014}}. While the brain has hardware tailored to the task of processing signals through a [[Graph (mathematics)|graph]] of neurons, simulating even a most simplified form on [[Von Neumann]] technology may compel a neural network designer to fill many millions of [[database]] rows for its connections – which can consume vast amounts of computer [[Random-access memory|memory]] and [[Hard drive|hard disk]] space. Furthermore, the designer of neural network systems will often need to simulate the transmission of signals through many of these connections and their associated neurons – which must often be matched with incredible amounts of [[CPU]] processing power and time. While neural networks often yield ''effective'' programs, they too often do so at the cost of ''efficiency'' (they tend to consume considerable amounts of time and money).<br />
<br />
Computing power continues to grow roughly according to [[Moore's Law]], which may provide sufficient resources to accomplish new tasks. [[Neuromorphic engineering]] addresses the hardware difficulty directly, by constructing non-Von-Neumann chips with circuits designed to implement neural nets from the ground up.<br />
<br />
===Practical counterexamples to criticisms===<br />
<br />
Arguments against Dewdney's position are that neural networks have been successfully used to solve many complex and diverse tasks, ranging from autonomously flying aircraft<ref>[http://www.nasa.gov/centers/dryden/news/NewsReleases/2003/03-49.html NASA - Dryden Flight Research Center - News Room: News Releases: NASA NEURAL NETWORK PROJECT PASSES MILESTONE]. Nasa.gov. Retrieved on 2013-11-20.</ref> to detecting credit card fraud .{{citation needed|date=August 2012}}<br />
<br />
Technology writer [[Roger Bridgman]] commented on Dewdney's statements about neural nets:<br />
<blockquote>Neural networks, for instance, are in the dock not only because they have been hyped to high heaven, (what hasn't?) but also because you could create a successful net without understanding how it worked: the bunch of numbers that captures its behaviour would in all probability be "an opaque, unreadable table...valueless as a scientific resource".<br />
<br />
In spite of his emphatic declaration that science is not technology, Dewdney seems here to pillory neural nets as bad science when most of those devising them are just trying to be good engineers. An unreadable table that a useful machine could read would still be well worth having.<ref>[http://members.fortunecity.com/templarseries/popper.html Roger Bridgman's defence of neural networks]</ref><br />
</blockquote><br />
<br />
Although it is true that analyzing what has been learned by an artificial neural network is difficult, it is much easier to do so than to analyze what has been learned by a biological neural network. Furthermore, researchers involved in exploring learning algorithms for neural networks are gradually uncovering generic principles which allow a learning machine to be successful. For example, Bengio and LeCun (2007) wrote an article regarding local vs non-local learning, as well as shallow vs deep architecture.<ref>http://www.iro.umontreal.ca/~lisa/publications2/index.php/publications/show/4</ref><br />
<br />
===Hybrid approaches===<br />
Some other criticisms came from believers of hybrid models (combining neural networks and symbolic approaches). They advocate the intermix of these two approaches and believe that hybrid models can better capture the mechanisms of the human mind.<ref>Sun and Bookman (1990)</ref><ref>{{Cite journal| last1 = Tahmasebi | last2 = Hezarkhani | title = A hybrid neural networks-fuzzy logic-genetic algorithm for grade estimation | url = http://www.sciencedirect.com/science/article/pii/S0098300412000398 | year = 2012| journal = Computers & Geosciences | pages = 18–27 | volume = 42| doi = 10.1016/j.cageo.2012.02.004 }}</ref><br />
<br />
==Gallery==<br />
<gallery widths="220"><br />
File:Single_layer_ann.svg|A single-layer feedforward artificial neural network. Arrows originating from <math>\scriptstyle x_2</math> are omitted for clarity. There are p inputs to this network and q outputs. In this system, the value of the qth output, <math>\scriptstyle y_q</math> would be calculated as <math>\scriptstyle y_q = \sum(x_i*w_{iq}) </math><br />
File:Two_layer_ann.svg|A two-layer feedforward artificial neural network.<br />
File:Artificial_neural_network.svg<br />
File:Ann_dependency_(graph).svg<br />
</gallery><br />
<br />
==See also==<br />
{{columns-list|colwidth=25em|<br />
* [[20Q]]<br />
* [[ADALINE]]<br />
* [[Adaptive resonance theory]]<br />
* [[Artificial life]]<br />
* [[Associative learning|Associative memory]]<br />
* [[Autoencoder]]<br />
* [[Backpropagation]]<br />
* [[BEAM robotics]]<br />
* [[Biological cybernetics]]<br />
* [[Biologically inspired computing]]<br />
* [[Blue brain]]<br />
* [[Catastrophic interference]]<br />
* [[Cerebellar Model Articulation Controller]]<br />
* [[Cognitive architecture]]<br />
* [[Cognitive science]]<br />
* [[Convolutional neural network]] (CNN)<br />
* [[Connectionist expert system]]<br />
* [[Connectomics]]<br />
* [[Cultured neuronal networks]]<br />
* [[Digital morphogenesis]]<br />
* [[Encog]]<br />
* [[Fuzzy logic]]<br />
* [[Gene expression programming]]<br />
* [[Genetic algorithm]]<br />
* [[Group method of data handling]]<br />
* [[Habituation]]<br />
* [[In Situ Adaptive Tabulation]]<br />
* [[Memristor]]<br />
* [[Multilinear subspace learning]]<br />
* [[Neuroevolution]]<br />
* [[Neural coding]]<br />
* [[Neural gas]]<br />
* [[Neural network software]]<br />
* [[Neuroscience]]<br />
* [[Ni1000]] chip<br />
* [[Nonlinear system identification]]<br />
* [[Optical neural network]]<br />
* [[Parallel Constraint Satisfaction Processes]]<br />
* [[Parallel distributed processing]]<br />
* [[Radial basis function network]]<br />
* [[Recurrent neural networks]]<br />
* [[Self-organizing map]]<br />
* [[Systolic array]]<br />
* [[Tensor product network]]<br />
* [[Time delay neural network]] (TDNN)<br />
}}<br />
<br />
==References==<br />
{{Reflist|2}}<br />
<br />
==Bibliography==<br />
{{refbegin}}<br />
* {{Cite journal| author=Bhadeshia H. K. D. H. | year=1999 |title=Neural Networks in Materials Science | journal=ISIJ International | volume=39 |pages=966–979 | doi=10.2355/isijinternational.39.966 | url=http://www.msm.cam.ac.uk/phase-trans/abstracts/neural.review.pdf| issue=10}}<br />
* Bishop, C.M. (1995) ''Neural Networks for Pattern Recognition'', Oxford: Oxford University Press. ISBN 0-19-853849-9 (hardback) or ISBN 0-19-853864-2 (paperback)<br />
* Cybenko, G.V. (1989). Approximation by Superpositions of a Sigmoidal function, ''[[Mathematics of Control, Signals, and Systems]]'', Vol. 2 pp.&nbsp;303–314. [http://actcomm.dartmouth.edu/gvc/papers/approx_by_superposition.pdf electronic version]<br />
* Duda, R.O., Hart, P.E., Stork, D.G. (2001) ''Pattern classification (2nd edition)'', Wiley, ISBN 0-471-05669-3<br />
* {{Cite journal | author=Egmont-Petersen, M., de Ridder, D., Handels, H. | year=2002 | title=Image processing with neural networks – a review | journal=Pattern Recognition | volume=35 | pages=2279–2301 | doi = 10.1016/S0031-3203(01)00178-9 | issue=10}}<br />
* Gurney, K. (1997) ''An Introduction to Neural Networks'' London: Routledge. ISBN 1-85728-673-1 (hardback) or ISBN 1-85728-503-4 (paperback)<br />
* Haykin, S. (1999) '' Neural Networks: A Comprehensive Foundation'', Prentice Hall, ISBN 0-13-273350-1<br />
* Fahlman, S, Lebiere, C (1991). ''The Cascade-Correlation Learning Architecture'', created for [[National Science Foundation]], Contract Number EET-8716324, and [[Defense Advanced Research Projects Agency]] (DOD), ARPA Order No. 4976 under Contract F33615-87-C-1499. [http://www.cs.iastate.edu/~honavar/fahlman.pdf electronic version]<br />
* Hertz, J., Palmer, R.G., Krogh. A.S. (1990) ''Introduction to the theory of neural computation'', Perseus Books. ISBN 0-201-51560-1<br />
* Lawrence, Jeanette (1994) ''Introduction to Neural Networks'', California Scientific Software Press. ISBN 1-883157-00-5<br />
* Masters, Timothy (1994) ''Signal and Image Processing with Neural Networks'', John Wiley & Sons, Inc. ISBN 0-471-04963-8<br />
* [[Brian D. Ripley|Ripley, Brian D]]. (1996) ''Pattern Recognition and Neural Networks'', Cambridge<br />
* Siegelmann, H.T. and [[Eduardo D. Sontag|Sontag, E.D.]] (1994). Analog computation via neural networks, ''Theoretical Computer Science'', v. 131, no. 2, pp.&nbsp;331–360. [http://www.math.rutgers.edu/~sontag/FTP_DIR/nets-real.pdf electronic version]<br />
* Sergios Theodoridis, Konstantinos Koutroumbas (2009) "Pattern Recognition", 4th Edition, Academic Press, ISBN 978-1-59749-272-0.<br />
* Smith, Murray (1993) ''Neural Networks for Statistical Modeling'', Van Nostrand Reinhold, ISBN 0-442-01310-8<br />
* Wasserman, Philip (1993) ''Advanced Methods in Neural Computing'', Van Nostrand Reinhold, ISBN 0-442-00461-3<br />
* ''Computational Intelligence: A Methodological Introduction'' by Kruse, Borgelt, Klawonn, Moewes, Steinbrecher, Held, 2013, Springer, ISBN 9781447150121<br />
* ''Neuro-Fuzzy-Systeme'' (3rd edition) by Borgelt, Klawonn, Kruse, Nauck, 2003, Vieweg, ISBN 9783528252656<br />
{{refend}}<br />
<br />
==External links==<br />
<!--<br />
Do not post software links here. If you must, use the Neural Network Software article. Remember however that Wikipedia is neither a link repository nor the place to promote products or show off your code.<br />
--><br />
{{wikibooks|Artificial Neural Networks}}<br />
* {{dmoz|Computers/Artificial_Intelligence/Neural_Networks|Neural Networks}}<br />
* [http://www.dkriesel.com/en/science/neural_networks A brief introduction to Neural Networks] (PDF), illustrated 250p textbook covering the common kinds of neural networks (CC license).<br />
<br />
{{DEFAULTSORT:Artificial Neural Network}}<br />
[[Category:Computational statistics]]<br />
[[Category:Artificial neural networks| ]]<br />
[[Category:Classification algorithms]]<br />
[[Category:Computational neuroscience]]<br />
[[Category:Mathematical psychology]]<br />
<br />
[[pl:Sieci neuronowe]]<br />
[[ro:Rețea neurală artificială]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Wikipedia:Articles_for_deletion/Roy_(programming_language)&diff=654352221Wikipedia:Articles for deletion/Roy (programming language)2015-03-31T15:34:09Z<p>PuercoPop: </p>
<hr />
<div>===[[Roy (programming language)]]===<br />
{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD|T}}<br />
<br />
:{{la|Roy (programming language)}} – (<includeonly>[[Wikipedia:Articles for deletion/Roy (programming language)|View AfD]]</includeonly><noinclude>[[Wikipedia:Articles for deletion/Log/2015 March 31#{{anchorencode:Roy (programming language)}}|View log]]</noinclude>{{int:dot-separator}} <span class="plainlinks">[https://tools.wmflabs.org/jackbot/snottywong/cgi-bin/votecounter.cgi?page=Wikipedia:Articles_for_deletion/Roy_(programming_language) Stats]</span>)<br />
:({{Find sources AFD|Roy (programming language)}})<br />
Unnotable programming language. Fails [[WP:GNG]], [[WP:NSOFT]]. &#8213;<span style="background:#8FF;border:solid 1px;border-radius:8px;box-shadow:darkgray 2px 2px 2px">&nbsp;[[User:Padenton|<span style="font-family:Old English Text MT;color:#C00">Padenton</span>]]&#124;[[User talk:Padenton|&#9993;]]&nbsp;</span>&nbsp; 15:12, 31 March 2015 (UTC)<br />
: As the article's main author, I agree it should be deleted, It appears that development of Roy has stopped and the language is currently in an incipient state. [[User:PuercoPop|PuercoPop]] ([[User talk:PuercoPop|talk]]) 15:34, 31 March 2015 (UTC)</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=The_Assayer&diff=653775733The Assayer2015-03-27T17:11:52Z<p>PuercoPop: </p>
<hr />
<div>{{italic title}}<br />
[[Image:Assayertitle.png|thumb|275px|right|Franceso Villamena's Frontispiece for ''The Assayer'']]<br />
'''''The Assayer''''' ({{lang-it|Il Saggiatore}}) was a book published in [[Rome]] by [[Galileo Galilei]] in October 1623.<br />
<br />
The book was a polemic against the treatise on the [[comet]]s of 1618 by [[Orazio Grassi]], a [[Jesuit]] mathematician at the [[Collegio Romano]]. In this matter Grassi, for all his [[Aristotelianism]], was right and Galileo was wrong. Galileo incorrectly treated the comets as a play of light rather than as real objects.<br />
<br />
In 1616 Galileo may have been silenced on [[Copernicanism]]. In 1623 his supporter and friend, Cardinal [[Maffeo Barberini]], a former patron of the [[Accademia dei Lincei|Lynx]] and uncle of Cardinal [[Francesco Barberini (seniore)|Francesco Barberini]], became [[Pope Urban VIII]]. The election of Barberini seemed to assure Galileo of support at the highest level in the Church. A visit to Rome confirmed this.<br />
<br />
The title page of ''The Assayer'' shows the crest of the [[Barberini|Barberini family]], featuring three busy bees. In ''The Assayer'', Galileo weighs the astronomical views of a Jesuit, Orazio Grassi, and finds them wanting. The book was dedicated to the new pope. The title page also shows that Urban VIII employed a member of the Lynx, Cesarini, at a high level in the papal service. This book was edited and published by members of the Lynx.<br />
<br />
Again Galileo insisted that physics should be mathematical. According to the title page, he was the [[philosopher]] or [[physicist]] of the Grand Duke of Tuscany, not merely the mathematician. Physics or natural philosophy spans the gamut from processes of generation and growth (represented by a plant) to the physical structure of the universe, represented by the cosmic cross-section. Mathematics, on the other hand, is symbolized by telescopes, and an astrolabe. This is the book containing Galileo’s famous statement that mathematics is the language of science. Only through mathematics can one achieve lasting truth in physics. Those who neglect mathematics wander endlessly in a dark labyrinth. From the book:<ref>Galileo Galilei, ''The Assayer'', as translated by [[Stillman Drake]] (1957), ''Discoveries and Opinions of Galileo'' pp. 237-8.</ref><br />
<br />
{{cquote|''Philosophy [i.e. physics] is written in this grand book — I mean the universe — which stands continually open to our gaze, but it cannot be understood unless one first learns to comprehend the language and interpret the characters in which it is written. It is written in the language of mathematics, and its characters are triangles, circles, and other geometrical figures, without which it is humanly impossible to understand a single word of it; without these, one is wandering around in a dark labyrinth.''}}<br />
<br />
Although ''The Assayer'' contains a magnificent polemic for mathematical physics, ironically its main point was to ridicule a mathematical astronomer. This time, the target of Galileo’s wit and sarcasm was the cometary theory of a Jesuit, [[Orazio Grassi]], who argued from parallax that comets move above the Moon. Galileo mistakenly countered that comets are an optical illusion.<br />
<br />
Galileo’s polemical tone was common at the time. However, the book was read with delight at the dinner table by Urban VIII, who had written a poem lauding Galileo for his rhetorical performances.{{ citation needed }}<br />
<br />
==See also==<br />
* [[Book of Nature]]<br />
<br />
==References==<br />
{{reflist}}<br />
<br />
==Sources==<br />
*Galileo Galilei, ''Il Saggiatore'' (in Italian) (Rome, 1623); ''[http://www.princeton.edu/~hos/h291/assayer.htm The Assayer]'', English trans. [[Stillman Drake]] and C. D. O'Malley, in ''The Controversy on the Comets of 1618'' (University of Pennsylvania Press, 1960).<br />
*Pietro Redondi, ''Galileo eretico'', 1983; ''Galileo: Heretic'' (transl: Raymond Rosenthal) Princeton University Press 1987 (reprint 1989 ISBN 0-691-02426-X); Penguin 1988 (reprint 1990 ISBN 0-14-012541-8)<br />
<br />
{{Galileo Galilei}}<br />
<br />
{{DEFAULTSORT:Assayer, The}}<br />
[[Category:1623 books]]<br />
[[Category:Astronomy books]]<br />
[[Category:History of astronomy]]<br />
[[Category:Books by Galileo Galilei]]</div>PuercoPophttps://en.wikipedia.org/w/index.php?title=Luis_Casta%C3%B1eda&diff=644419951Luis Castañeda2015-01-27T16:08:28Z<p>PuercoPop: Remove extra period + citation needed</p>
<hr />
<div>{{spanish name 2|Castañeda|Lossio}} <br />
{{Infobox Officeholder | name = Luis Castañeda<br />
| image = LUISCASTAÑEDALOSSIO.PNG<br />
| smallimage =<br />
| caption =<br />
| order = [[Mayor of Lima|Metropolitan Mayor of Lima]]<br />
| term_start = 1 January 2003<br />
| term_end = 11 October 2010<br />
| vicepresident =<br />
| viceprimeminister =<br />
| deputy = <br />
| president =<br />
| primeminister =<br />
| predecessor = [[Alberto Andrade Carmona|Alberto Andrade]]<br />
| successor = [[Marco Parra Sánchez|Marco Parra]]<br />
| term_start2 = 1 January 2015<br />
| term_end2 =<br />
| vicepresident2 =<br />
| viceprimeminister2 =<br />
| deputy2 =<br />
| president2 =<br />
| primeminister2 =<br />
| predecessor2 = [[Susana Villarán]]<br />
| successor2 =<br />
| order3 =<br />
| term_start3 =<br />
| term_end3 =<br />
| vicepresident3 =<br />
| viceprimeminister3 =<br />
| deputy3 =<br />
| president3 =<br />
| primeminister3 =<br />
| predecessor3 =<br />
| successor3 =<br />
| order4 =<br />
| term_start4 =<br />
| term_end4 =<br />
| vicepresident4 =<br />
| viceprimeminister4 =<br />
| deputy4 =<br />
| president4 =<br />
| primeminister4 =<br />
| predecessor4 =<br />
| successor4 =<br />
| birth_date = {{Birth date and age|1945|6|21|mf=y}}<br />
| birth_place = [[Chiclayo]], [[Lambayeque Region|Lambayeque]]<br />
| death_date =<br />
| death_place =<br />
| constituency =<br />
| party = [[National Solidarity (Peru)]]<br />
| spouse =<br />
| profession = Lawyer<br />
| religion = Roman Catholic<br />
| signature =<br />
| footnotes =<br />
}}<br />
<br />
'''Óscar Luis Castañeda Lossio''' (born June 21, 1945) is a [[Peru]]vian politician who was [[Mayor]] of [[Lima]], [[Peru]], from 2003 to 2010. He became Mayor of Lima again in 2015, after being elected for a third nonconsecutive term with a 51% of popular vote, that lasts until December 2018. He is recognized for being a successful mayor for his public works and transportation reforms. He ran for [[President of Peru]] in 2000, prior to his municipal reign, and in 2011, obtaining the fifth place with 9%. {{ citation needed }}<br />
<br />
==Life and politics==<br />
Castañeda, who was born in [[Chiclayo]] and lived in the ''Casa Castañeda'', is the son of Carlos Castañeda Iparraguirre and Ida Lossio. His father is remembered as one of the most important mayors of [[Chiclayo]]. As a little child he used to inspect with his father the works in progress at the city. From his marriage with Rosario Pardo, he has two sons: Luis Castañeda Pardo and Darío Castañeda Pardo.<br />
<br />
He was trained as a lawyer at the [[Pontifical Catholic University of Peru|Catholic University of Peru]], he got a Masters degree at the [[Centro de Altos Estudios Militares del Perú]]. In [[Sweden]] and [[Mexico]] he got a Professional Diploma in Management. In 1981, he started as a member of [[Popular Action (Peru)|Popular Action]] party, working with many of the former mayors of Lima as [[Alfonso Barrantes Lingán]].<br />
<br />
Between 1990-1996, during [[Alberto Fujimori|Fujimori's]] government, he was the President of the National Institute of Public Health [[IPPS]], now known as [[ESSALUD]]. He had also a controversial participacion in La Caja del Pescador, an entity that works in benefit of the fishermen.<ref>[http://www.agenciaperu.com/sociedad/2002/feb/cajapescador.htm]</ref> In 2000, he ran as a candidate of his own party [[National Solidarity (Peru)|National Solidarity Party]], in the [[Peruvian national election, 2000|presidential elections]], but failed to make it to the run-off elections.<ref>http://allmediany.com/details_news_article.php?news_artid=887</ref><ref>http://latintrade.com/2009/06/luis-castaneda-lossio-a-dark-horse-in-a-long-race</ref><ref>http://www.peruviantimes.com/17/no-alliances-will-be-made-with-lima-mayor-castaneda-for-upcoming-2011-presidential-elections-says-simon/3680/</ref><br />
<br />
In 2002, he participated in the elections for mayor with the [[National Unity (Peru)|National Unity Party]], defeating Mayor [[Alberto Andrade]]. Castañeda started out as a very popular mayor, with a popularity index close to 79%. He won re-election as the city's mayor in November 2006 with 48% of the vote.<br />
<br />
In 2011, SN (lead by Luis Castañeda Lossio) decided to run for presidency. Nevertheless and unsuccessfully, they only managed to gather around 9.5% of the votes.<br />
<br />
On March 15, 2013 audio recordings leaked to the press were broadcast over national television revealing that Luis Castañeda Lossio was indeed in charge of the campaign to recall Lima's first female Mayor, Susana Villaran.<ref>{{ cite web | url=http://www.hispanicallyspeakingnews.com/latino-daily-news/details/lima-perus-first-female-mayor-survives-recall-vote/23094/ |title=Lima, Peru’s First Female Mayor Survives Recall Vote |publisher=Hispanically Speaking News }}</ref> Before the leaks Castañeda Lossio had publicly denied his involvement in the recall process.<br />
<br />
In 2014, he ran for Mayor of Lima, winning the election by a landslide on October 5, trailing her rival and current mayor [[Susana Villarán]] to the third place (10%), and surprisingly, giving 18% to [[APRA]] candidate [[Enrique Cornejo]]. He assumed office on January 1, 2015.<br />
<br />
==References==<br />
{{reflist}}<br />
<br />
{{s-start}}<br />
{{succession box|title=[[Mayor of Lima]]|before=[[Alberto Andrade]]|after=[[Marco Parra Sánchez]]|years=2002&ndash;2010}}<br />
{{s-end}}<br />
<br />
{{LimaMayors}}<br />
<br />
{{Persondata <!-- Metadata: see [[Wikipedia:Persondata]]. --><br />
| NAME =Castaneda Lossio, Luis<br />
| ALTERNATIVE NAMES =<br />
| SHORT DESCRIPTION = Peruvian politician<br />
| DATE OF BIRTH =21 June 1945<br />
| PLACE OF BIRTH =[[Chiclayo]], [[Lambayeque Region|Lambayeque]]<br />
| DATE OF DEATH =<br />
| PLACE OF DEATH =<br />
}}<br />
{{DEFAULTSORT:Castaneda Lossio, Luis}}<br />
[[Category:Living people]]<br />
[[Category:Peruvian people of Italian descent]]<br />
[[Category:Mayors of Lima]]<br />
[[Category:1945 births]]<br />
[[Category:Popular Action (Peru) politicians]]<br />
[[Category:National Unity (Peru) politicians]]<br />
[[Category:National Solidarity Party (Peru) politicians]]</div>PuercoPop