Author: admin

  • Tree

    You can build tree data structures from cons cells, as lists of lists. To implement tree structures, you will have to design functionalities that would traverse through the cons cells, in specific order, for example, pre-order, in-order, and post-order for binary trees. Tree as List of Lists Let us consider a tree structure made up…

  • Set

    Common Lisp does not provide a set data type. However, it provides number of functions that allows set operations to be performed on a list. You can add, remove, and search for items in a list, based on various criteria. You can also perform various set operations like: union, intersection, and set difference. Implementing Sets…

  • Vectors

    Vectors are one-dimensional arrays, therefore a subtype of array. Vectors and lists are collectively called sequences. Therefore all sequence generic functions and array functions we have discussed so far, work on vectors. Creating Vectors The vector function allows you to make fixed-size vectors with specific values. It takes any number of arguments and returns a…

  • 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…