Data Types

Clojure provides a number of data types, most of which are unsurprising:

  • Vars provide mutable storage locations. These can be bound and rebound on a per-thread basis.

  • Booleans can have a value of true or false; nil values are also treated as false.

  • Numbers can be integers, doubles, floats, or fractions.

  • Symbols are used as identifiers for variables.

  • Keywords are symbols that reference themselves and are denoted by a colon; these are often used as keys in maps.

  • Strings are denoted by double quotes and can span multiple lines.

  • Characters are denoted by a preceding backslash.

  • Regular expressions are strings prefixed with a hash symbol.

In addition to the data types, Clojure provides a rich set of standard collections. These include ...

Get Web Development with Clojure, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.