We are still actively working on the spam issue.

Difference between revisions of "Lisp"

From InstallGentoo Wiki
Jump to: navigation, search
(Dialects)
m (fixed interwiki links)
(22 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''Lisp''' is a programming language originally created by John McCarthy in 1958. Despite its age, it is still a popular choice for modern programmers. Lisp has proven itself flexible enough to evolve to meet the needs of modern programmers. Modern implementations often come "batteries-included", meaning that the programmer has access to powerful libraries for databases, regular expressions, networking, and more.
+
'''Lisp''' is a [[:Category:Programming languages |programming language]] originally created by [[Wikipedia:John_McCarthy_%28computer_scientist%29 |John McCarthy]] in 1958. Despite its age, it is still a popular choice for modern programmers. Lisp has proven itself flexible enough to evolve to meet the needs of modern programmers. Modern implementations often come "batteries-included", meaning that the programmer has access to powerful libraries for [[Databases |databases]], regular expressions, [[:Category:Networking |networking]], and more.
  
 
Lisp comes in different dialects, which are divided into different implementations. Three important dialects are Common Lisp, Emacs Lisp, and Scheme.
 
Lisp comes in different dialects, which are divided into different implementations. Three important dialects are Common Lisp, Emacs Lisp, and Scheme.
 +
 +
== Important Concepts ==
 +
=== Symbols ===
 +
=== Lists ===
 +
=== Lambda ===
 +
In most Lisps and functional languages Lambda is the constructor of unnamed or anonymous procedures and functions.
 +
 +
(lambda (x)
 +
  (* 2 x))
 +
 +
Its use by itself can be observed as such:
 +
 +
> ((lambda (x) (* 2 x)) 5)
 +
10
 +
 +
In this example the anonymous procedure, or Lambda form, multiplies its argument by 2, its use in a more typical scenario can be observed below via MAPCAR, which applies the unnamed procedure to each of the elements of a list, and returns a list of the results:
 +
 +
> (mapcar (lambda (x)
 +
            (* 2 x))
 +
          '(1 2 3 4 5 6 7 8 9 10))
 +
(2 4 6 8 10 12 14 16 18 20)
 +
 +
=== Higher Order Procedures ===
 +
=== Recursion ===
 +
==== Natural Recursion ====
 +
==== Proper Tail Recursion ====
 +
=== Homoiconicity ===
 +
=== Macros ===
 +
==== Compile-time Macros ====
 +
==== Read Macros ====
 +
==== FEXPRs ====
 +
=== Scoping ===
 +
=== Functions ===
  
 
==Dialects==
 
==Dialects==
Line 7: Line 40:
 
Common Lisp was designed by Scott Fahlman, Richard P. Gabriel, David Moon, Guy L. Steele, and Dan Weinreb, and is described in [http://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html CLTL2], as well as the [http://www.lispworks.com/documentation/HyperSpec/Front/index.htm Common Lisp Hyperspec.]
 
Common Lisp was designed by Scott Fahlman, Richard P. Gabriel, David Moon, Guy L. Steele, and Dan Weinreb, and is described in [http://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html CLTL2], as well as the [http://www.lispworks.com/documentation/HyperSpec/Front/index.htm Common Lisp Hyperspec.]
  
Popular implementations include [http://sbcl.org/ Steel Bank Common Lisp,] [http://clisp.org/ GNU Clisp,] [http://ccl.clozure.com/ ClozureCL,] and [http://ecls.sourceforge.net/ ECL.]
+
Popular implementations include [http://franz.com/ Allegro Common Lisp], [http://sbcl.org/ Steel Bank Common Lisp], [http://clisp.org/ GNU Clisp], [http://ccl.clozure.com/ ClozureCL], [http://ecls.sourceforge.net/ ECL], and [http://www.lispworks.com/ LispWorks].
  
 
=== Emacs Lisp ===
 
=== Emacs Lisp ===
Emacs Lisp is used to program and extend Emacs. Programmers who swear by Emacs should learn to use Emacs Lisp.
+
Emacs Lisp (Elisp) is used to program and extend Emacs. Programmers who either use or are interested in using Emacs should learn Elisp.
 +
 
 +
A very good [https://www.gnu.org/software/emacs/manual/eintr.html tutorial], as well as primary langugage [https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html documentation] for Elisp is available from directly within Emacs.
 +
The introduction can by found by pressing <code>C-h i</code> then typing <code>mEmacs Lisp Intro</code> and pressing <code>Return</code>, and the language documentation can be found by typing <code>mElisp</code> instead. (the "m" tells Info that you are looking for a menu entry, and the rest is the title)
  
 
=== Scheme ===
 
=== Scheme ===
 
Scheme, created by Guy L. Steele and Gerald Jay Sussman, is the dialect used in SICP.
 
Scheme, created by Guy L. Steele and Gerald Jay Sussman, is the dialect used in SICP.
  
Two of the most popular implementations are Chicken and GNU Guile, both of which include a developed C API.
+
Two of the most popular implementations are Chicken and GNU Guile, both of which are embeddable, and include a well-designed C API, and an [[Wikipedia:Foreign_function_interface |FFI]] for interfacing with C libraries.
  
 
=== Niche Lisps ===
 
=== Niche Lisps ===
  
 
===== System scripting =====
 
===== System scripting =====
 +
* LUSH
 
* newLISP
 
* newLISP
 +
* Picolisp
 
* scsh
 
* scsh
* LUSH
 
  
 
===== CUDA & OpenCL =====
 
===== CUDA & OpenCL =====
 
* Harlan
 
* Harlan
 +
 +
===== Programming language research =====
 +
* GNU Epsilon
 +
* [http://web.cs.wpi.edu/~jshutt/kernel.html Kernel] [http://klisp.org/index.html (implementation here)]
 +
* Racket
  
 
[[Category:Programming languages]]
 
[[Category:Programming languages]]

Revision as of 05:43, 11 March 2016

Lisp is a programming language originally created by John McCarthy in 1958. Despite its age, it is still a popular choice for modern programmers. Lisp has proven itself flexible enough to evolve to meet the needs of modern programmers. Modern implementations often come "batteries-included", meaning that the programmer has access to powerful libraries for databases, regular expressions, networking, and more.

Lisp comes in different dialects, which are divided into different implementations. Three important dialects are Common Lisp, Emacs Lisp, and Scheme.

Important Concepts

Symbols

Lists

Lambda

In most Lisps and functional languages Lambda is the constructor of unnamed or anonymous procedures and functions.

(lambda (x)
  (* 2 x))

Its use by itself can be observed as such:

> ((lambda (x) (* 2 x)) 5)
10

In this example the anonymous procedure, or Lambda form, multiplies its argument by 2, its use in a more typical scenario can be observed below via MAPCAR, which applies the unnamed procedure to each of the elements of a list, and returns a list of the results:

> (mapcar (lambda (x)
            (* 2 x))
          '(1 2 3 4 5 6 7 8 9 10))
(2 4 6 8 10 12 14 16 18 20)

Higher Order Procedures

Recursion

Natural Recursion

Proper Tail Recursion

Homoiconicity

Macros

Compile-time Macros

Read Macros

FEXPRs

Scoping

Functions

Dialects

Common Lisp

Common Lisp was designed by Scott Fahlman, Richard P. Gabriel, David Moon, Guy L. Steele, and Dan Weinreb, and is described in CLTL2, as well as the Common Lisp Hyperspec.

Popular implementations include Allegro Common Lisp, Steel Bank Common Lisp, GNU Clisp, ClozureCL, ECL, and LispWorks.

Emacs Lisp

Emacs Lisp (Elisp) is used to program and extend Emacs. Programmers who either use or are interested in using Emacs should learn Elisp.

A very good tutorial, as well as primary langugage documentation for Elisp is available from directly within Emacs. The introduction can by found by pressing C-h i then typing mEmacs Lisp Intro and pressing Return, and the language documentation can be found by typing mElisp instead. (the "m" tells Info that you are looking for a menu entry, and the rest is the title)

Scheme

Scheme, created by Guy L. Steele and Gerald Jay Sussman, is the dialect used in SICP.

Two of the most popular implementations are Chicken and GNU Guile, both of which are embeddable, and include a well-designed C API, and an FFI for interfacing with C libraries.

Niche Lisps

System scripting
  • LUSH
  • newLISP
  • Picolisp
  • scsh
CUDA & OpenCL
  • Harlan
Programming language research