Detailed Overview of the LISP Programming Language and Its Features

Verified

Added on  2022/08/22

|5
|1138
|27
Homework Assignment
AI Summary
This assignment provides a detailed overview of the LISP programming language, tracing its history back to 1958 when it was developed by John McCarthy at MIT. It highlights Lisp's influence on AI research and its unique parenthesis-based coding style. The assignment explores key features such as automatic storage management, dynamic typing, and recursion, as well as the introduction of concepts like the eval-print-loop and self-hosting compilers. It showcases practical examples, including code snippets for printing strings and calculating factorials using recursion. The paper references relevant sources to support its claims about the programming language.
tabler-icon-diamond-filled.svg

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
LISP
Overview:
Lisp is a specific type of programming language, which has a very long programming
history attached to it specifically due to its parenthesis based coding style. Appearing in the
year 1958, Lisp is the second oldest programming language (after FORTRAN) to be
programmed in high-level language and is still used in many areas. Influenced by the notation
of Alonzo Church’s lambda calculus, the programming language was initially created to
represent symbolic objects and ideas of mathematic related calculations in computer
programs. Due to its successful implementation, it became well-known programming
language for AI (artificial intelligence) related researches. With Lisp, introduction of many
computer science related ideas took place (Kunasaikaran & Iqbal, 2016). It consists of
automatic storage management, tree data structures, dynamic typing, recursion, higher-order
functions real-eval-print loop, self-hosting compiler and many more.
History
John McCarthy at MIT (Massachussetts Institute of Technology) developed Lisp in
1958. Later in 1960, he (John McCarthy) published its design in the paper Communications
of the ACM (Association of Computing Machinery). His article was titled “Recursive
Functions of Symbolic Expressions and Their Computation by Machines, Part I”. With a few
simplistic operations he showed that one can simulate Turing machines based on its
algorithms. After the publication, various functionalities like recursion, list processing and
IPL (Information Processing Language) related AI based concepts came to be used in Lisp
(McJones, 2017).
Steve Russell first implemented LISP on an IBM 704 Computer. Upon reading
McCarthy’s paper on Communications of the ACM, he comprehended that the ‘eval’
function described there (in the paper), can be used to implement in machine codes. It result
in working of Lisp interpreter that can be used to evaluate Lisp expressions and run the
programs (Lisp codes) as well. At the same Institute (MIT), Mike Levin and Tim Hart
implemented the very fast Lisp compiler in the year 1962. The introduction of incremental
compiler was done in this current implementation (in the first Lisp Compiler) in which
interpreter along with the compiled functions can be used without obstructions (Jian Lu &
Wang, 2015). The commonly used garbage collection in current programming languages was
first developed and used by an MIT graduation student Daniel Edwards.
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Features
The Lisp programming language is not limited to any specific machine hence
machine-independent. It is easily extensible and uses the methodology of iterative design
which can be used to design a prototype, test and analyze it, refine the prototype as per results
and continue the same process until the design satisfies the final requirement. Lisp also
supports dynamic updating of its programs. It provides a wide range of data types consisting
lists, structures, objects, adjustable arrays, vectors, symbols and hash-tables. It is mainly
expression based (Knott, 2017). The following examples will give a clear idea about some
functionalities of Lisp programming Language (Méndez, 2016).
Examples
Printing a String using Lisp
CODE
(print "Hello, world!")
OUTPUT
"Hello, world!"
Fig1: Basic printing syntax in Lisp
Document Page
In the above example, we have written a simple Lisp code of printing a string. For the
printing of any string, the term ‘print’ is used with an addition of enclosing the whole thing
within parenthesis. The opening of the parenthesis indicates the starting of a coding block and
the closing indicates the end of the same block.
Finding Factorial of a number using recursion
CODE
(defun factorial (n)
(if (>= n 1)
(*n (factorial (- n 1) ))
1
))
(print "The factorial is:")
(print (factorial 7))
OUTPUT
"The factorial is:"
5040
Document Page
Fig: Finding factorial of 7 using Lisp
With the help of the above code, factorial of 7 is displayed. Mainly three blocks are
used here. First for defining the recursive function, second one is used to display a string for
ease of user understanding about what task is performed in the code and finally the last one is
used to call the recursive function with a value (here it is 7) and print the returned result. In
this example, initially the function is defined by ‘defun’. It indicates that a function is defined
next is the function name, within the braces, the value that will be passed to the function
(here 7 will be passed). For the operation part, first the operstion task/condition is mentioned
then the leftside object and finally the right side object. Here, (>= n 1) indicates (n> = 1).
Similarly, (*n (factorial (- n 1))) indicates (n * (factorial (n – 1))) and the factorial function is
called al long as the ‘if’ condition is fulfilled in the above line. Upon complete calculation the
result is displayed which is 5040.
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
References
Kunasaikaran, J., & Iqbal, A. (2016). A brief overview of functional programming
languages. Electronic Journal of Computer Science and Information Technology:
eJCIST, 6(1).
McJones, P. (2017). The LISP 2 project. IEEE Annals of the History of Computing, 39(4), 85-
92.
Jian, S. L., Lu, K., & Wang, X. P. (2015, September). A survey on concepts and the state of
the art of functional programming languages. In Systems and Computer Technology:
Proceedings of the 2014 International Symposium on Systmes and Computer technology
(ISSCT 2014), Shanghai, China, 15–17 November 2014 (p. 71).
Knott, G. D. (2017). LISP. In Interpreting LISP (pp. 1-1). Apress, Berkeley, CA.
Méndez, L. A. (2016). Lisp Programming. In A Practical Introduction to Fuzzy Logic using
LISP (pp. 93-127). Springer, Cham.
chevron_up_icon
1 out of 5
circle_padding
hide_on_mobile
zoom_out_icon
logo.png

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]