SUPPORT THE WORK

GetWiki

Common Lisp

ARTICLE SUBJECTS
aesthetics  →
being  →
complexity  →
database  →
enterprise  →
ethics  →
fiction  →
history  →
internet  →
knowledge  →
language  →
licensing  →
linux  →
logic  →
method  →
news  →
perception  →
philosophy  →
policy  →
purpose  →
religion  →
science  →
sociology  →
software  →
truth  →
unix  →
wiki  →
ARTICLE TYPES
essay  →
feed  →
help  →
system  →
wiki  →
ARTICLE ORIGINS
critical  →
discussion  →
forked  →
imported  →
original  →
Common Lisp
[ temporary import ]
please note:
- the content below is remote from Wikipedia
- it has been imported raw for GetWiki
{{Short description|Programming language standard}}{{Use mdy dates|date=April 2020}}







factoids
| file ext = .lisp, .lsp, .l, .cl, .fasl}}Common Lisp (CL) is a dialect of the Lisp programming language, published in American National Standards Institute (ANSI) standard document ANSI INCITS 226-1994 (S2018)WEB,share.ansi.org/Shared%20Documents/Standards%20Action/2018-PDFs/SAV4952.pdf#page=10,web.archive.org/web/20210412125343/https://share.ansi.org/Shared%20Documents/Standards%20Action/2018-PDFs/SAV4952.pdf, 2021-04-12, live, ANSI Standards Action - December 28, 2018, ansi.org, (formerly X3.226-1994 (R1999)).Quoted from cover of cited standard. ANSI INCITS 226-1994 [S2008], for sale on standard’s document page {{webarchive|url=https://web.archive.org/web/20200927024609webstore.ansi.org/Standards/INCITS/INCITS2261994S2008 |date=September 27, 2020}}. The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived from the ANSI Common Lisp standard.WEB,www.lispworks.com/documentation/HyperSpec/Front/Help.htm#Authorship, CLHS: About the Common Lisp HyperSpec (TM), lispworks.com, The Common Lisp language was developed as a standardized and improved successor of Maclisp. By the early 1980s several groups were already at work on diverse successors to MacLisp: Lisp Machine Lisp (aka ZetaLisp), Spice Lisp, NIL and S-1 Lisp. Common Lisp sought to unify, standardise, and extend the features of these MacLisp dialects. Common Lisp is not an implementation, but rather a language specification.WEB,www.lispworks.com/documentation/HyperSpec/Body/01_ab.htm, CLHS: Section 1.1.2, lispworks.com, Several implementations of the Common Lisp standard are available, including free and open-source software and proprietary products.WEB,common-lisp.net/~dlw/LispSurvey.html, Common Lisp Implementations: A Survey, December 22, 2007,common-lisp.net/~dlw/LispSurvey.html," title="web.archive.org/web/20120421181340common-lisp.net/~dlw/LispSurvey.html,">web.archive.org/web/20120421181340common-lisp.net/~dlw/LispSurvey.html, April 21, 2012, dead, Common Lisp is a general-purpose, multi-paradigm programming language. It supports a combination of procedural, functional, and object-oriented programming paradigms. As a dynamic programming language, it facilitates evolutionary and incremental software development, with iterative compilation into efficient run-time programs. This incremental development is often done interactively without interrupting the running application.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, fixnum can hold an 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 of safety level is wanted, using optimize declarations.Common Lisp includes CLOS, an object system that supports multimethods and method combinations. It is often implemented with a Metaobject Protocol.Common Lisp is extensible through standard features such as Lisp macros (code transformations) and reader macros (input parsers for characters).Common Lisp provides partial backwards compatibility with Maclisp and John McCarthy’s original Lisp. This allows older Lisp software to be ported to Common Lisp.WEB
,www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/wang.html
, Old LISP programs still run in Common Lisp, May 13, 2015
,

History

