Category: 07. Lisp

  • Symbols

    In LISP, a symbol is a name that represents data objects and interestingly it is also a data object. What makes symbols special is that they have a component called the property list, or plist. Property Lists LISP allows you to assign properties to symbols. For example, let us have a ‘person’ object. We would like this…

  • Lists

    Lists had been the most important and the primary composite data structure in traditional LISP. Present day’s Common LISP provides other data structures like, vector, hash table, classes or structures. Lists are single linked lists. In LISP, lists are constructed as a chain of a simple record structure named cons linked together. The cons Record Structure A cons is…

  • Sequences

    Sequence is an abstract data type in LISP. Vectors and lists are the two concrete subtypes of this data type. All the functionalities defined on sequence data type are actually applied on all vectors and list types. In this section, we will discuss most commonly used functions on sequences. Before starting on various ways of…

  • Strings

    Strings in Common Lisp are vectors, i.e., one-dimensional array of characters. String literals are enclosed in double quotes. Any character supported by the character set can be enclosed within double quotes to make a string, except the double quote character (“) and the escape character (\). However, you can include these by escaping them with…

  • Arrays

    LISP allows you to define single or multiple-dimension arrays using the make-array function. An array can store any LISP object as its elements. All arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element. The number of dimensions of an array is called its rank.…

  • Characters

    In LISP, characters are represented as data objects of type character. You can denote a character object preceding #\ before the character itself. For example, #\a means the character a. Space and other special characters can be denoted by preceding #\ before the name of the character. For example, #\SPACE represents the space character. The following…

  • Numbers

    Common Lisp defines several kinds of numbers. The number data type includes various kinds of numbers supported by LISP. The number types supported by LISP are − The following diagram shows the number hierarchy and various numeric data types available in LISP − Various Numeric Types in LISP The following table describes various number type data available…

  • Predicates

    Predicates are functions that test their arguments for some specific conditions and returns nil if the condition is false, or some non-nil value is the condition is true. The following table shows some of the most commonly used predicates − Sr.No. Predicate & Description 1 atomIt takes one argument and returns t if the argument…

  • Functions

    A function is a group of statements that together perform a task. You can divide up your code into separate functions. How you divide up your code among different functions is up to you, but logically the division usually is so each function performs a specific task. Defining Functions in LISP The macro named defun is used…

  • Loops

    There may be a situation, when you need to execute a block of code numbers of times. A loop statement allows us to execute a statement or group of statements multiple times and following is the general form of a loop statement in most of the programming languages. LISP provides the following types of constructs…