Lisp (derives from “LISt Processing”) is one of the oldest programming languages. It was invented in 1958, with the language being conceived by John McCarthy and is based on his paper “Recursive Functions of Symbolic Expressions and Their Computation by Machine”. Over the years, Lisp has evolved into a family of programming languages. The most commonly used general-purpose dialects are Common Lisp and Scheme. Other dialects include Franz Lisp, Interlisp, Portable Standard Lisp, XLISP and Zetalisp.
The majority of Lisp implementations offer a lot more than just a programming language. They include an entire environment such as debuggers, inspectors, tracing, and other tools to add the Lisp developer. Lisp is a practical, expression-oriented, interactive programming language which uses linked lists as one of its major data structures. A Lisp list is written with its elements separated by whitespace, and surrounded by parentheses. Lisp source code is itself comprised of lists.
The language has many unique features that make it excellent to study programming constructs and data structures. Many regard Lisp as an extremely natural language to code complex symbolic reasoning programs. Lisp is popular in the fields of artificial intelligence and symbolic algebra.
1. Common Lisp: A Gentle Introduction to Symbolic Computation by David S. Touretzky
Common Lisp: A Gentle Introduction to Symbolic Computation is about learning to program in Lisp. Although widely known as the principal language of artificial intelligence research—one of the most advanced areas of computer science—Lisp is an excellent language for beginners.
This 1990 edition may be distributed in hardcopy form, for non-profit educational purposes, provided that no fee is charged to the recipient beyond photocopying costs.
Chapters cover the following:
- Introduction – begins with an overview of the notions of function and data, followed by examples of several built-in Lisp functions.
- Lists – these are the central data type for Lisp.
- EVAL notation – a more flexible notation. EVAL notation allows us to write functions that accept other functions as inputs.
- Conditionals – study some special decision-making functions, called conditionals, that choose their result from among a set of alternatives based on the value of one or more predicate expressions.
- Variables and Side Effects – provides readers with a better understanding of the different kinds of variables that may appear in Lisp programs, how variables are created, and how their values may change over time.
- List Data Structures – presents more list-manipulation functions, and shows how lists are used to implement such other data structures as sets, tables, and trees.
- Applicative Programming – based on the idea that functions are data, just like symbols and lists are data, so one should be able to pass functions as inputs to other functions, and also return functions as values.
- Recursion – Recursive control structure is the main topic of this chapter, but we will also take a look at recursive data structures in the Advanced Topics section.
- Input/Output – Lisp’s read-eval-print loop provides a simple kind of i/o, since it reads expressions from the keyboard and prints the results on the display.
- Assignment – frequently used in combination with iterative control structures, which are discussed in the following chapter.
- Iteration and Block Structure – provides powerful iteration constructs called DO and DO*, as well as simple ones called DOTIMES and DOLIST. Learn about block structure, a concept borrowed from the Algol family of languages, which includes Pascal, Modula, and Ada.
- Structures and The Type System – explains how new structure types are defined and how structures may be created and modified. Structures are an example of a programmer-defined datatype.
- Arrays, Hash Tables And Property Lists – briefly covers three distinct datatypes: arrays, hash tables, and property lists.
- Macros and Compilation – use evaltrace diagrams and a little tool called PPMX (defined in the Lisp Toolkit section) to see how macros work. The chapter also looks at compilation. The compiler translates Lisp programs into machine language programs, which can result in a 10 to 100 times speedup.
At the end of each chapter there is optional advanced material to hold interest of junior and senior science majors. There are also exercises for the reader to work through.
2. COMMON LISP: An Interactive Approach by Stuart C. Shapiro
COMMON LISP: An Interactive Approach is a self-paced study guide to teach readers the COMMON LISP programming language. It aims to help programmers learn this dialect by experimenting with it via an interactive computer terminal.
This book has been used as the text of the Lisp portion of data structures, programming languages, and artificial intelligence courses and as a self-study guide for students, faculty members, and others learning Lisp independently.
This book examines the following areas:
- Numbers – interact with the Lisp listener and distinguishing between objects and their printed representations.
- Lists – discusses the most important type of Lisp object, the list.
- Arithmetic – start evaluating list objects. Evaluating list objects is the basic operation involved in writing, testing, and using Lisp.
- Strings and Characters – along with lists, symbols are the most important kind of objects in Lisp because they are used for program variables, for function names (as was already briefly mentioned), and as data to allow Lisp programs to manipulate symbolic data as well as numeric data.
- Symbols – another Common Lisp data type, like integers, floating-point numbers, ratios, characters, strings, and lists.
- Packages – the symbols a programmer intends others to use can be exported from its original package (called its home package) and imported into another package.
- Basic List Processing – discusses the use of lists as data objects—that is, list processing—what Lisp was named for.
Programming in Pure Lisp
- Defining your Own Functions – examines the special form defun.
- Defining Functions in Packages.
- Saving for Another Day.
- Predicate Functions – functions that return either True, represented by Lisp as T, or False, represented by Lisp as NIL.
- Conditional Expressions – one of the two most powerful features of any programming language is the conditional.
- Recursion – the use of recursive functions is called recursion.
- Recursion on Lists, Part 1 – Analysis: start writing recursive functions that operate on lists.
- Recursion on Lists, Part 2 – Synthesis.
- Recursion on Trees.
- The Evaluator – Lisp’s evaluator is the function eval, a function of one argument. It gets its single argument evaluated, and it evaluates it one more time and returns that value.
- Functions with Arbitrary Numbers of Arguments – consider the entire structure of lists whose members are also lists and allow recursion down the first parts as well.
- Mapping Functions.
- The Applicator.
- Macros – another kind of functionlike object that get their arguments unevaluated.
Programming in Imperative Lisp:
- Assignment – the most basic imperative statement is the assignment statement, which assigns a value to a variable.
- Scope and Extent – the scope of a variable is the spatiotemporal area of a program in which a given variable has a given name. The extent of a variable is the spatiotemporal area of a program in which a given variable has a given storage location.
- Local Variables – introduce one or more new local, lexically scoped variables that will be used only within the body of a single function.
- Iteration – the traditional imperative way of repeating computations, and iterative constructs have been included in Common Lisp for those programmers who prefer them.
- Destructive List Manipulation.
- Property Lists – the use of property lists to store information about symbols or about the entities the symbols represent.
- Hash Tables – a type of Common Lisp object that are used for associating arbitrary pieces of information with each of a set of Common Lisp objects.
The licensing conditions of the book are sufficiently open. Web links must point to the author’s page rather than to a separate copy of the dvi, ps, or pdf file.
3. Structure and Interpretation of Computer Programs by Harold Abelson and Gerald Jay Sussman with Julie Sussman
Structure and Interpretation of Computer Programs is a textbook which teaches the principles of computing programming. It is a classic text in computer science, a definite must read.
The book focuses on the main role played by different approaches to dealing with time in computational models.
The material in this book has been the basis of MIT’s entry-level computer science subject since 1980. The authors use the programming language Lisp to educate the reader.
Pages in this article:
Page 1 – Common Lisp: A Gentle Introduction to Symbolic Computation
Page 2 – Patterns of Software: Tales from the Software Community and more books
Page 3 – Casting SPELs in Lisp and more books
Page 4 – Paradigms of Artificial Intelligence Programming and more books
Page 5 – Interpreting LISP and more books
Page 6 – The Evolution of Lisp
All books in this series:
|Free Programming Books|
|Ada||ALGOL-like programming language, extended from Pascal and other languages|
|Agda||Dependently typed functional language based on intuitionistic Type Theory|
|Arduino||Inexpensive, flexible, open source microcontroller platform|
|Assembly||As close to writing machine code without writing in pure hexadecimal|
|Awk||Versatile language designed for pattern scanning and processing language|
|Bash||Shell and command language; popular both as a shell and a scripting language|
|BASIC||Beginner’s All-purpose Symbolic Instruction Code|
|C||General-purpose, procedural, portable, high-level language|
|C++||General-purpose, portable, free-form, multi-paradigm language|
|C#||Combines the power and flexibility of C++ with the simplicity of Visual Basic|
|Clojure||Dialect of the Lisp programming language|
|COBOL||Common Business-Oriented Language|
|Coq||Dependently typed language similar to Agda, Idris, F* and others|
|Crystal||General-purpose, concurrent, multi-paradigm, object-oriented language|
|CSS||CSS (Cascading Style Sheets) specifies a web page’s appearance|
|D||General-purpose systems programming language with a C-like syntax|
|Dart||Client-optimized language for fast apps on multiple platforms|
|Dylan||Multi-paradigm language supporting functional and object-oriented coding|
|ECMAScript||Best known as the language embedded in web browsers|
|Eiffel||Object-oriented language designed by Bertrand Meyer|
|Elixir||Relatively new functional language running on the Erlang virtual machine|
|Erlang||General-purpose, concurrent, declarative, functional language|
|F#||Uses functional, imperative, and object-oriented programming methods|
|Factor||Dynamic stack-based programming language|
|Forth||Imperative stack-based programming language|
|Fortran||The first high-level language, using the first compiler|
|Go||Compiled, statically typed programming language|
|Groovy||Powerful, optionally typed and dynamic language|
|Haskell||Standardized, general-purpose, polymorphically, statically typed language|
|HTML||HyperText Markup Language|
|Icon||Wide variety of features for processing and presenting symbolic data|
|J||Array programming language based primarily on APL|
|Java||General-purpose, concurrent, class-based, object-oriented, high-level language|
|Julia||High-level, high-performance language for technical computing|
|Kotlin||More modern version of Java|
|LabVIEW||Designed to enable domain experts to build power systems quickly|
|LaTeX||Professional document preparation system and document markup language|
|Lisp||Unique features - excellent to study programming constructs|
|Logo||Dialect of Lisp that features interactivity, modularity, extensibility|
|Lua||Designed as an embeddable scripting language|
|Markdown||Plain text formatting syntax designed to be easy-to-read and easy-to-write|
|Objective-C||Object-oriented language that adds Smalltalk-style messaging to C|
|OCaml||The main implementation of the Caml language|
|Pascal||Imperative and procedural language designed in the late 1960s|
|Perl||High-level, general-purpose, interpreted, scripting, dynamic language|
|PHP||PHP has been at the helm of the web for many years|
|PostScript||Interpreted, stack-based and Turing complete language|
|Prolog||A general purpose, declarative, logic programming language|
|Python||General-purpose, structured, powerful language|
|QML||Hierarchical declarative language for user interface layout - JSON-like syntax|
|R||De facto standard among statisticians and data analysts|
|Racket||General-purpose, object-oriented, multi-paradigm, functional language|
|Raku||Member of the Perl family of programming languages|
|Ruby||General purpose, scripting, structured, flexible, fully object-oriented language|
|Rust||Ideal for systems, embedded, and other performance critical code|
|Scala||Modern, object-functional, multi-paradigm, Java-based language|
|Scheme||A general-purpose, functional language descended from Lisp and Algol|
|Scratch||Visual programming language designed for 8-16 year-old children|
|SQL||Access and manipulate data held in a relational database management system|
|Standard ML||General-purpose functional language characterized as "Lisp with types"|
|Swift||Powerful and intuitive general-purpose programming language|
|Tcl||Dynamic language based on concepts of Lisp, C, and Unix shells|
|TeX||Markup and programming language - create professional quality typeset text|
|Vala||Object-oriented language, syntactically similar to C#|
|VHDL||Hardware description language used in electronic design automation|
|VimL||Powerful scripting language of the Vim editor|
|XML||Rules for defining semantic tags describing structure ad meaning|