Lesson 1. The Clojure syntax

 

Clojure is a LISP dialect. Lisp is a family of computer programming languages with a long history and a distinctive, fully parenthesized prefix notation

As a LISP dialect, Clojure uses the LISP syntax and its fully parenthesized prefix notation. Let’s see what it means.

There is a fundamental difference in the order of the parentheses between the LISP syntax and the syntax of most other languages. In other languages like Java or ruby, we have different syntaxes for different parts of the language while in Clojure all parts of the language follows the same syntax: the syntax of an s-expression or a symbolic expression.

In this Lesson, we will illustrate the uniqueness of the Clojure syntax by focusing on function calls, arithmetic expressions and if expressions at a very high level. Those topics will be covered in much more details in Unit 1 and Unit 3.

After reading this lesson, you will be able to:

  • Describe the order of the elements in a Clojure expression
  • Read function call expressions in Clojure
  • Read arithmetic expressions in Clojure
  • Read if expressions in Clojure

1.1   Function calls

1.2   Arithmetic expressions

1.3   if expressions

1.4   Summary