11. Types

Common Lisp is a dynamically and strongly typed language. This means that variables do not have a fixed type, but data types are strictly respected during execution.

Some of the most common data types in Common Lisp are:

  • Numbers: integer, float, rational, complex, and number.
  • Text strings: character and string.
  • Symbols: symbol, keyword, and null.
  • Lists: list, cons, and nil.
  • Sequences: sequence, vector, and array.
  • Hash tables: hash-table, structure-object, and standard-object.
  • Functions: function, compiled-function, and generic-function.
  • Special: t (true), nil (false or empty list), and boolean.

There are more types, but these are the ones most commonly used.

To check the type of a value, you can use predicates such as typep:

* (typep 42 'integer)
T

* (typep 3.14 'float)
T

* (typep "Hola" 'string)
T

* (typep '(a b c) 'list)
T
Building SPAs with Django and HTML Over the Wire: Learn to build real-time single page applications with Python

Building SPAs with Django and HTML Over the Wire: Learn to build real-time single page applications with Python

The HTML over WebSockets approach simplifies single-page application (SPA) development and lets you bypass learning a JavaScript rendering framework such as React, Vue, or Angular, moving the logic to Python. This web application development book provides you with all the Django tools you need to simplify your developments with real-time results.

Buy the book

Help me keep writing

Every coffee gives me a push toward the next article.

Comments

There are no comments yet.