Category: 07. Lisp

  • Decision Making

    Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false. Following is the…

  • Operators

    An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. LISP allows numerous operations on data, supported by various functions, macros and other constructs. The operations allowed on data could be categorized as − Arithmetic Operations The following table shows all the arithmetic operators supported by LISP. Assume variable A holds…

  • Constants

    In LISP, constants are variables that never change their values during program execution. Constants are declared using the defconstant construct. Example The following example shows declaring a global constant PI and later using this value inside a function named area-circle that calculates the area of a circle. The defun construct is used for defining a function, we will look into it…

  • Variables

    In LISP, each variable is represented by a symbol. The variable’s name is the name of the symbol and it is stored in the storage cell of the symbol. Global Variables Global variables have permanent values throughout the LISP system and remain in effect until a new value is specified. Global variables are generally declared using…

  • Macros

    Macros allow you to extend the syntax of standard LISP. Technically, a macro is a function that takes an s-expression as arguments and returns a LISP form, which is then evaluated. Defining a Macro In LISP, a named macro is defined using another macro named defmacro. Syntax for defining a macro is − The macro definition consists…

  • Data Types

    In LISP, variables are not typed, but data objects are. LISP data types can be categorized as. Any variable can take any LISP object as its value, unless you have declared it explicitly. Although, it is not necessary to specify a data type for a LISP variable, however, it helps in certain loop expansions, in…

  • Basic Syntax

    Basic Building Blocks in LISP LISP programs are made up of three basic building blocks − An atom is a number or string of contiguous characters. It includes numbers and special characters. Following are examples of some valid atoms − A list is a sequence of atoms and/or other lists enclosed in parentheses. Following are examples of some valid…

  • Program Structure

    LISP expressions are called symbolic expressions or s-expressions. The s-expressions are composed of three valid objects, atoms, lists and strings. Any s-expression is a valid program. LISP programs run either on an interpreter or as compiled code. The interpreter checks the source code in a repeated loop, which is also called the read-evaluate-print loop (REPL). It reads the…

  • Environment Setup

    Local Environment Setup If you are still willing to set up your environment for Lisp programming language, you need the following two softwares available on your computer, (a) Text Editor and (b) The Lisp Executer. Text Editor This will be used to type your program. Examples of few editors include Windows Notepad, OS Edit command,…

  • Overview

    John McCarthy invented LISP in 1958, shortly after the development of FORTRAN. It was first implemented by Steve Russell on an IBM 704 computer. It is particularly suitable for Artificial Intelligence programs, as it processes symbolic information effectively. Common Lisp originated, during the 1980s and 1990s, in an attempt to unify the work of several…