Contents    Prev    Next    Page+10    Index   

Clojure

We will learn only a fraction of Clojure, mainly the small amount we will need to handle lists and trees (composed of nested lists).

We will use the List/Tree as our primary data structure and as a notation that allows trees to be printed and to be input as data.

Like Lisp, Clojure is homoiconic, which means that Clojure code and Clojure data are the same thing. This means that a program can write (and then execute) code at runtime.

A list is written inside parentheses (the external notation). A function call is written with the function name as the first thing in the list, followed by arguments:


       (+ i 2)       ; i + 2