Work on Common Lisp started in 1981 after an initiative by ARPA manager Bob Engelmore to develop a single community standard Lisp dialect.WEB,www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/doc/history/cl.txt, Roots of “Yu-Shiang Lisp”, Mail from Jon L White, 1982, cmu.edu, Much of the initial language design was done via electronic mail.WEB,cl-su-ai.lisp.se/maillist.html, Mail Index, cl-su-ai.lisp.se, Knee-jerk Anti-LOOPism and other E-mail Phenomena: Oral, Written, and Electronic Patterns in Computer-Mediated Communication, JoAnne Yates and Wanda J. Orlikowski., 1993 {{webarchive|url=https://web.archive.org/web/20120808032049ccs.mit.edu/papers/CCSWP150.html |date=August 8, 2012}} In 1982, Guy L. Steele Jr. gave the first overview of Common Lisp at the 1982 ACM Symposium on LISP and functional programming.BOOK, An overview of COMMON LISP, Guy L. Jr., Steele, Proceedings of the 1982 ACM symposium on LISP and functional programming - LFP ‘82, August 15, 1982, ACM, 98–107, 10.1145/800068.802140, 9780897910828, 14517358, The first language documentation was published in 1984 as Common Lisp the Language (known as CLtL1), first edition. A second edition (known as CLtL2), published in 1990, incorporated many changes to the language, made during the ANSI Common Lisp standardization process: extended LOOP syntax, the Common Lisp Object System, the Condition System for error handling, an interface to the pretty printer and much more. But CLtL2 does not describe the final ANSI Common Lisp standard and thus is not a documentation of ANSI Common Lisp. 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 and libraries.

Syntax

Common Lisp is a dialect of Lisp. It uses S-expressions to denote both code and data structure. Function calls, macro forms and special forms are written as lists, with the name of the operator first, as in these examples:
(+ 2 2) ; adds 2 and 2, yielding 4. The function’s name is ‘+’. Lisp has no operators as such.


(defvar *x*) ; Ensures that a variable *x* exists,
; without giving it a value. The asterisks are part of
; the name, by convention denoting a special (global) variable.
; The symbol *x* is also hereby endowed with the property that
; subsequent bindings of it are dynamic, rather than lexical.
(setf *x* 42.1) ; Sets the variable *x* to the floating-point value 42.1


;; Define a function that squares a number:
(defun square (x)
(* x x))


;; Execute the function:
(square 3) ; Returns 9


;; The ‘let’ construct creates a scope for local variables. Here
;; the variable ‘a’ is bound to 6 and the variable ‘b’ is bound
;; to 4. Inside the ‘let’ is a ‘body’, where the last computed value is returned.
;; Here the result of adding a and b is returned from the ‘let’ expression.
;; The variables a and b have lexical scope, unless the symbols have been
;; marked as special variables (for instance by a prior DEFVAR).
(let ((a 6)
(b 4))
(+ a b)) ; returns 10

Data types

Common Lisp has many data types.

Scalar types

Number types include integers, ratios, floating-point numbers, and complex numbers.WEB
,random-state.net/features-of-common-lisp.html
, Features of Common Lisp
, Abhishek, Reddy
, August 22, 2008
, Common Lisp uses bignums 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.The Common Lisp character type is not limited to ASCII characters. Most modern implementations allow Unicode characters.WEB
,www.cliki.net/Unicode%20Support
, Unicode support, The Common Lisp Wiki, August 21, 2008
, The 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’.A number of functions are available for rounding scalar numeric values in various ways. The function round rounds the argument to the nearest integer, with halfway cases rounded to the even integer. The functions truncate, floor, and ceiling round towards zero, down, or up respectively. All these functions return the discarded fractional part as a secondary value. For example, (floor -2.5) yields −3, 0.5; (ceiling -2.5) yields −2, −0.5; (round 2.5) yields 2, 0.5; and (round 3.5) yields 4, −0.5.

Data structures

Sequence types in Common Lisp include lists, vectors, bit-vectors, and strings. There are many operations that can work on any sequence type.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 nil 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.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 bits.Hash tables store associations between data objects. Any object may be used as key or value. Hash tables are automatically resized as needed.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.Structures, similar in use to C structs and Pascal records, represent arbitrary complex data structures with any number and type of fields (called slots). Structures allow single-inheritance.Classes are similar to structures, but offer more dynamic features and multiple-inheritance. (See 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 is Generic Functions. Generic Functions are both functions and instances.

Functions

Common Lisp supports first-class functions. 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.The Common Lisp library relies heavily on such higher-order functions. For example, the sort 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.
;; Sorts the list using the > and
< function as the relational operator.
(sort (list 5 2 6 3 1 4) #’>) ; Returns (6 5 4 3 2 1)
(sort (list 5 2 6 3 1 4) #’


- content above as imported from Wikipedia
- "Common Lisp" does not exist on GetWiki (yet)
- time: 9:36am EDT - Wed, May 22 2024
[ this remote article is provided by Wikipedia ]
LATEST EDITS [ see all ]
GETWIKI 21 MAY 2024
GETWIKI 09 JUL 2019
Eastern Philosophy
History of Philosophy
GETWIKI 09 MAY 2016
GETWIKI 18 OCT 2015
M.R.M. Parrott
Biographies
GETWIKI 20 AUG 2014
CONNECT